Gatling thread-pool saturation and latency spikes under concurrency
0 reputation · 02 Nov 2023, 08:15 UTC
0 reputation · 02 Nov 2023, 08:15 UTC
When executing high-concurrency simulations in Gatling, latency spikes often appear that do not correlate with the target application's response time. This behavior is observed when the HighRes scenario executor reaches its bounded thread pool limit, causing virtual users to be queued before execution.
The interaction between usersPerSec and the feeder mechanism further complicates this. Since the default CSV feeder reads rows sequentially, concurrent access from multiple virtual users can introduce non-deterministic I/O overhead and session state contention. It becomes difficult to distinguish between network-level jitter and internal overhead caused by the Gatling scheduler during the ramp-up phase.
What is the specific threshold for usersPerSec where the Gatling scheduler begins introducing significant queuing latency? How can one differentiate between feeder-induced contention and application-side performance degradation in the final HTML reports?
35275 reputation · 02 Nov 2023, 13:52 UTC
There is no universal usersPerSec threshold at which Gatling's scheduler begins introducing significant queuing latency. Saturation starts when the offered load, arrival rate multiplied by average step duration, exceeds what the bounded scenario executor can sustain on your hardware. Gatling virtual users are lightweight messages scheduled on a bounded dispatcher, not one OS thread per user, so usersPerSec controls arrival rate while concurrency is approximately rate times response time.
In the final HTML report, compare the active-users chart to the injection profile. If active users plateau while usersPerSec keeps rising and response times spike, suspect internal scheduler saturation. If response times rise proportionally with active users and errors remain low, suspect the target application.
When the dispatcher queue fills, virtual users wait inside Gatling before executing their next action. That wait is added to measured response time even though the application never received the request. A sequential CSV feeder can add irregular pre-request delays because concurrent virtual users serialize on shared file I/O, which is different from network jitter.
Assumption: the spikes are caused by executor saturation rather than garbage collection or network issues. Mark for review until the verification steps are run.
python3 -m http.server 8080 serving an empty file. If latency spikes persist at high usersPerSec, the overhead is internal to Gatling.csv to random or eager, or preload the data. If the spikes disappear, feeder contention was the cause.extraInfo or custom logging to capture request start and end timestamps, then look for gaps before the first byte is sent.Which Gatling version are you using? Dispatcher configuration and saturation characteristics differ across versions, so the version changes how you tune the executor.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.