Score:0

How to identify cause of sudden CPU utilization

ar flag

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
us flag
Either your application code has changed in a way that it consumes more resources. Or your site is receiving abnormal amount of traffic.
Prasad Rajapaksha avatar
ar flag
@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
Score:0
ng flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.