I'm having a problem that is occurring after the volume of concurrent users on my site has increased. I'm currently with almost 600 concurrent users and the server is using 100% CPU.

To alleviate this load, I use some caching systems:

ElasticSearch, Memcached, and varnish.

My server is running with Nginx, php-fpm56 and Magento 1.9.3.

Configs nginx (/etc/nginx/nginx.conf):

fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 300;

php-fpm (/etc/php-fpm.d/www.conf):

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

My server is AWS with c3.4xlarge configuration (vCPU:16 MEM: 30GB SSD: 2 x 160GB)

Monitoring CloudWatch:

My CloudWatch


enter image description here

The theme was built by us, the entire front-end searches the ElasticSearch, the whole system is cached. We do not use many modules, just OneStepCheckout, payment gateway, and SMTP. I do not know what could be happening anymore because with this machine configuration it should be able to handle at least triple the users.

Anyone have any idea what might be happening?


  • Try to sort htop by cpu usage to see which processes are taking the most resources. It could be because of licks on mysql tables or session handling, or i/o limits. Newrelic is a good tool to see what is happening.
    – Zefiryn
    Jun 2, 2017 at 19:55
  • Check for infinite loops in code. Maybe enable slow.log in php. easyengine.io/tutorials/php/fpm-slow-log . Leave the stats for a moment and look into Magento's and extensions's code. In most cases, the code is the bottle neck. There should be one or multiple messed up issues there. Jun 3, 2017 at 7:45
  • your image only shows 50% usage, and only java threads
    – MagenX
    Jun 4, 2017 at 8:32
  • proccess order by CPU: prntscr.com/fg4cvf Jun 5, 2017 at 12:46
  • Did you checked your Memcache and ElasticCache server performance? If for instance the memcache server is to slow/small, the fpm processes waiting for the response and block everything. I would recommend to use a realtime performance monitoring like newrelic for your sice. You will see immediately where the bottlenecks are
    – Pawel
    Sep 13, 2018 at 10:11

3 Answers 3


Check your logs under system.log and exception.log if you see any error there relating to your Magento. Also do some tests to your modules using https://github.com/magento-ecg/coding-standard to see if your modules have Magento standards in the way how collections are loading, or if any infinite loop is used.

  • No erro logs in system and exeption. Jun 5, 2017 at 12:45
  • did you test your code for any infinite for loop? Jun 5, 2017 at 12:46
  • I also facing this issue in magento, please check cache is enable in magento backed or also check varnish cache is running on port 80 on AWS instance. Dec 27, 2019 at 3:17

Use a code profiler to see what's loading CPU. Try tideways (free the first 14 days), New Relic or others, you definitely have a bottleneck or two.


From the graphs of packet counts in and out, Consider in your AWS Parameters Group

net_buffer_length=98304  # from 16384 to reduce packet counts and expedite completion. 

Enabling 6 GB (20 percent) of OS SWAP space would be in your best interests.
Better to be a little slow for a few seconds than Out of Memory failures.

View profile, please.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.