mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Add tensorflow, ffmpeg, and redis jobs.
PiperOrigin-RevId: 346603153
This commit is contained in:
@@ -67,11 +67,11 @@ build_test(
|
||||
"//test/benchmarks/base:startup_test",
|
||||
"//test/benchmarks/base:size_test",
|
||||
"//test/benchmarks/base:sysbench_test",
|
||||
"//test/benchmarks/database:database_test",
|
||||
"//test/benchmarks/database:redis_test",
|
||||
"//test/benchmarks/fs:bazel_test",
|
||||
"//test/benchmarks/fs:fio_test",
|
||||
"//test/benchmarks/media:media_test",
|
||||
"//test/benchmarks/ml:ml_test",
|
||||
"//test/benchmarks/media:ffmpeg_test",
|
||||
"//test/benchmarks/ml:tensorflow_test",
|
||||
"//test/benchmarks/network:network_test",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -7,11 +7,10 @@ go_library(
|
||||
name = "database",
|
||||
testonly = 1,
|
||||
srcs = ["database.go"],
|
||||
deps = ["//test/benchmarks/harness"],
|
||||
)
|
||||
|
||||
benchmark_test(
|
||||
name = "database_test",
|
||||
name = "redis_test",
|
||||
size = "enormous",
|
||||
srcs = ["redis_test.go"],
|
||||
library = ":database",
|
||||
|
||||
@@ -14,18 +14,3 @@
|
||||
|
||||
// Package database holds benchmarks around database applications.
|
||||
package database
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/test/benchmarks/harness"
|
||||
)
|
||||
|
||||
var h harness.Harness
|
||||
|
||||
// TestMain is the main method for package database.
|
||||
func TestMain(m *testing.M) {
|
||||
h.Init()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -24,6 +25,8 @@ import (
|
||||
"gvisor.dev/gvisor/test/benchmarks/tools"
|
||||
)
|
||||
|
||||
var h harness.Harness
|
||||
|
||||
// All possible operations from redis. Note: "ping" will
|
||||
// run both PING_INLINE and PING_BUILD.
|
||||
var operations []string = []string{
|
||||
@@ -111,21 +114,23 @@ func BenchmarkRedis(b *testing.B) {
|
||||
// Reset profiles and timer to begin the measurement.
|
||||
server.RestartProfiles()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
client := clientMachine.GetNativeContainer(ctx, b)
|
||||
defer client.CleanUp(ctx)
|
||||
out, err := client.Run(ctx, dockerutil.RunOpts{
|
||||
Image: "benchmarks/redis",
|
||||
}, redis.MakeCmd(ip, serverPort)...)
|
||||
if err != nil {
|
||||
b.Fatalf("redis-benchmark failed with: %v", err)
|
||||
}
|
||||
|
||||
// Stop time while we parse results.
|
||||
b.StopTimer()
|
||||
redis.Report(b, out)
|
||||
b.StartTimer()
|
||||
client := clientMachine.GetNativeContainer(ctx, b)
|
||||
defer client.CleanUp(ctx)
|
||||
out, err := client.Run(ctx, dockerutil.RunOpts{
|
||||
Image: "benchmarks/redis",
|
||||
}, redis.MakeCmd(ip, serverPort, b.N /*requests*/)...)
|
||||
if err != nil {
|
||||
b.Fatalf("redis-benchmark failed with: %v", err)
|
||||
}
|
||||
|
||||
// Stop time while we parse results.
|
||||
b.StopTimer()
|
||||
redis.Report(b, out)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
h.Init()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ go_library(
|
||||
name = "media",
|
||||
testonly = 1,
|
||||
srcs = ["media.go"],
|
||||
deps = ["//test/benchmarks/harness"],
|
||||
)
|
||||
|
||||
benchmark_test(
|
||||
name = "media_test",
|
||||
size = "large",
|
||||
name = "ffmpeg_test",
|
||||
size = "enormous",
|
||||
srcs = ["ffmpeg_test.go"],
|
||||
library = ":media",
|
||||
visibility = ["//:sandbox"],
|
||||
|
||||
@@ -15,6 +15,7 @@ package media
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -22,6 +23,8 @@ import (
|
||||
"gvisor.dev/gvisor/test/benchmarks/harness"
|
||||
)
|
||||
|
||||
var h harness.Harness
|
||||
|
||||
// BenchmarkFfmpeg runs ffmpeg in a container and records runtime.
|
||||
// BenchmarkFfmpeg should run as root to drop caches.
|
||||
func BenchmarkFfmpeg(b *testing.B) {
|
||||
@@ -32,13 +35,13 @@ func BenchmarkFfmpeg(b *testing.B) {
|
||||
defer machine.CleanUp()
|
||||
|
||||
ctx := context.Background()
|
||||
container := machine.GetContainer(ctx, b)
|
||||
defer container.CleanUp(ctx)
|
||||
cmd := strings.Split("ffmpeg -i video.mp4 -c:v libx264 -preset veryslow output.mp4", " ")
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
b.StopTimer()
|
||||
container := machine.GetContainer(ctx, b)
|
||||
defer container.CleanUp(ctx)
|
||||
if err := harness.DropCaches(machine); err != nil {
|
||||
b.Skipf("failed to drop caches: %v. You probably need root.", err)
|
||||
}
|
||||
@@ -51,3 +54,8 @@ func BenchmarkFfmpeg(b *testing.B) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
h.Init()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -14,18 +14,3 @@
|
||||
|
||||
// Package media holds benchmarks around media processing applications.
|
||||
package media
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/test/benchmarks/harness"
|
||||
)
|
||||
|
||||
var h harness.Harness
|
||||
|
||||
// TestMain is the main method for package media.
|
||||
func TestMain(m *testing.M) {
|
||||
h.Init()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -7,12 +7,11 @@ go_library(
|
||||
name = "ml",
|
||||
testonly = 1,
|
||||
srcs = ["ml.go"],
|
||||
deps = ["//test/benchmarks/harness"],
|
||||
)
|
||||
|
||||
benchmark_test(
|
||||
name = "ml_test",
|
||||
size = "large",
|
||||
name = "tensorflow_test",
|
||||
size = "enormous",
|
||||
srcs = ["tensorflow_test.go"],
|
||||
library = ":ml",
|
||||
visibility = ["//:sandbox"],
|
||||
|
||||
@@ -14,18 +14,3 @@
|
||||
|
||||
// Package ml holds benchmarks around machine learning performance.
|
||||
package ml
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/test/benchmarks/harness"
|
||||
)
|
||||
|
||||
var h harness.Harness
|
||||
|
||||
// TestMain is the main method for package ml.
|
||||
func TestMain(m *testing.M) {
|
||||
h.Init()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -15,12 +15,15 @@ package ml
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/test/dockerutil"
|
||||
"gvisor.dev/gvisor/test/benchmarks/harness"
|
||||
)
|
||||
|
||||
var h harness.Harness
|
||||
|
||||
// BenchmarkTensorflow runs workloads from a TensorFlow tutorial.
|
||||
// See: https://github.com/aymericdamien/TensorFlow-Examples
|
||||
func BenchmarkTensorflow(b *testing.B) {
|
||||
@@ -44,12 +47,12 @@ func BenchmarkTensorflow(b *testing.B) {
|
||||
for name, workload := range workloads {
|
||||
b.Run(name, func(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
container := machine.GetContainer(ctx, b)
|
||||
defer container.CleanUp(ctx)
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
b.StopTimer()
|
||||
container := machine.GetContainer(ctx, b)
|
||||
defer container.CleanUp(ctx)
|
||||
if err := harness.DropCaches(machine); err != nil {
|
||||
b.Skipf("failed to drop caches: %v. You probably need root.", err)
|
||||
}
|
||||
@@ -67,3 +70,8 @@ func BenchmarkTensorflow(b *testing.B) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
h.Init()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@ type Redis struct {
|
||||
}
|
||||
|
||||
// MakeCmd returns a redis-benchmark client command.
|
||||
func (r *Redis) MakeCmd(ip net.IP, port int) []string {
|
||||
func (r *Redis) MakeCmd(ip net.IP, port, requests int) []string {
|
||||
// There is no -t PING_BULK for redis-benchmark, so adjust the command in that case.
|
||||
// Note that "ping" will run both PING_INLINE and PING_BULK.
|
||||
if r.Operation == "PING_BULK" {
|
||||
return strings.Split(
|
||||
fmt.Sprintf("redis-benchmark --csv -t ping -h %s -p %d", ip, port), " ")
|
||||
fmt.Sprintf("redis-benchmark --csv -t ping -h %s -p %d -n %d", ip, port, requests), " ")
|
||||
}
|
||||
|
||||
// runs redis-benchmark -t operation for 100K requests against server.
|
||||
return strings.Split(
|
||||
fmt.Sprintf("redis-benchmark --csv -t %s -h %s -p %d", r.Operation, ip, port), " ")
|
||||
fmt.Sprintf("redis-benchmark --csv -t %s -h %s -p %d -n %d", r.Operation, ip, port, requests), " ")
|
||||
}
|
||||
|
||||
// Report parses output from redis-benchmark client and reports metrics.
|
||||
|
||||
Reference in New Issue
Block a user