Skip to content

Commit 601b1de

Browse files
fix: performance test regression
1 parent cb1de79 commit 601b1de

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

.github/workflows/performance.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ jobs:
5959
./perf-test-suite $ARG_DURATION -host $INFLUX_HOST -token $INFLUX_TOKEN -runner ${{ matrix.target.name }} -version $(cat Makefile | grep '\<VERSION=' | awk -F= '{print $2}' | tr -d [\',]) > perf-test-results-with-summaries.txt
6060
echo "duration=$SECONDS" >> $GITHUB_ENV
6161
sed '/^{/,/^}/!d' perf-test-results-with-summaries.txt > perf-test-results.json
62+
env:
63+
GOMEMLIMIT: 76808MiB
6264
- name: Upload test results
6365
uses: actions/upload-artifact@v3
6466
with:

test/performance-test-suite/cmd/perf-test/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func main() {
3838
flInfluxBucket := flag.String("bucket", "immudb-tests-results", "bucket for influxdb")
3939
flInfluxRunner := flag.String("runner", "", "github runner for influxdb")
4040
flInfluxVersion := flag.String("version", "", "immudb version for influxdb")
41+
flTempDir := flag.String("workdir", "/tmp", "working dir path")
4142

4243
flag.Parse()
4344

@@ -50,7 +51,7 @@ func main() {
5051
*flSeed = binary.BigEndian.Uint64(rndSeed[:])
5152
}
5253

53-
results, err := runner.RunAllBenchmarks(*flDuration, *flSeed)
54+
results, err := runner.RunAllBenchmarks(*flDuration, *flTempDir, *flSeed)
5455
if err != nil {
5556
log.Fatal(err)
5657
}

test/performance-test-suite/pkg/benchmarks/benchmark.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Benchmark interface {
2424
Name() string
2525

2626
// Do a test warmup
27-
Warmup() error
27+
Warmup(workingDirectory string) error
2828

2929
// Cleanup after the test
3030
Cleanup() error

test/performance-test-suite/pkg/benchmarks/writetxs/benchmark.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type benchmark struct {
6868
primaryServer *server.ImmuServer
6969
replicaServer *server.ImmuServer
7070
clients []client.ImmuClient
71+
tempDirs []string
7172
}
7273

7374
type Result struct {
@@ -110,13 +111,12 @@ func (b *benchmark) Name() string {
110111
return b.cfg.Name
111112
}
112113

113-
func (b *benchmark) Warmup() error {
114-
primaryPath, err := os.MkdirTemp("", "tx-test-primary")
114+
func (b *benchmark) Warmup(tempDirBase string) error {
115+
primaryPath, err := os.MkdirTemp(tempDirBase, "tx-test-primary")
115116
if err != nil {
116117
return err
117118
}
118-
119-
defer os.RemoveAll(primaryPath)
119+
b.tempDirs=append(b.tempDirs,primaryPath)
120120

121121
primaryServerOpts := server.
122122
DefaultOptions().
@@ -154,12 +154,12 @@ func (b *benchmark) Warmup() error {
154154
primaryPort := b.primaryServer.Listener.Addr().(*net.TCPAddr).Port
155155

156156
if b.cfg.Replica == "async" || b.cfg.Replica == "sync" {
157-
replicaPath, err := os.MkdirTemp("", fmt.Sprintf("%s-tx-test-replica", b.cfg.Replica))
157+
replicaPath, err := os.MkdirTemp(tempDirBase, fmt.Sprintf("%s-tx-test-replica", b.cfg.Replica))
158158
if err != nil {
159159
return err
160160
}
161161

162-
defer os.RemoveAll(replicaPath)
162+
b.tempDirs=append(b.tempDirs,replicaPath)
163163

164164
replicaServerOptions := server.
165165
DefaultOptions().
@@ -207,7 +207,7 @@ func (b *benchmark) Warmup() error {
207207

208208
b.clients = []client.ImmuClient{}
209209
for i := 0; i < b.cfg.Workers; i++ {
210-
path, err := os.MkdirTemp("", "immudb_client")
210+
path, err := os.MkdirTemp(tempDirBase, "immudb_client")
211211
if err != nil {
212212
return err
213213
}
@@ -219,6 +219,7 @@ func (b *benchmark) Warmup() error {
219219
}
220220

221221
b.clients = append(b.clients, c)
222+
b.tempDirs = append(b.tempDirs, path)
222223
}
223224

224225
return nil
@@ -234,11 +235,15 @@ func (b *benchmark) Cleanup() error {
234235
}
235236

236237
b.primaryServer.Stop()
238+
b.primaryServer = nil
237239

238240
if b.replicaServer != nil {
239241
b.replicaServer.Stop()
242+
b.replicaServer = nil
243+
}
244+
for _,tDir := range(b.tempDirs) {
245+
os.RemoveAll(tDir)
240246
}
241-
242247
return nil
243248
}
244249

test/performance-test-suite/pkg/runner/benchmarks.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ func getBenchmarksToRun() []benchmarks.Benchmark {
5252
AsyncWrite: true,
5353
Replica: "async",
5454
}),
55-
56-
writetxs.NewBenchmark(writetxs.Config{
55+
writetxs.NewBenchmark(writetxs.Config{ // this one!
5756
Name: "Write KV/s async - one async replica",
5857
Workers: 30,
5958
BatchSize: 1000,
@@ -62,7 +61,6 @@ func getBenchmarksToRun() []benchmarks.Benchmark {
6261
AsyncWrite: true,
6362
Replica: "async",
6463
}),
65-
6664
writetxs.NewBenchmark(writetxs.Config{
6765
Name: "Write TX/s async - one sync replica",
6866
Workers: 30,

test/performance-test-suite/pkg/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/codenotary/immudb/test/performance-test-suite/pkg/benchmarks/writetxs"
2626
)
2727

28-
func RunAllBenchmarks(d time.Duration, seed uint64) (*BenchmarkSuiteResult, error) {
28+
func RunAllBenchmarks(d time.Duration, tempDir string, seed uint64) (*BenchmarkSuiteResult, error) {
2929
ret := &BenchmarkSuiteResult{
3030
StartTime: time.Now(),
3131
ProcessInfo: gatherProcessInfo(),
@@ -43,7 +43,7 @@ func RunAllBenchmarks(d time.Duration, seed uint64) (*BenchmarkSuiteResult, erro
4343
Timeline: []BenchmarkTimelineEntry{},
4444
}
4545

46-
err := b.Warmup()
46+
err := b.Warmup(tempDir)
4747
if err != nil {
4848
return nil, err
4949
}

0 commit comments

Comments
 (0)