mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add O_DIRECT version of fio benchmarks to track direct I/O performance.
PiperOrigin-RevId: 549470615
This commit is contained in:
committed by
gVisor bot
parent
a455fbd2a7
commit
0244c8c19f
@@ -562,12 +562,18 @@ steps:
|
||||
# but for tmpfs mounts, the size can grow to more memory than the machine
|
||||
# has available. Fix the runs to 1GB written/read for the benchmark.
|
||||
- <<: *benchmarks
|
||||
label: ":floppy_disk: FIO benchmarks (read/write)"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:fio_test BENCHMARKS_FILTER=Fio/operation\.[rw][er] BENCHMARKS_OPTIONS=--test.benchtime=1000x
|
||||
label: ":floppy_disk: FIO benchmarks (read/write :nest_with_eggs: buffered)"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:fio_test BENCHMARKS_FILTER='Fio/operation\.[rw][er].*/directIO\.false' BENCHMARKS_OPTIONS=--test.benchtime=1000x
|
||||
# For rand(read|write) fio benchmarks, running 15s does not overwhelm the system for tmpfs mounts.
|
||||
- <<: *benchmarks
|
||||
label: ":cd: FIO benchmarks (randread/randwrite)"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:fio_test BENCHMARKS_FILTER=Fio/operation\.rand BENCHMARKS_OPTIONS=--test.benchtime=1000x
|
||||
label: ":cd: FIO benchmarks (randread/randwrite :nest_with_eggs: buffered)"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:fio_test BENCHMARKS_FILTER='Fio/operation\.rand.*/directIO\.false' BENCHMARKS_OPTIONS=--test.benchtime=1000x
|
||||
- <<: *benchmarks
|
||||
label: ":floppy_disk: FIO benchmarks (read/write :empty_nest: O_DIRECT)"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:fio_test BENCHMARKS_FILTER='Fio/operation\.[rw][er].*/directIO\.true' BENCHMARKS_OPTIONS=--test.benchtime=1000x
|
||||
- <<: *benchmarks
|
||||
label: ":cd: FIO benchmarks (randread/randwrite :empty_nest: O_DIRECT)"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:fio_test BENCHMARKS_FILTER='Fio/operation\.rand.*/directIO\.true' BENCHMARKS_OPTIONS=--test.benchtime=1000x
|
||||
- <<: *benchmarks
|
||||
label: ":cd: Ruby CI/CD benchmarks"
|
||||
command: make -i benchmark-platforms BENCHMARKS_SUITE=fio BENCHMARKS_TARGETS=test/benchmarks/fs:rubydev_test BENCHMARKS_OPTIONS=-test.benchtime=1ns
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -72,6 +73,54 @@ func BenchmarkFio(b *testing.B) {
|
||||
BlockSize: 4,
|
||||
IODepth: 4,
|
||||
},
|
||||
{
|
||||
Test: "write",
|
||||
BlockSize: 4,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "write",
|
||||
BlockSize: 64,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "write",
|
||||
BlockSize: 1024,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "read",
|
||||
BlockSize: 4,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "read",
|
||||
BlockSize: 64,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "read",
|
||||
BlockSize: 1024,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "randwrite",
|
||||
BlockSize: 4,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
{
|
||||
Test: "randread",
|
||||
BlockSize: 4,
|
||||
IODepth: 4,
|
||||
Direct: true,
|
||||
},
|
||||
}
|
||||
|
||||
machine, err := harness.GetMachine()
|
||||
@@ -90,11 +139,15 @@ func BenchmarkFio(b *testing.B) {
|
||||
Name: "blockSize",
|
||||
Value: fmt.Sprintf("%dK", tc.BlockSize),
|
||||
}
|
||||
directIO := tools.Parameter{
|
||||
Name: "directIO",
|
||||
Value: strconv.FormatBool(tc.Direct),
|
||||
}
|
||||
filesystem := tools.Parameter{
|
||||
Name: "filesystem",
|
||||
Value: string(fsType),
|
||||
}
|
||||
name, err := tools.ParametersToName(operation, blockSize, filesystem)
|
||||
name, err := tools.ParametersToName(operation, blockSize, directIO, filesystem)
|
||||
if err != nil {
|
||||
b.Fatalf("Failed to parser paramters: %v", err)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ type Fio struct {
|
||||
Size int // total size to be read/written in megabytes.
|
||||
BlockSize int // block size to be read/written in kilobytes.
|
||||
IODepth int // I/O depth for reads/writes.
|
||||
Direct bool // Whether to use direct I/O (O_DIRECT) or not.
|
||||
}
|
||||
|
||||
// MakeCmd makes a 'fio' command.
|
||||
@@ -38,6 +39,11 @@ func (f *Fio) MakeCmd(filename string) []string {
|
||||
cmd = append(cmd, fmt.Sprintf("--blocksize=%dK", f.BlockSize))
|
||||
cmd = append(cmd, fmt.Sprintf("--filename=%s", filename))
|
||||
cmd = append(cmd, fmt.Sprintf("--iodepth=%d", f.IODepth))
|
||||
if f.Direct {
|
||||
cmd = append(cmd, "--direct=1")
|
||||
} else {
|
||||
cmd = append(cmd, "--direct=0")
|
||||
}
|
||||
cmd = append(cmd, fmt.Sprintf("--rw=%s", f.Test))
|
||||
if f.Test == "read" || f.Test == "randread" {
|
||||
// Don't call `fallocate` during read-only tests.
|
||||
|
||||
Reference in New Issue
Block a user