All Products
Search
Document Center

Container Service for Kubernetes:pengujian stres kinerja ossfs 2.0

Last Updated:Aug 26, 2026

Topik ini menjelaskan kinerja ossfs 2.0 dalam berbagai skenario, seperti throughput baca/tulis dan beban kerja konkuren, serta menyediakan data referensi untuk membantu Anda mengevaluasi dan mengadopsi ossfs 2.0 bagi beban kerja Anda.

Lingkungan pengujian

  • Lingkungan perangkat keras

    • Tipe instance: ecs.g9i.48xlarge

    • vCPU: 192 vCPU

    • Memori: 768 GiB

    • Bandwidth jaringan: 64 Gbps

  • Lingkungan perangkat lunak

    • Sistem operasi: Alibaba Cloud Linux 3.2104 LTS 64-bit

    • Versi kernel: 5.10.134-18.al8.x86_64

    • Versi tool: ossfs 2.0.4, ossfs 1.91.8, dan goofys 0.24.0

Konfigurasi mount

Semua pengujian mengasumsikan volume OSS dimount di /mnt/oss dalam kontainer.

  • ossfs 2.0

    Tambahkan parameter otherOpts untuk mengatur ukuran unggah multi-bagian menjadi 33554432 byte.

    upload_buffer_size=33554432
  • ossfs 1.0

    Tambahkan parameter otherOpts untuk mengaktifkan mode baca langsung dan optimisasi cache.

    -o direct_read -o readdir_optimize

Skenario uji

Setiap tool memount bucket yang sama, lalu FIO mengukur kinerja baca/tulis. Berikut hasilnya.

Tulisan sekuensial single-threaded (100 GB)

Catatan

Performa penulisan ossfs 1.0 dibatasi oleh I/O disk.

  • Perintah pengujian

    Tulisan langsung single-threaded sebesar 100 GB dengan ukuran blok 1 MB:

    fio --name=file-100G --ioengine=libaio --rw=write --bs=1M --size=100G --numjobs=1 --direct=1 --directory=/mnt/oss/fio_direct_write --group_reporting
  • Hasil pengujian

    Tool

    Bandwidth

    Pemanfaatan core CPU (100% untuk satu core yang sepenuhnya terbebani)

    Memori puncak

    ossfs 2.0

    2,2 GB/s

    207%

    2167 MB

    ossfs 1.0

    118 MB/s

    5%

    15 MB

    goofys

    450 MB/s

    250%

    7,5 GB

Baca sekuensial single-threaded (100 GB)

  • Perintah pengujian

    Bersihkan page cache, lalu jalankan pembacaan sekuensial single-threaded dengan blok 1 MB:

    echo 1 > /proc/sys/vm/drop_caches
    fio --name=file-100G --ioengine=libaio --direct=1 --rw=read --bs=1M --directory=/mnt/oss/fio_direct_write --group_reporting --numjobs=1
  • Hasil pengujian

    Tool pengujian

    Bandwidth

    Pemanfaatan core CPU (100% untuk satu core yang sepenuhnya terbebani)

    Memori puncak

    ossfs 2.0

    4,3 GB/s

    610%

    1629 MB

    ossfs 1.0

    1,0 GB/s

    530%

    260 MB

    goofys

    1,3 GB/s

    270%

    976 MB

Baca sekuensial multi-threaded (4 × 100 GB)

  • Buat file pengujian

    Buat empat file pengujian masing-masing 100 GB di /mnt/oss/fio:

    fio --name=file-100g --ioengine=libaio --direct=1 --iodepth=1 --numjobs=4 --nrfiles=1 --rw=write --bs=1M  --size=100G --group_reporting --thread --directory=/mnt/oss/fio
  • Perintah pengujian

    Bersihkan page cache, lalu baca empat file 100 GB menggunakan 4 thread selama 30 detik (blok 1 MB) di /mnt/oss/fio:

    echo 1 > /proc/sys/vm/drop_caches
    fio --name=file-100g --ioengine=libaio --direct=1 --iodepth=1 --numjobs=4 --nrfiles=1 --rw=read --bs=1M  --size=100G --group_reporting --thread --directory=/mnt/oss/fio --time_based --runtime=30
  • Hasil pengujian

    Tool

    Bandwidth

    Pemanfaatan core CPU (100% untuk satu core yang sepenuhnya terbebani)

    Memori puncak

    ossfs 2.0

    7,4 GB/s

    890%

    6,2 GB

    ossfs 1.0

    1,8 GB/s

    739%

    735 MB

    goofys

    2,8 GB/s

    7800%

    2,7 GB

Baca file kecil konkuren (128 thread, 100K × 128 KB)

Catatan

OSS memiliki batas QPS default 10.000. Untuk mereproduksi hasil ini, pastikan tidak ada layanan lain yang mengonsumsi kuota QPS akun pengujian.

  • Langkah-langkah

    1. Buat program Go bernama rw-bench.go.

      Program ini secara konkuren membuat atau membaca file dalam direktori target dan melaporkan throughput.

      Kode contoh

      package main
      
      import (
      	"flag"
      	"fmt"
      	"io"
      	"log"
      	"os"
      	"path/filepath"
      	"sync"
      	"time"
      )
      
      var dir = flag.String("dir", "", "work dir")
      var threads = flag.Int("threads", 8, "concurrency threads count")
      var isWrite = flag.Bool("write", false, "test write files")
      var fileSize = flag.Int64("file-size-KB", 128, "file size in KBytes")
      var fileCount = flag.Int("file-count", 0, "file count")
      
      type fileInfo struct {
      	Name string
      	Size int64
      }
      
      func getFileList(dir string, isWrite bool) []fileInfo {
      	var files []fileInfo
      
      	if isWrite {
      		for i := 0; i < *fileCount; i++ {
      			files = append(files, fileInfo{
      				Name: fmt.Sprintf("%v/%v.dat", dir, i),
      				Size: *fileSize * 1024,
      			})
      		}
      	} else {
      		err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
      			if err != nil {
      				return err
      			}
      			if !info.IsDir() {
      				files = append(files, fileInfo{
      					Name: path,
      					Size: info.Size(),
      				})
      			}
      			return nil
      		})
      
      		if err != nil {
      			log.Fatalf("Error walking the path %v: %v\n", dir, err)
      		}
      	}
      
      	return files
      }
      
      func worker(taskChan <-chan fileInfo, wg *sync.WaitGroup, bytesChan chan<- int64, isWrite bool) {
      	defer wg.Done()
      	buffer := make([]byte, 1024*1024)
      
      	for fInfo := range taskChan {
      		var fd *os.File
      		var err error
      		if isWrite {
      			fd, err = os.OpenFile(fInfo.Name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
      			if err != nil {
      				fmt.Printf("Failed to create/open %v with %v\n", fInfo.Name, err)
      				continue
      			}
      		} else {
      			fd, err = os.OpenFile(fInfo.Name, os.O_RDONLY, 0)
      			if err != nil {
      				fmt.Printf("Failed to open %v with %v\n", fInfo.Name, err)
      				continue
      			}
      		}
      
      		offset := int64(0)
      		var totalBytes int64
      		for offset < fInfo.Size {
      			var n int
      
      			if offset+int64(len(buffer)) > fInfo.Size {
      				buffer = buffer[:fInfo.Size-offset]
      			}
      
      			if isWrite {
      				n, err = fd.WriteAt(buffer, offset)
      				if err != nil {
      					fmt.Printf("Failed to write file %v at %v, with %v\n", fInfo.Name, offset, err)
      					break
      				}
      			} else {
      				n, err = fd.ReadAt(buffer, offset)
      				if err != nil && err != io.EOF {
      					fmt.Printf("Failed to read file %v at %v, with %v\n", fInfo.Name, offset, err)
      					break
      				}
      			}
      
      			totalBytes += int64(n)
      			offset += int64(n)
      		}
      
      		fd.Close()
      		bytesChan <- totalBytes
      	}
      }
      
      func doBench(dir string, isWrite bool) {
      	files := getFileList(dir, isWrite)
      	var wg sync.WaitGroup
      
      	if isWrite {
      		fmt.Printf("start write bench with %v files\n", len(files))
      	} else {
      		fmt.Printf("start read bench with %v files\n", len(files))
      	}
      
      	taskChan := make(chan fileInfo, 1024)
      
      	go func(taskChan chan<- fileInfo) {
      		for _, fInfo := range files {
      			taskChan <- fInfo
      		}
      		close(taskChan)
      	}(taskChan)
      
      	bytesChan := make(chan int64, 1024)
      	for i := 0; i < *threads; i++ {
      		wg.Add(1)
      		go worker(taskChan, &wg, bytesChan, isWrite)
      	}
      
      	st := time.Now()
      	go func() {
      		wg.Wait()
      		close(bytesChan)
      	}()
      
      	var totalBytes int64
      	for bytes := range bytesChan {
      		totalBytes += bytes
      	}
      
      	ed := time.Now()
      	duration := ed.Sub(st)
      	throughput := float64(totalBytes) / (float64(duration.Nanoseconds()) / 1e9)
      
      	fmt.Printf("Total time: %v\n", duration)
      	if isWrite {
      		fmt.Printf("Write throughput: %.2f MBytes/s\n", throughput/1000/1000)
      	} else {
      		fmt.Printf("Read throughput: %.2f MBytes/s\n", throughput/1000/1000)
      	}
      }
      
      func main() {
      	flag.Parse()
      
      	workdir := *dir
      	if workdir == "" {
      		flag.Usage()
      		os.Exit(1)
      	}
      
      	if _, err := os.Stat(workdir); err != nil {
      		fmt.Printf("Failed to access %v with %v\n", workdir, err)
      		os.Exit(1)
      	}
      
      	doBench(workdir, *isWrite)
      }
    2. Kompilasi file program rw-bench.go.

      go build rw-bench.go
    3. Buat 100.000 file (masing-masing 128 KB) di direktori yang dimount:

      mkdir -p <path_to_mounted_test_directory> && ./rw-bench --dir <path_to_mounted_test_directory> --file-size-KB 128 --file-count 100000 --write
    4. Bersihkan page cache dan jalankan pengujian lima kali. Catat hasil kondisi stabil setelah latensi stabil.

      echo 1 > /proc/sys/vm/drop_caches
      ./rw-bench --dir <path_to_mounted_test_directory> --threads 128
  • Hasil pengujian

    Tool

    Bandwidth

    Pemanfaatan core CPU (100% untuk satu core yang sepenuhnya terbebani)

    Memori puncak

    ossfs 2.0

    1 GB/s

    247%

    176 MB

    ossfs 1.0

    45 MB/s

    25%

    412 MB

    goofys

    1 GB/s

    750%

    1,3 GB