By shiraski
Dear Team I have aws with nginx server for my magento store
but last 4 dys i found some times my cpu utilization going very high more than 90% but my website visit very less
that time i check with Top commend i found too much nginx process are running
can u help me for fixing this issue ?
please check this image
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there @shiraski,
It looks like there are a lot of PHP-FPM processes that are causing the high CPU usage on your server.
What I could suggest is using this script here which will summarize your Nginx access logs. That way you will be able to tell if the traffic that you are getting is legitimate or not.
If the traffic is legitimate, I would recommend doing some optimization for your Magento server so that it does not need so much CPU resources. For example as a start you could do:
Let me know how it goes. Regards, Bobby
High CPU utilization with many Nginx processes despite low website traffic can indicate several potential issues, including misconfiguration, an unusually high number of requests (possibly malicious), or resource-intensive processes. Here are steps to diagnose and potentially resolve the issue:
Check the Nginx access logs to see if there’s an unusually high number of requests or any pattern of suspicious requests. This can help you determine if your server is under a DDoS attack or being scanned by bots.
sudo tail -f /var/log/nginx/access.log
Review your Nginx configuration for any settings that might be causing high CPU usage. For instance, an excessive number of worker processes or inappropriate buffer sizes can lead to issues.
worker_processes directive is set to auto, which is usually appropriate. However, you might want to explicitly set it based on your server’s CPU cores.keepalive_timeout values or extremely high client_max_body_size.Magento is a resource-intensive application. Ensure it is properly optimized:
Implement caching in Nginx. Caching can significantly reduce CPU load by serving static content without repeatedly processing the same requests.
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 30d;
}
Run a malware scan and check for any signs of unauthorized access or a compromised server.
Utilize monitoring tools to keep an eye on what’s happening on your server:
htop or glances for a more comprehensive view of your server’s resource usage.fail2ban to block repetitive suspicious requests.If your server is consistently at high CPU usage and you have optimized as much as possible, it may be time to upgrade your server’s resources.
If you continue to experience issues, consider reaching out to AWS support for insights specific to your instance. You may also want to consult with a Magento specialist, as Magento-specific optimizations can be quite complex.
Remember, high CPU usage can sometimes be a symptom of broader performance issues or security concerns, so it’s important to approach this systematically, covering both Nginx and Magento optimizations.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.