summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/network/nginx_test.go
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2020-12-11 12:35:42 -0800
committergVisor bot <gvisor-bot@google.com>2020-12-11 12:37:28 -0800
commit305a456551467623d38acdb5a1b9741cb0dc1219 (patch)
tree71d2fd82dcb7197b91948440c3fd9e04b4759909 /test/benchmarks/network/nginx_test.go
parent4cba3904f414775371f86571a549454aafad19bf (diff)
Adjust requests to be constant equal to b.N in network tests.
For "hey", requests >= concurrency. b.N can be set by the --test.benchtime={b.N}x. The previous setting of b.N * c can be surprisingly slow for larger c. Set the requests to max(b.N, c) and log to the user if it is c. PiperOrigin-RevId: 347053675
Diffstat (limited to 'test/benchmarks/network/nginx_test.go')
-rw-r--r--test/benchmarks/network/nginx_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/benchmarks/network/nginx_test.go b/test/benchmarks/network/nginx_test.go
index 6e7a4dec4..87449612a 100644
--- a/test/benchmarks/network/nginx_test.go
+++ b/test/benchmarks/network/nginx_test.go
@@ -92,9 +92,14 @@ func benchmarkNginxDocSize(b *testing.B, reverse, tmpfs bool) {
b.Fatalf("Failed to parse parameters: %v", err)
}
+ requests := b.N
+ if requests < c {
+ b.Logf("b.N is %d must be greater than threads %d. Consider running with --test.benchtime=Nx where N >= %d", b.N, c, c)
+ requests = c
+ }
b.Run(name, func(b *testing.B) {
hey := &tools.Hey{
- Requests: c * b.N,
+ Requests: requests,
Concurrency: c,
Doc: filename,
}
@@ -128,9 +133,9 @@ func benchmarkNginxContinuous(b *testing.B, concurrency []int, sizes []string, r
if err != nil {
b.Fatalf("Failed to parse parameters: %v", err)
}
-
requests := b.N
if requests < c {
+ b.Logf("b.N is %d must be greater than threads %d. Consider running with --test.benchtime=Nx where N >= %d", b.N, c, c)
requests = c
}
b.Run(name, func(b *testing.B) {