Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
taylanisikdemir committed Dec 9, 2024
1 parent 0b90d55 commit dd53896
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions common/stats/stats_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ import (
"time"

"github.com/uber/cadence/common/clock"
"github.com/uber/cadence/service/matching/event"
)

// Benchmark the ReportCounter function to see how it handles frequent updates
func BenchmarkReportCounter(b *testing.B) {
timeSource := clock.NewRealTimeSource()
// Initialize the QPS reporter with a smoothing factor and a 1 second bucket interval
reporter := NewEmaFixedWindowQPSTracker(timeSource, 0.5, time.Second)
reporter := NewEmaFixedWindowQPSTracker(timeSource, 0.5, time.Second, event.E{})
reporter.Start()

// Run the benchmark for b.N iterations
Expand All @@ -52,7 +53,7 @@ func BenchmarkReportCounter(b *testing.B) {
func BenchmarkQPS(b *testing.B) {
timeSource := clock.NewRealTimeSource()
// Initialize the QPS reporter
reporter := NewEmaFixedWindowQPSTracker(timeSource, 0.5, time.Second)
reporter := NewEmaFixedWindowQPSTracker(timeSource, 0.5, time.Second, event.E{})
reporter.Start()

// Simulate a number of report updates before calling QPS
Expand All @@ -75,7 +76,7 @@ func BenchmarkQPS(b *testing.B) {
func BenchmarkFullReport(b *testing.B) {
timeSource := clock.NewRealTimeSource()
// Initialize the QPS reporter
reporter := NewEmaFixedWindowQPSTracker(timeSource, 0.5, time.Millisecond*100) // 100ms bucket interval
reporter := NewEmaFixedWindowQPSTracker(timeSource, 0.5, time.Millisecond*100, event.E{}) // 100ms bucket interval
reporter.Start()

var wg sync.WaitGroup
Expand Down
6 changes: 3 additions & 3 deletions host/testdata/matching_simulation_burst_adaptive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ matchingconfig:
enableadaptivescaler: true
partitiondownscalefactor: 0.75
partitionupscalerps: 200
partitionupscalesustainedduration: 1m
partitiondownscalesustainedduration: 1m
adaptivescalerupdateinterval: 2s
partitionupscalesustainedduration: 5s
partitiondownscalesustainedduration: 5s
adaptivescalerupdateinterval: 1s
workerconfig:
enableasyncwfconsumer: false

0 comments on commit dd53896

Please sign in to comment.