fio benchmark: Do not call fallocate in read-only benchmarks.

Calling `fallocate` is not a typical operation for an application to do when
it is only trying to read a file.

This has performance implications for gVisor, so we override `fio`'s default
behavior for read-only benchmarks to be more representative of real-world
read-only performance.

PiperOrigin-RevId: 547912572
This commit is contained in:
Etienne Perot
2023-07-13 14:00:59 -07:00
committed by gVisor bot
parent 91b023d95c
commit 21dbd18156
+9
View File
@@ -39,6 +39,15 @@ func (f *Fio) MakeCmd(filename string) []string {
cmd = append(cmd, fmt.Sprintf("--filename=%s", filename))
cmd = append(cmd, fmt.Sprintf("--iodepth=%d", f.IODepth))
cmd = append(cmd, fmt.Sprintf("--rw=%s", f.Test))
if f.Test == "read" || f.Test == "randread" {
// Don't call `fallocate` during read-only tests.
// Calling `fallocate` is not a typical operation for an application to do
// when it is only trying to read a file.
// This has performance implications for gVisor, so we override fio's
// default behavior for read-only benchmarks to be more representative of
// real-world read-only performance.
cmd = append(cmd, "--fallocate=none")
}
return cmd
}