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.
UPDATE: It's now clear the problem is just first cron:run process that is causing problems. I changed the 2nd and 3rd items back to every minute and left the first at 8 minutes and there is only a single running cron:run process at a time. From the comment below it could be an issue with Bitnami Magento installations, but this is my first experience with Magento so I don't know if this is expected behavior (I really hope it's not).
htop
. With it I see that I've got more than ten lines withmagento cron:run -vvv
. Some has been live for several minutes. I will try to find out why the cron isn't running as expected.