jmeterperformance-testingjmeter-5.0

jmeter metrics for API testing


To give context.

In my organization we are migrating a database from mysql5 -> mysql8. They have given me a dummy database instance in mysql8 that's a copy of the prod datbase with anonymized data.

After gathering some metrics from the old prod database we found the following:

Now I have been tasked gather performance metrics (CPU/Load Average/etc...) from the server we host the dummy DB on. I have the tools to monitor already.

I have to use Jmeter but have no experience with this what so every and am somewhat more of a front-end engineer so am having a lot of trouble simulating the average and max load. More so in regards to the Thread count Ramp up period and loop count.

How do I Simulate them using those 3 attributes? I already have the HTTP calls and their percentile throughput configured.


Solution

    1. Thread Count: depends on your response time, for example if response time for a single request is 1 second and you used to have 900 QPS - you should be able to reach this throughput with 900 threads (virtual users) if response time is higher or lower you will need to increase or decrease the number of threads proportionally

    2. Ramp-up period: normally you should increase the load gradually, this way you will be able to correlate increasing load with i.e. increasing response time, number of errors, throughput, etc. JMeter documentation suggests:

      The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.

      Ramp-up needs to be long enough to avoid too large a work-load at the start of a test, and short enough that the last threads start running before the first ones finish (unless one wants that to happen).

      Start with Ramp-up = number of threads and adjust up or down as needed.

      You can also take a look at JMeter Ramp-Up Period: The Ultimate Guide article

    3. Loop Count: it needs to be sufficient so all threads would be up and running. Each JMeter thread executes Samplers upside down and when there are no Samplers to execute and loops to iterate the thread is being shut down so if you don't have enough loops you may run into a situation when one thread has already finished executing requests and was shut down and the other one haven't started yet. The easiest is set it to Infinite or -1 and use "Duration" for specifying the desired test run time