vendic / magento2-clean-cron-schedule
Magento 2.2 存在 `cron_schedule` 大表问题。当表变大时,定时任务运行时间会增加,导致CPU使用率过高。
1.0.8
2024-04-19 08:09 UTC
Requires
- php: ~7.0.0|~7.1.0|~7.2.0|~7.3.0|~7.4.0|^8.1
- magento/framework: ^101.0.0|^102.0.0|^103.0.0
- magento/magento-composer-installer: *
README
Magento 2.2 存在 `cron_schedule` 大表问题。当表变大时,定时任务运行时间会增加,导致CPU使用率过高。
识别问题
在我们的一家店铺中,`cron_schedule` 表超过了 1,000,000 行。要识别问题,请运行以下 SQL 查询
SELECT count(*) FROM `cron_schedule`
解决问题
移除 cron schedule
中的旧行
DELETE FROM cron_schedule WHERE scheduled_at < Date_sub(Now(), interval 24 hour);
此模块将每天执行清理查询一次。
安装
composer require vendic/magento2-clean-cron-schedule
相关问题
关于 Vendic
Vendic - Magento 2 使用 Magento 2 开发技术挑战性的电子商务网站。欢迎查看我们网站上的项目。