0

I have installed Magento v2.3.4 website on VPS with below config:

OS: CentOS
CPU: 2 x 2.2 Ghz
RAM: 2 GB

Whenever the website is accessed, I see a sudden spike in CPU usage & it goes upto 100%. This causes website to load slow, even for just one user.

htop shows multiple of these command being executed: htop output

Apache/httpd block generated via DirectAdmin responsible for above is:

<Directory /home/admin/public_html>
    <IfModule mod_fcgid.c>
            FCGIWrapper '/usr/local/safe-bin/fcgid73.sh /usr/local/directadmin/data/users/admin/php/mysite.com.ini -d sendmail_from="admin@mysite.com" -d open_basedir="/home/admin/:/tmp:/var/tmp:/opt/alt/php73/usr/share/pear/:/dev/urandom:/usr/local/lib/php/:/usr/local/php73/lib/php/" -d mail.log="/home/admin/.php/php-mail.log"' .php
                <FilesMatch "\.php$">
                    SetHandler fcgid-script
                        Options +ExecCGI
                </FilesMatch>
    </IfModule>
            suPHP_Engine ON
            suPHP_UserGroup admin admin
</Directory>

PS- I did a fresh installation of WordPress and CPU usage is around 10-20% for same command.

How should I address the issue for Magento? Please guide.

1

you have 2 CPU , so if you have more than 2 processes reading then cpu load will be high. this is normal for wordpress, but for magento you need cpu power.

this is all related to how heavy is your theme, how many modules loaded and db readings.

magento 2 in default and developer mode runs slower that production mode.

if you change to production mode it will work the same as wordpress :)

1
  • Thanks for sharing the information @MagenX. I have enabled all types of caching from admin panel & it seem to have reduced the CPU load. I'll now check the mode as well. – S R Apr 3 '20 at 13:27
0

I managed to reduce the high CPU usage by following below:

  1. Clearing the cache by issuing below commands:

    bin/magento cache:clean

    bin/magento cache:flush

  2. Enabling all the cache types from Magento admin panel.

Now the CPU usage hardly goes above 15-20%.

Hope this helps someone! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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