I have created a performance test suite in Jmeter. The suite contains one thread group: Thread properties: Number of threads: 100 Ramp-up period: 5 Loop count: 1 Clearing cache and cookies on each iteration.
Thread group has 30 samplers (HTTP Requests for 30 pages), each samplers has "View Results Tree" and "View Results in table" listeners.
With this I am running the test suite.
Problem: I am getting "502 Response" for some requests on some threads.
I am new to performance testing and Jmeter. Please let me know what is the reason for getting 502 in this case and how can I solve this.
All HTTP status codes 5xx are server errors which means that you cannot "solve" them from JMeter perspective.
Particular HTTP status code 502 means "Bad gateway", as per description:
The HyperText Transfer Protocol (HTTP)
502 Bad Gateway
server error response code indicates that the server, while acting as a gateway or proxy, received an invalid response from the upstream server.Note: A Gateway might refer to different things in networking and a 502 error is usually not something you can fix, but requires a fix by the web server or the proxies you are trying to get access through.
So in order to "solve" it you need to inspect your application and middleware logs and see what is the root cause of the problem.
If it happens only under the load of 100 users and not reproducible with less amount of threads it indicates that your application is overloaded hence cannot properly respond to certain requests. So you can just report it as a performance bottleneck.
A good idea would be implementing monitoring of the system under test to measure CPU, RAM, Network, Disk usage, etc. as the reason could be as simple as the lack of resources, it can be done using JMeter PerfMon Plugin
If the machine is not overloaded but you're getting this error it means that either system under test is not properly configured for high loads or uses inefficient algorithms somewhere, you can discover what's going on under the hood by looking at profiler tool or APM tool output