Skip to content

Commit d284a99

Browse files
EtiennePerotgvisor-bot
authored andcommitted
PGO: Reduce combinations of nginx benchmarks run for PGO purposes.
PiperOrigin-RevId: 785581845
1 parent 69d6da9 commit d284a99

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

pkg/test/dockerutil/dockerutil.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ func IsGVisorRuntime(ctx context.Context, t *testing.T) (bool, error) {
177177
return strings.Contains(output, "gVisor"), nil
178178
}
179179

180+
// IsPGO returns true if the test is a PGO benchmark run.
181+
func IsPGO() bool {
182+
return *pgoBenchmarks
183+
}
184+
180185
// SkipIfPGO skips the test if it is a PGO benchmark run.
181186
func SkipIfPGO[TB testing.TB](tb TB) {
182187
if *pgoBenchmarks {

test/benchmarks/network/nginx_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func BenchmarkNginxDocSize(b *testing.B) {
4343
// BenchmarkContinuousNginx runs specific benchmarks for continuous jobs.
4444
// The runtime under test is the sever serving a runc client.
4545
func BenchmarkContinuousNginx(b *testing.B) {
46+
dockerutil.SkipIfPGO(b)
4647
sizes := []string{"10Kb", "100Kb", "1Mb"}
4748
threads := []int{1, 25, 100, 1000}
4849
benchmarkNginxContinuous(b, threads, sizes)
@@ -51,8 +52,18 @@ func BenchmarkContinuousNginx(b *testing.B) {
5152
// benchmarkNginxDocSize iterates through all doc sizes, running subbenchmarks
5253
// for each size.
5354
func benchmarkNginxDocSize(b *testing.B, tmpfs bool) {
54-
for size, filename := range nginxDocs {
55+
docs := nginxDocs
56+
if dockerutil.IsPGO() {
57+
docs = map[string]string{
58+
"1Kb": "latin1k.txt",
59+
"10Mb": "latin10240k.txt",
60+
}
61+
}
62+
for size, filename := range docs {
5563
concurrency := []int{1, 25, 50, 100, 1000}
64+
if dockerutil.IsPGO() {
65+
concurrency = []int{1, 100}
66+
}
5667
for _, c := range concurrency {
5768
fsize := tools.Parameter{
5869
Name: "filesize",

0 commit comments

Comments
 (0)