amakata/m2-ce-cron
Composer 安装命令:
composer require amakata/m2-ce-cron
包简介
Replacement package for Magento 2 Cron Functionality
README 文档
README
Cron
This module for Magento 2 overrides base magento cron functionality, fixes known bugs, and provides a cron service model to control cron process execution.
The default cron can overlap and fill the cron_schedule table, which can cause exponentially more jobs to run on each cron interval, until finally the crons run continously and never complete. The high number of cron jobs can also crash servers hosting Magento 2.
This module replaces the cron management with a service that accepts jobs. As jobs are scheduled, they are picked up by this service for execution. If a job is already running and another is picked up with the same job code, the new one is marked as missed. Duplicate jobs are prevented from running, reducing server overhead.
Think of the default cron as a factory that suddenly appears and runs any number of tasks. If those tasks do not complete by the next cron interval, they keep processing but another factory spontaneously appears and run another set of jobs which can overlap with the original factory.
The module removes the possibility of overlapping jobs by having a single source service that processes jobs in proper order without duplication. There is one factory working all the time to get your jobs done.
In addition to the service model many other enhancements have been made. For example a re-write of left join on update statement that forced a full table scan on cron_schedule for history. Statement would lock because it's reading from same table it was trying to update.
In version 1.1 Cron Reporting was added to the admin to show job code statistics and list cron run errors.
Contributing
See CONTRIBUTING.md.
Benefits
-
Speeds up execution of cron.
-
Stops db locking.
-
Prevents cron history records from exploding.
-
Stops cron processes from overruning each other.
-
Stops the cron from running while system is under configurable load conditions.
-
Sets the max number of simultaneous cron processes.
-
Sets the amount of history.
Admin Options
Cron Enabled - Turn the cron on/off.
Maximum Cron Processes - The number of cron threads running in parallel. This option is the sum of all defined jobs. Example: If you have 5 jobs set to run at midnight, Maximum Cron Processes set to 1, only 1 job will execute sequentially until all 5 are completed. Default 3.
PHP Binary Name / Path - The name of your php binary you run from the shell. Usually php or php70. You can optionally include the full path to the binary. Default php. You can also add inline options here such as php -dmemory_limit=8096M If you want to have a custom ini value.
Max Load Average - Defined by the php function sys.getloadavg() / number of cpu cores. The function sys.getloadavg() is reported 1.0 for each core in use, just like the load average reported in top. The number of cpu cores is pulled from /proc/cpuinfo and load average is divided by this number. Example: If you have 8 cores and you're using 6 then this is returned as 0.75. If your Max Load Average is 0.76 your crons will not run. Your load average falls to 0.74. Your crons will run. Any cron that was scheduled to run but didn't will be run. If the same cron was missed multiple times, the most recent job will run, and the rest will be marked as missed. Default is 0.75 (75% of your available cpu).
History Retention - The number of days history to keep in the cron_schedule table. Default 1 (1 day).
Composer Install
- Run these commands in your terminal:
composer require amakata/m2-ce-cron php bin/magento module:enable MageMojo_Cron php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy
-
Log into your admin and set your options under System -> Cron Settings
-
Enable cron jobs as defined if it is not already enabled here: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html
License
amakata/m2-ce-cron 适用场景与选型建议
amakata/m2-ce-cron 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.03k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cron」 「magento2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amakata/m2-ce-cron 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amakata/m2-ce-cron 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amakata/m2-ce-cron 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Russian Language Pack for Magento 2
Symfony bundle to monitor and execute commands
DPD Magento2 Shipping extension
Scheduling extension for Yii2 framework
Monitoring for scheduled jobs
Auto generate related products for Magento 2
统计信息
- 总下载量: 34.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-02