0

I'm having large performance issues with magento2. The pages takes several seconds (up to minutes) to load the front- and backend. Also the "cron:run" command takes quite a long time. I configured cronjobs as mentioned and after a while I have multiple instances of cron:run running and obviously this is consuming very much CPU and RAM capacities. The server gets stuck very soon.

I have the developer mode and all caches active and the code is reindexed.

I'm running PHP 7 and MySql 5.7 behind an Apache 2.4.10 on Debian 8. I tried to run Magento2 on a different machine and reinstalled it (on the same machine) but the problems are persistent.

Any ideas? I cannot run magento2 in production with this behavior.

3
  • change db settings localhost to 127.0.0.1 . if you are running in windows change port 80 to something in httpd.conf file (listen 80 to something ) Commented May 15, 2018 at 6:52
  • 1
    Have you tried looking in the cron_schedule table to see which cron job is taking the most time? Look for the difference between "executed_at" and "finished_at"
    – sduif
    Commented May 15, 2018 at 6:58
  • Please install profiler (like Blackfire/tideways) investigate the problem
    – KAndy
    Commented May 15, 2018 at 19:55

2 Answers 2

0

Please install this module to fix that magento issue : https://github.com/Alekseon/CleanRunningJobs

0

Most of the similar issues I faced are related to third-party modules running cronjobs at a too-high frequency. Or many cronjobs taking too long.

You can address that by:

1 - Tweak the admin options

This screen below allows you to tweak your cronjobs to deprioritize some and avoid not waiting enough to have them finished.

Official Adobe documentation - Cron (scheduled tasks)

Adobe Commerce Cron issues

2 - Check your CRON history

I use Magerun2, a tool that allows you to run this command below and get a list of the last cronjobs ran. You might see which cronjobs had the most issues (errors or missed status).

./var/n98-magerun2.phar db:query "SELECT * from cron_schedule;
echo "Total of errors found:" 
./var/n98-magerun2.phar db:query "SELECT count(*) 'total' from cron_schedule WHERE status='missed' OR status='error'" | grep -v total;

3 - Server adjusts

If you have adjusted all schedules following step 1 and don't see any errors, just a low volume of essential missed cronjobs following step 2.

Then, you need to ensure you have optimized your server and have enough capacity to handle the volume of requests. Ensure you have RabbitMQ and Cache configured, as load balance, and no exceptions and errors in your var/logs/ folders.

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.