Skip to content

Commit

Permalink
fixup! Fix active VU reporting by arrival-rate executors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Mar 7, 2023
1 parent fe33cfd commit 8d43a83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/executor/constant_arrival_rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ func (car ConstantArrivalRate) Run(parentCtx context.Context, out chan<- metrics
}()

returnVU := func(u lib.InitializedVU) {
// Return the VU without decreasing the global active VU counter, which
// is done in the goroutine started by activeVUPool.AddVU, whenever the
// VU finishes running an iteration. This results in a more accurate
// report of VUs that are _actually_ active.
car.executionState.ReturnVU(u, false)
activeVUsWg.Done()
}
Expand Down
10 changes: 8 additions & 2 deletions lib/executor/ramping_arrival_rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ func (varr RampingArrivalRate) Run(parentCtx context.Context, out chan<- metrics
}()

returnVU := func(u lib.InitializedVU) {
// Return the VU without decreasing the global active VU counter, which
// is done in the goroutine started by activeVUPool.AddVU, whenever the
// VU finishes running an iteration. This results in a more accurate
// report of VUs that are _actually_ active.
varr.executionState.ReturnVU(u, false)
activeVUsWg.Done()
}
Expand Down Expand Up @@ -522,8 +526,10 @@ func (p *activeVUPool) Running() uint64 {
return atomic.LoadUint64(&p.running)
}

// AddVU adds the active VU to the pool of VUs for handling the incoming requests.
// When a new request is accepted the runfn function is executed.
// AddVU adds the active VU to the pool of VUs for handling the incoming
// requests. When a new request is accepted the runfn function is executed. This
// is also when we change the global active VUs counter, since it results in a
// more accurate report of VUs that are _actually_ active.
func (p *activeVUPool) AddVU(ctx context.Context, avu lib.ActiveVU, runfn func(context.Context, lib.ActiveVU) bool) {
p.wg.Add(1)
ch := make(chan struct{})
Expand Down

0 comments on commit 8d43a83

Please sign in to comment.