My question comes down to, should multiple magento cron:run -vvv processes always be running and hitting MySql constantly.
I am setting up magento 2.2.1 thru Google Cloud and I have the 3 standard cron jobs that were pre-setup thru Google’s 1 click install of Magento.
*/1 * * * * /opt/bitnami/php/bin/php /opt/bitnami/apps/magento/htdocs/bin/magento cron:run -vvv 2>&1 */1 * * * * /opt/bitnami/php/bin/php /opt/bitnami/apps/magento/htdocs/update/cron.php 2>&1 */1 * * * * /opt/bitnami/php/bin/php /opt/bitnami/apps/magento/htdocs/bin/magento setup:cron:run -vvv 2>&1
Looking at top -c there is always 2 php.bin processes running, which are hitting MySql constantly and causing it to use around 50% – 70% CPU all the time. Here is a snapshot of what it normally looks like.
PID USER PR NI VIRT RES SHR S %CPU %MEM 19327 mysql 20 0 3872884 332876 19172 S 60.8 3.4 332:42.45 /opt/bitnami/mysql/bin/mysqld.bin --defaults-file=/opt/bitnami/mysql/my.cnf --basedir=/opt/bitnami+ 26458 bitnami 20 0 679516 476444 64492 S 24.6 4.9 0:24.85 /opt/bitnami/php/bin/php.bin /opt/bitnami/apps/magento/htdocs/bin/magento cron:run -vvv 26415 bitnami 20 0 677532 475672 64588 R 23.6 4.9 1:36.11 /opt/bitnami/php/bin/php.bin /opt/bitnami/apps/magento/htdocs/bin/magento cron:run -vvv
I’ve also changed the crons to run every 5 minutes, instead of the default every minute but the behavior stays the same.
My latest change was alternating every 7 minutes and 8 minutes with the 2 cron:run jobs starting 3 and 4 minutes apart, and with that only 1 cron job is running at a time with 30% – 40% CPU from MySQL.
My site also has no traffic right now because I haven’t launched it yet. Is this behavior normal from Magento since there is nothing going on with the site? I let it sit for 12 hours without doing anything at all and when i look at top the cron is still running and hammering MySQL.