0

I recently used gatling.io for load testing my api server. During testing there were options to set for example, number of concurrent users per second.

What I do not understand is how these tools are able to generate that load. How are they able to create lets say 200 concurrent connection to my server and hit it?

I am looking for an answer describing how it is implemented, whether they use thread, socket programming etc. Thanks.

Vipul Jain
  • 386
  • 3
  • 14

1 Answers1

2

Gatling uses the Akka framework internally where every virtual user is represented as an Akka actor.

Akka is a framework for asynchronous execution. This means we do not waste and suspend the thread waiting for the response but use it to complete other tasks - in this case of other virtual users. The time of execution is managed by the scheduler and execution itself by the dispatcher

Considering in some environments a single JVM thread stack can get as large as 2 Mb or even bigger creating a thread for each of 500 users would cost about 1 Gb of memory just for the threads. See here for more information about why creating lots of threads is a bad idea.

In conclusion, it is essential to use asynchronous programming to achieve such a high throughput of concurrent virtual users.

Julian A
  • 334
  • 2
  • 9