0

I have a production server for a web application configured in AWS EC2 instance. I was running this for years and suddenly since today morning it is showing some spikes in CPU usage and application was down for few time today. When I run atop command I see the CPU utilization is high for php-fpm but only for few PIDs. Is there any way to identify what is this running process or PHP controller action. Appreciate your help.

enter image description here

And when I check nginx error logs I found this,

2022/01/30 11:26:01 [alert] 547#547: *160214 open socket #26 left in connection 259
2022/01/30 11:26:01 [alert] 547#547: *160153 open socket #6 left in connection 268
2022/01/30 11:26:01 [alert] 547#547: *159984 open socket #17 left in connection 273
2022/01/30 11:26:01 [alert] 547#547: *157860 open socket #140 left in connection 275
2022/01/30 11:26:01 [alert] 547#547: *160427 open socket #38 left in connection 280
2022/01/30 11:26:01 [alert] 547#547: aborting
Prasad Rajapaksha
  • 195
  • 1
  • 2
  • 7
  • Either your application code has changed in a way that it consumes more resources. Or your site is receiving abnormal amount of traffic. – Tero Kilkanen Jan 30 '22 at 10:13
  • @TeroKilkanen Thanks for the comment. Actually no application changes being done for weeks. Application load balancer also doesn't show huge spike of traffic. Only thing I found is the added nginx error logs. Which has direct connection to this issue – Prasad Rajapaksha Jan 30 '22 at 11:55

1 Answers1

0

Nginx can log the $upstream_response_time. This is different from the request time, because it doesn't include the time to send it to the client. If you enable this, you can see in your log which requests take long in PHP.

Also, PHP-fpm has the ability to query stats that may be of use. Perhaps phpfpmtop is of use.

Halfgaar
  • 8,084
  • 6
  • 45
  • 86