đDynamic multi process worker queue base on swoole, like gearman but high performance.
job scheduling component based on swoole; distributed task processing system similar to gearman;
redis/rabbitmq/zeromq and any other queue message store (currently only redis/rabbitmq).
use swoole process to realize multi process management, the number of processes can be configured, and the worker process will automatically pull up after exiting.
the number of cycles of child processes can be configured to prevent memory leakage from business code; the default stop command will wait for the child process to exit smoothly.
support topic features, different job binding different topic;
each topic starts the corresponding number of sub processes to eliminate the interaction between different topic.
according to the queue backlog, the sub process starts the process dynamically, and the number of the largest sub processes can be configured.
support composer, which can be integrated with any framework;
log file automatic cutting, default maximum 100M, up to 5 log files, prevent log brush full disk;
backlog, support for nail robot and other news alerts.
git clone https://github.com/kcloze/swoole-jobs.git
cd swoole-jobs
composer install
php ./bin/swoole-jobs.php start
1.edit config.php
2.start service
php ./bin/swoole-jobs.php start >> log/system.log 2>&1
3.push jobs
php ./tests/testJobsSerialzie.php
4.start api server
php ./bin/swoole-jobs.php http start
5.stop api server
php ./bin/swoole-jobs.php http stop
NAME
- manage swoole-jobs
SYNOPSIS
-php bin/swoole-jobs.php app [options]
-Manage swoole-jobs daemons.
WORKFLOWS
-help [command]
-Show this help, or workflow help for command.
-restart
-Stop, then start swoole-jobs master and workers.
-start
-Start swoole-jobs master and workers.
-stop
-Wait all running workers smooth exit, please check swoole-jobs status for a while.
-exit
-Kill all running workers and master PIDs.
-http start
-Start swoole http server for apis.
-http stop
-Stop swoole http server for api.
Params | Type | Demo |
---|---|---|
jobData | json | {âtopicâ:âMyJobâ,âjobClassâ:â\Kcloze\Jobs\Jobs\MyJobâ,âjobMethodâ:âtest2â,âjobParamsâ:[âkclozeâ,1532857253,âoopâ],âjobExtrasâ:[],âserializeFuncâ:âphpâ} |
* * * * * /usr/local/bin/php /***/swoole-jobs.php start >> /***/log/system.log 2>&1
1. According to your own project path, modifyïŒ docs/systemd/swoole-jobs.service
2. sudo cp -f systemd/swoole-jobs.service /etc/systemd/system/
3. sudo systemctl --system daemon-reload
4. Service management
#start service
sudo systemctl start swoole-jobs.service
#reload service
sudo systemctl reload swoole-jobs.service
#stop service
sudo systemctl stop swoole-jobs.service
example/bin
projects.qq groupïŒ141059677