Gatilng goes slow when used with Semaphore

Hi,

I have a part of a scenario that uses a Semaphore to make sure that only one user can be registered at a time, before starting the load test proper (I have a CountDownLatch to act as a barrier). However, each user throughout the semaphore takes longer each time, starting at 5s to complete, but taking longer each time, until it taking several mins to register each user.

It’s fine if I restart (so not a server issue), and fine if I use a long ramp time (i.e. 10s per user, knowing the registration process only takes about 5s normally).

This is odd!

Any suggestions to the cause?

Thank you!

Alex

A semaphore is a blocking barrier, meaning that the current thread is stalled until acquire is successful.
Gatling is message oriented, and only uses a small number of threads, so you’re probably creating a thread starvation.

Using Semaphore is not something I would recommend.
You should probably use some sort of threadsafe Queue and counter approach.