Search code examples
apijmeterstress-testing

Stress Test hit an HTTP error 400 during stress test with 600 threads


i'm doing Stress Test for my API for two endpoint. First is /api/register and second is /api/verify_tac/

request body on /api/register is

{
    "provider_id": "lifecare.com.my",
    "user_id": ${random},
    "secure_word": "Aa123456",
    "id_type": "0",
    "id_number": "${id_number}",
    "full_name": "test",
    "gender": "F",
    "dob": "2009/11/11",
    "phone_number": ${random},
    "nationality": "MY"
}

where ${random} and ${id_number} is a list from csv data config.

while request body for verify_tac is

{
     "temp_token": "${temp_token}",
     "tac":"123456"
} 

${temp_token} is a response extract from /api/register response body.

For the test. I have done 5 type of testing without returning all error.

  1. 100 users with 60 seconds ramp up periods. All success.

  2. 200 users with 60 seconds ramp up periods. All success.

  3. 300 users with 60 seconds ramp up periods. All success.

  4. 400 users with 60 seconds ramp up periods. All success.

  5. 500 users with 60 seconds ramp up periods. All success.

  6. 600 users with 60 seconds ramp up periods. most of the /api/register response data is empty resulting in /api/verify_tac return with an error. request data from /api/verify_tac that return an error is

{ "temp_token": "NotFound", "tac":"123456" }

How can test number 6 was return with an error while all other 5 does not return error. They had the same parameter.

Does this means my api is overload with request? or weather my testing parameter is wrong?


Solution

  • If for 600 users response body is empty - then my expectation is that your application simply gets overloaded and cannot handle 600 users.

    You can add a listener like Simple Data Writer configured as below:

    enter image description here

    this way you will be able to see request and response details for failing requests. If you untick Errors box JMeter will store request and response details for all requests. This way you will be able to see response message, headers, body, etc. for previous request and determine the failure reason.

    Also it would be good to:

    1. Monitor the essential resources usage (like CPU, RAM, Disk, Network, Swap usage, etc.) on the application under test side, it can be done using i.e. JMeter PerfMon Plugin
    2. Check your application logs for any suspicious entries
    3. Re-run your test with profiler tool for .NET like YourKit, this way you will be able to see the most "expensive" functions and identify where the application spends most time and what is the root cause of the problems