PHPackages                             xieyongfa/swoole\_jobs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. xieyongfa/swoole\_jobs

ActiveLibrary[Queues &amp; Workers](/categories/queues)

xieyongfa/swoole\_jobs
======================

基于swoole的job调度组件，类似gearman的分布式任务处理系统

v4.2.0(6y ago)09MITPHPPHP &gt;=7.0

Since Oct 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/xieyongfa123/swoole_jobs)[ Packagist](https://packagist.org/packages/xieyongfa/swoole_jobs)[ Docs](https://github.com/kcloze/swoole-jobs)[ RSS](/packages/xieyongfa-swoole-jobs/feed)WikiDiscussions v4.1.x Synced 1mo ago

READMEChangelogDependencies (5)Versions (81)Used By (0)

swoole-jobs
===========

[](#swoole-jobs)

[中文介绍](https://github.com/kcloze/swoole-jobs/blob/master/README.zh.md)
----------------------------------------------------------------------

[](#中文介绍)

- Distributed task processing system,similar to gearman,based on swoole
- High performance / dynamic multi woker process consumption queue to accelerate backend time consuming service
- There is no need to configure a crontab like gearman worker, swoole-jobs is responsible for managing all worker states
- Support for pushing queues by HTTP API（swoole http server） , does not depend on php-fpm

1. Explain
----------

[](#1-explain)

- Slower logic in web, such as statistical /email/ SMS / picture processing, etc.
- Support redis/rabbitmq/zeromq or any other queue message store.
- It is more stable and faster than the Yii / laravel framework itself.
- With yii2/phalcon/yaf/ThinkPHP5 integration example, other frameworks can refer to src/Action code.
- [yii2 demo](https://github.com/kcloze/swoole-jobs-yii2)
- [ThinkPHP5 demo](https://github.com/kcloze/swoole-jobs-tp5)

2. Architecture diagram
-----------------------

[](#2-architecture-diagram)

[![Architecture diagram](docs/images/jobs-archi.png)](docs/images/jobs-archi.png)[![Process model](docs/images/jobs-process.png)](docs/images/jobs-process.png)

3. Characteristic
-----------------

[](#3-characteristic)

- 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.

4. Install
----------

[](#4-install)

#### 4.1 composer

[](#41-composer)

```
git clone https://github.com/kcloze/swoole-jobs.git
cd swoole-jobs

```

```
composer install

```

#### 4.2 docker

[](#42-docker)

- git clone
- cd swoole-jobs and composer install
- Building a mirror based on the root directory Dockerfile
- docker build -t swoole-jobs .
- docker run -it -v ~/data/code/php:/data swoole-jobs /bin/bash
- After entering the docker container, enter the project directory:
    - `php ./bin/swoole-jobs.php start`

5. How to running
-----------------

[](#5-how-to-running)

### 5.1 example

[](#51-example)

```
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 start

```

### 5.2 Start parameter description

[](#52-start-parameter-description)

```
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.

```

### 5.3 API parameter description

[](#53-api-parameter-description)

#### 5.3.1 api url

[](#531-api-url)

-

#### 5.3.2 api params:

[](#532-api-params)

ParamsTypeDemojobDatajson{"topic":"MyJob","jobClass":"\\Kcloze\\Jobs\\Jobs\\MyJob","jobMethod":"test2","jobParams":\["kcloze",1532857253,"oop"\],"jobExtras":\[\],"serializeFunc":"php"}6. Service management
---------------------

[](#6-service-management)

### There are two ways to start and close the service online:

[](#there-are-two-ways-to-start-and-close-the-service-online)

#### 6.1 The startup script is added to the crontab timing task, which is executed once a minute (swoole-jobs automatically checks if it is executing, avoiding repeated startup).

[](#61-the-startup-script-is-added-to-the-crontab-timing-task-which-is-executed-once-a-minute-swoole-jobs-automatically-checks-if-it-is-executing-avoiding-repeated-startup)

```
* * * * * /usr/local/bin/php /***/swoole-jobs.php start >> /***/log/system.log 2>&1

```

#### 6.2 Using SYSTEMd Management (failure restart, boot up)

[](#62-using-systemd-management-failure-restart-boot-up)

[more](https://www.swoole.com/wiki/page/699.html)

```
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

7.System screenshot
-------------------

[](#7system-screenshot)

#### htop

[](#htop)

[![demo](docs/images/demo.png)](docs/images/demo.png)

#### status

[](#status)

[![status](docs/images/status.png)](docs/images/status.png)

#### dingding message

[](#dingding-message)

[![message](docs/images/dingding.png)](docs/images/dingding.png)

8. Change log
-------------

[](#8-change-log)

- [change log](docs/ChangeLog.md)

9. Matters needing attention
----------------------------

[](#9-matters-needing-attention)

- If you embed your own framework, you can refer to src/Action code to inherit the abstract class Kcloze\\Jobs\\Action\\BaseAction.
- Various framework services will start slightly different, for specific reference: Code for `example/bin` projects.
- swoole &gt;=4 version,need to set php.ini, [disable coroutine ](https://github.com/swoole/swoole-src/issues/2716)

10. Pressure measurement
------------------------

[](#10-pressure-measurement)

- Bottleneck: redis/rabbitmq queue storage itself and job execution speed

11. Thanks
----------

[](#11-thanks)

- [swoole](http://www.swoole.com/)

12. Contact
-----------

[](#12-contact)

qq group：141059677

13. Donation
------------

[](#13-donation)

- If this project really helps you, please click on the top right corner for a star.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~202 days

Total

79

Last Release

1605d ago

Major Versions

v1.0.1 → 4.1.0.x-dev2017-11-28

v2.6.4.4 → v3.0.02018-07-29

v3.2 → v4.0.02019-08-01

PHP version history (2 changes)v1.0.0PHP &gt;=5.4

v2.1.2PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e553464d602d87df2ea47e50e9c8d5f20cf7865f476e1796fe89302aa47af0bc?d=identicon)[xieyongfa123](/maintainers/xieyongfa123)

---

Top Contributors

[![linland](https://avatars.githubusercontent.com/u/12590892?v=4)](https://github.com/linland "linland (8 commits)")[![xieyongfa123](https://avatars.githubusercontent.com/u/15604264?v=4)](https://github.com/xieyongfa123 "xieyongfa123 (6 commits)")[![quinter8292](https://avatars.githubusercontent.com/u/6063351?v=4)](https://github.com/quinter8292 "quinter8292 (2 commits)")[![daydaygo](https://avatars.githubusercontent.com/u/3986303?v=4)](https://github.com/daydaygo "daydaygo (2 commits)")[![kbigbus](https://avatars.githubusercontent.com/u/11918180?v=4)](https://github.com/kbigbus "kbigbus (2 commits)")[![zefengjiang](https://avatars.githubusercontent.com/u/26040864?v=4)](https://github.com/zefengjiang "zefengjiang (1 commits)")[![fast042](https://avatars.githubusercontent.com/u/10571948?v=4)](https://github.com/fast042 "fast042 (1 commits)")[![omgbbq](https://avatars.githubusercontent.com/u/26438447?v=4)](https://github.com/omgbbq "omgbbq (1 commits)")

---

Tags

schedulerjobswoole

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xieyongfa-swoole-jobs/health.svg)

```
[![Health](https://phpackages.com/badges/xieyongfa-swoole-jobs/health.svg)](https://phpackages.com/packages/xieyongfa-swoole-jobs)
```

###  Alternatives

[kcloze/swoole-jobs

基于swoole的job调度组件，类似gearman的分布式任务处理系统

5793.1k](/packages/kcloze-swoole-jobs)[contributte/scheduler

PHP job scheduler (cron) with locking

31835.3k1](/packages/contributte-scheduler)[orisai/scheduler

Cron job scheduler - with locks, parallelism and more

4037.1k4](/packages/orisai-scheduler)[panlatent/schedule

Schedule plugin for CraftCMS

1034.1k](/packages/panlatent-schedule)[phlib/beanstalk

Library for handling beanstalk connections.

1014.9k2](/packages/phlib-beanstalk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
