- Newest
- Most votes
- Most comments
If this is happening only when doing the load test, then the nginx server unable to respond back to load balancer in timely manner while doing the test. To start with the investigation, you can use any monitoring tools like top/atop/htop to identify if the nginx server resource CPU/memory hitting at 100%. Another resource need to look at it is the disk. You can use "iostat -mydtxz 1" to check the disk usage.
So to start with, open 2 or 3 SSH sessions to the back-end nginx server, and then run top/atop/htop on one session, "iostat -mydtxz 1" on another session, "watch free -m" on another session. Once this is done, run your load test which will hint you at resource utilization.
Hello,
I am not suggesting this as an answer, just thought to provide some help
Could you please check the HTTP Keep-Alive
config in nginx.
The default timeout for the AWS Application Load Balancer is 60 seconds, so we changed the service timeouts to 65 seconds. Barring two hiccoughs shortly after deploying, this has totally fixed it.
I set this in nginx.conf
http { keepalive_time 1h keepalive_timeout 90s; }
Still getting 502
Hello,
If you happen to still be dealing with this, it seems as though load balancing and instance utilization is not the issue as previously mentioned since everything works normally outside of using Artillery. When we really think about the bigger picture of what's happening here, the load test can be comparable to a DDoS attack. I would for sure double check firewall settings.
You had also mentioned PHP as being the potential cause of the issue. To check if PHP-FPM is running, use this command: ps aux | grep php-fpm
If no processes are returned after running that, then simply run the PHP-FPM service and try the test again. PHP could also be timing out and closing before you can connect to a server which would mean increasing the timeout for PHP would be necessary.
Relevant content
- asked 2 years ago
- Accepted Answerasked a year ago
- asked 10 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
in HTOP The memory never goes over 1 gig, the system has 8 gigs (Using an M5.Large EC2 on EBS). The CPU never goes above 10% and the iostat looks clean too? But I'm not sure if I'm reading it right but %util was either 0 or blank, so I don't think its because resources are being taxed.