summaryrefslogtreecommitdiffhomepage
path: root/test/benchmarks/network/nginx_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/benchmarks/network/nginx_test.go')
-rw-r--r--test/benchmarks/network/nginx_test.go53
1 files changed, 23 insertions, 30 deletions
diff --git a/test/benchmarks/network/nginx_test.go b/test/benchmarks/network/nginx_test.go
index 9ec70369b..08565d0b2 100644
--- a/test/benchmarks/network/nginx_test.go
+++ b/test/benchmarks/network/nginx_test.go
@@ -14,7 +14,7 @@
package network
import (
- "fmt"
+ "strconv"
"testing"
"gvisor.dev/gvisor/pkg/test/dockerutil"
@@ -31,30 +31,6 @@ var nginxDocs = map[string]string{
"10Mb": "latin10240k.txt",
}
-// BenchmarkNginxConcurrency iterates the concurrency argument and tests
-// how well the runtime under test handles requests in parallel.
-func BenchmarkNginxConcurrency(b *testing.B) {
- concurrency := []int{1, 25, 100, 1000}
- for _, c := range concurrency {
- for _, tmpfs := range []bool{true, false} {
- fs := "Gofer"
- if tmpfs {
- fs = "Tmpfs"
- }
- name := fmt.Sprintf("%d_%s", c, fs)
- b.Run(name, func(b *testing.B) {
- hey := &tools.Hey{
- Requests: c * b.N,
- Concurrency: c,
- Doc: nginxDocs["10kb"], // see Dockerfile '//images/benchmarks/nginx' and httpd_test.
- }
- runNginx(b, hey, false /* reverse */, tmpfs /* tmpfs */)
- })
- }
-
- }
-}
-
// BenchmarkNginxDocSize iterates over different sized payloads, testing how
// well the runtime handles sending different payload sizes.
func BenchmarkNginxDocSize(b *testing.B) {
@@ -71,15 +47,32 @@ func BenchmarkReverseNginxDocSize(b *testing.B) {
// benchmarkNginxDocSize iterates through all doc sizes, running subbenchmarks
// for each size.
func benchmarkNginxDocSize(b *testing.B, reverse, tmpfs bool) {
- for name, filename := range nginxDocs {
+ for size, filename := range nginxDocs {
concurrency := []int{1, 25, 50, 100, 1000}
for _, c := range concurrency {
- fs := "Gofer"
+ fsize := tools.Parameter{
+ Name: "filesize",
+ Value: size,
+ }
+
+ threads := tools.Parameter{
+ Name: "concurrency",
+ Value: strconv.Itoa(c),
+ }
+
+ fs := tools.Parameter{
+ Name: "filesystem",
+ Value: "bind",
+ }
if tmpfs {
- fs = "Tmpfs"
+ fs.Value = "tmpfs"
+ }
+ name, err := tools.ParametersToName(fsize, threads, fs)
+ if err != nil {
+ b.Fatalf("Failed to parse parameters: %v", err)
}
- benchName := fmt.Sprintf("%s_%d_%s", name, c, fs)
- b.Run(benchName, func(b *testing.B) {
+
+ b.Run(name, func(b *testing.B) {
hey := &tools.Hey{
Requests: c * b.N,
Concurrency: c,