PHPackages                             skphp1989/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. skphp1989/swoole-jobs

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

skphp1989/swoole-jobs
=====================

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

v1.0.2(6y ago)04MITPHPPHP &gt;=7.0

Since May 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/SKPHP1989/swoole-jobs)[ Packagist](https://packagist.org/packages/skphp1989/swoole-jobs)[ Docs](https://github.com/SKPHP1989/swoole-jobs)[ RSS](/packages/skphp1989-swoole-jobs/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (3)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 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 ./swoole-jobs.php start >> log/system.log 2>&1

3.push jobs
php ./tests/testJobsSerialzie.php

4.start api server
php ./swoole-jobs.php start http

5.stop api server
php ./swoole-jobs.php stop http

```

### 5.2 Start parameter description

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

```
NAME
      php swoole-jobs - manage swoole-jobs

SYNOPSIS
      php swoole-jobs command [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.

      start http
      Start swoole http server for apis.

      stop
      Wait all running workers smooth exit, please check swoole-jobs status for a while.

      stop http
      Stop swoole http server for api.

      exit
      Kill all running workers and master PIDs.

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

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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

2548d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d4cc3f991fb7da22415060fa753c7d0d1e4dc823192a880f1f66a09a5db5d76?d=identicon)[SKPHP1989](/maintainers/SKPHP1989)

---

Tags

schedulerjobswoole

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[kcloze/swoole-jobs

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

5793.1k](/packages/kcloze-swoole-jobs)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[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)
