From 21dbd18156e061e0f4211ad5c7945e69ae1d6671 Mon Sep 17 00:00:00 2001 From: Etienne Perot Date: Thu, 13 Jul 2023 13:58:09 -0700 Subject: [PATCH] `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 --- test/benchmarks/tools/fio.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/benchmarks/tools/fio.go b/test/benchmarks/tools/fio.go index ea12436d2..eb2fef2a0 100644 --- a/test/benchmarks/tools/fio.go +++ b/test/benchmarks/tools/fio.go @@ -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 }