ci: test benchmarks

This runs each benchmark for one iteration to ensure that they are
valid. Unfortunately, it does not give any useful metrics as output.

Change-Id: I68940398c8dd849aed656bd12656f48d5df10128
This commit is contained in:
Egon Elbre 2020-07-10 09:10:01 +03:00 committed by Yingrong Zhao
parent 4869cfc9a4
commit 5bdcd86fa7
7 changed files with 61 additions and 17 deletions

View File

@ -97,6 +97,19 @@ pipeline {
}
}
stage('Check Benchmark') {
environment {
STORJ_COCKROACH_TEST = 'cockroach://root@localhost:26256/benchcockroach?sslmode=disable'
STORJ_POSTGRES_TEST = 'postgres://postgres@localhost/benchstorj?sslmode=disable'
}
steps {
sh 'cockroach sql --insecure --host=localhost:26256 -e \'create database benchcockroach;\''
sh 'psql -U postgres -c \'create database benchstorj;\''
sh 'go test -parallel 1 -p 1 -vet=off -timeout 20m -short -run XYZXYZXYZXYZ -bench . -benchtime 1x ./...'
}
}
stage('Integration') {
environment {
// use different hostname to avoid port conflicts

View File

@ -233,18 +233,20 @@ func BenchmarkChore(b *testing.B) {
b.Run("BatchUpdateStats-100", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 100)
})
b.Run("BatchUpdateStats-250", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 250)
})
b.Run("BatchUpdateStats-500", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 500)
})
b.Run("BatchUpdateStats-1000", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 1000)
})
b.Run("BatchUpdateStats-5000", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 5000)
})
if !testing.Short() {
b.Run("BatchUpdateStats-250", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 250)
})
b.Run("BatchUpdateStats-500", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 500)
})
b.Run("BatchUpdateStats-1000", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 1000)
})
b.Run("BatchUpdateStats-5000", func(b *testing.B) {
batch(ctx, b, gracefulexitdb, 5000)
})
}
})
}
func batch(ctx context.Context, b *testing.B, db gracefulexit.DB, size int) {

View File

@ -59,8 +59,17 @@ func BenchmarkCombiner(b *testing.B) {
minWait = 1 * time.Millisecond
maxWait = 20 * time.Millisecond
)
activeLimits := []int{8, 32, 64, -1}
queueSizes := []int{1, 8, 64, 128, -1}
var activeLimits []int
var queueSizes []int
if testing.Short() {
activeLimits = []int{8, 64, -1}
queueSizes = []int{8, 128, -1}
} else {
activeLimits = []int{8, 32, 64, -1}
queueSizes = []int{1, 8, 64, 128, -1}
}
nodes := []storj.NodeURL{}
for i := 0; i < nodeCount; i++ {

View File

@ -301,7 +301,13 @@ func BenchmarkOrders(b *testing.B) {
ctx := testcontext.New(b)
defer ctx.Cleanup()
counts := []int{50, 100, 250, 500, 1000}
var counts []int
if testing.Short() {
counts = []int{50, 100}
} else {
counts = []int{50, 100, 250, 500, 1000}
}
for _, c := range counts {
c := c
satellitedbtest.Bench(b, func(b *testing.B, db satellite.DB) {

View File

@ -193,7 +193,7 @@ func BenchmarkOverlay(b *testing.B) {
func BenchmarkNodeSelection(b *testing.B) {
satellitedbtest.Bench(b, func(b *testing.B, db satellite.DB) {
const (
var (
Total = 10000
Offline = 1000
NodesPerNet = 2
@ -204,6 +204,13 @@ func BenchmarkNodeSelection(b *testing.B) {
newNodeFraction = 0.05
)
if testing.Short() {
Total /= 10
Offline /= 10
SelectCount /= 10
ExcludedCount /= 10
}
SelectNewCount := int(100 * newNodeFraction)
now := time.Now()

View File

@ -82,10 +82,15 @@ func BenchmarkDB_PieceCounts(b *testing.B) {
ctx := testcontext.New(b)
defer ctx.Cleanup()
var NumberOfNodes = 10000
if testing.Short() {
NumberOfNodes = 1000
}
overlaydb := db.OverlayCache()
counts := make(map[storj.NodeID]int)
for i := 0; i < 10000; i++ {
for i := 0; i < NumberOfNodes; i++ {
counts[testrand.NodeID()] = testrand.Intn(100000)
}

View File

@ -94,6 +94,8 @@ func TestThatMigrationActuallyHappened(t *testing.T) {
}
func BenchmarkSuite(b *testing.B) {
b.Skip("broken")
store, cleanup := newTestPostgres(b)
defer cleanup()