Skip to content

Commit

Permalink
configurable parallelism for memory broker and presence manager
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Nov 5, 2023
1 parent 8c0b535 commit cc4829a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions broker_memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func BenchmarkMemoryPublish_1Ch(b *testing.B) {
defer func() { _ = e.node.Shutdown(context.Background()) }()

rawData := protocol.Raw(`{"bench": true}`)
b.SetParallelism(128)
b.SetParallelism(getBenchParallelism())
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
Expand All @@ -327,7 +327,7 @@ func BenchmarkMemoryPublish_History_1Ch(b *testing.B) {

rawData := protocol.Raw(`{"bench": true}`)
chOpts := PublishOptions{HistorySize: 100, HistoryTTL: 60 * time.Second}
b.SetParallelism(128)
b.SetParallelism(getBenchParallelism())
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
Expand Down
2 changes: 2 additions & 0 deletions presence_memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func BenchmarkMemoryAddPresence_OneChannel_Parallel(b *testing.B) {
defer func() { _ = e.node.Shutdown(context.Background()) }()

b.ResetTimer()
b.SetParallelism(getBenchParallelism())
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
err := e.AddPresence("channel", "uid", &ClientInfo{})
Expand Down Expand Up @@ -131,6 +132,7 @@ func BenchmarkMemoryPresence_OneChannel_Parallel(b *testing.B) {
defer func() { _ = e.node.Shutdown(context.Background()) }()

_ = e.AddPresence("channel", "uid", &ClientInfo{})
b.SetParallelism(getBenchParallelism())
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
Expand Down

0 comments on commit cc4829a

Please sign in to comment.