Skip to content

Commit

Permalink
perf: add a performance benchmark tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey committed Aug 11, 2024
1 parent 0aa1a56 commit d2567c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bench/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ func TestBenchmark_Bench(t *testing.T) {
ctx := context.TODO()

actorsCount := 2000
workersCount := 20
duration := 10 * time.Second
workersCount := 50
duration := 30 * time.Second

benchmark := NewBenchmark(actorsCount, workersCount, duration)
require.NoError(t, benchmark.Start(ctx))
Expand All @@ -177,8 +177,9 @@ func TestBenchmark_Bench(t *testing.T) {
t.Fatal(err)
}

fmt.Printf("workers: %d messages sent: %d, messages received: %d - duration: %v\n", workersCount, totalSent.Load(), totalRecv.Load(), duration)
fmt.Printf("messages per second: %d\n", totalRecv.Load()/int64(duration.Seconds()))
fmt.Printf("total actors spawned: (%d)\n", actorsCount)
fmt.Printf("total workers: (%d), total messages sent: (%d), total messages received: (%d) - duration: (%v)\n", workersCount, totalSent.Load(), totalRecv.Load(), duration)
fmt.Printf("messages per second: (%d)\n", totalRecv.Load()/int64(duration.Seconds()))
t.Cleanup(func() {
require.NoError(t, benchmark.Stop(ctx))
})
Expand Down

0 comments on commit d2567c5

Please sign in to comment.