vendic/magento2-clean-cron-schedule dev-master

Magento 2.2 has issues with giant `cron_schedule` tables. The cron job running time will increase when the table gets bigger, causing heavy CPU usage.

Type

magento2-module

License

MIT

Requires
Requires (dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

Magento 2 auto clean old cron jobs

Magento 2.2 has issues with giant cron_schedule tables. The cron job running time will increase when the table gets bigger, causing heavy CPU usage.

Identifing the problem

In one of our stores the cron_schedule table exeeded 1.000.000 rows. To identify the problem run the following SQL query:

SELECT count(*) FROM `cron_schedule`

Solving the problem

Remove the old rows in cron schedule:

DELETE FROM cron_schedule WHERE  scheduled_at < Date_sub(Now(), interval 24 hour);

Source

This module will execute the cleanup query once a day.

Installation

composer require vendic/magento2-clean-cron-schedule