We've been running a Magento 1 site for over 7 years and although cpu usage has been quite high, it's not been a concern as performance seemed fine even, it is a high traffic site after all.

Preparing to move over to Magento 2 we installed the latest version (2.3 at the time) and ran it in developer mode along with the M1 site with no hit on server performance.

Now we've finally switched fully to M2 and enabled production mode, wow, cpu usage has gone off the chart https://i.sstatic.net/fcIGK.jpg

I've followed a few suggestions on here regarding enabling caches etc and nothing improves. Thinking M2 would be a much more stable and 'optimised' system, we're not impressed at the moment!

Any suggestions would be very welcome. It's a single server, 16GB ram, 6 Core, Apache/PHP 7.2/MYSQL.

  • Additional information request. Any SSD or NVME devices on MySQL Host server? Post on pastebin.com and share the links. From your SSH login root, Text results of: B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; AND Optional very helpful information, if available includes - htop OR top for most active apps, ulimit -a for a Linux/Unix list of limits, iostat -xm 5 3 for IOPS by device and core/cpu count, for server workload tuning analysis to provide suggestions. Commented Oct 17, 2020 at 14:40
  • Is debug mode turned off on M2? Commented Oct 17, 2020 at 14:47
  • 1
    Thanks for taking the time to reply Wilson. Storage is an SSD yes. Debug mode is disabled. Hopefully these links work. pastebin.com/J9iFvbiA imgur.com/a/NcYWCDD
    – AndyS
    Commented Oct 18, 2020 at 15:48
  • Thanks for posting the additional information. Analysis in process. Commented Oct 18, 2020 at 17:37
  • 1
    Sure thing: pastebin.com/k9GpiJBb Regarding normal ops, I can only say yes as it's the main website with little else on the server and traffic is fairly consistent. Weekends can be busier.
    – AndyS
    Commented Oct 19, 2020 at 10:45

1 Answer 1


Rate Per Second = RPS

Suggestions to consider for your OS Open Files limit,

From OS command prompt, ulimit -n 128000 and press Enter to enable more than 1024 Open Files as reported by ulimit -a output. This is a dynamic variable and does not require OS restart.

For this change to be persistent across OS shutdown/restart's review this URL, please. https://glassonionblog.wordpress.com/2013/01/27/increase-ulimit-and-file-descriptors-limit/ Use 128000 rather than 500000 as in the example. This will enable MySQL to support 96000 open_files_limit to avoid Open Table THRASHING and manage the Apache software requirements for file activity.

Suggestions to consider for your my.cnf [mysqld] section

open_files_limit=96000  # from 1024 to reduce Open Table Thrashing. 
innodb_open_files=40000  # from 407 to better support your 51 max_used_connections. 
table_open_cache=40000  # from 407 to reduce opened_tables RPS of 56. 
table_definition_cache=2400  # from 603 to reduce opened_table_definitions RPS of 23. 
innodb_io_capacity=1900  # from 200 to allow more SSD IOPS utilization.

Some of these variables are static and I would recommend making all of them, then SHUTDOWN and RESTART your MySQL instance.

AndyS, For your busy system there are many more areas to be considered/tuned. Please view our profile for contact information and consider using our free downloadable Utility Scripts to assist with performance tuning. Comments after application are appreciated with positive/negative feedback.

  • 1
    Sincere thanks for your time and suggestions Wilson, I will make those changes today and monitor the server performance. I'll certainly follow your links too and hopefully learn something from this experience. Again, thank you
    – AndyS
    Commented Oct 19, 2020 at 14:30
  • 1
    A quick update.CPU usage has remained high so further investigation needed imgur.com/a/El6ghif
    – AndyS
    Commented Oct 20, 2020 at 9:20
  • 1
    Hi Wilson. Having some time today, I checked over things and a couple of the updates hadn't taken hold. I've created a system override file and they have taken this time. Will monitor for 24 hours. Thanks for the followup
    – AndyS
    Commented Oct 21, 2020 at 20:32
  • 1
    Here's the status after around 21 hours of uptime pastebin.com/BKYz9dNR I must admit, from the stats I keep looking at, traffic is high on this server, shame it's not reflected in orders.
    – AndyS
    Commented Oct 22, 2020 at 18:08
  • 1
    Hi Wilson. I made other changes to the system too following the magento 2 docs. Enabling opcache and php tweaks. Also added some extra firewall rules as I found a number of scrapers calling lots of pages. I'm not sure if these made much difference but I will be monitoring and moving over to varnish cache and elasticsearch to see if they help. I'll also put your suggestion to management regarding further mysql tweaks in your link. I'm very grateful for your time on this and I hope to speak again soon. All the very best,
    – AndyS
    Commented Oct 22, 2020 at 19:28

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.