Download the PHP package yuntian001/multi-process-queue without Composer

On this page you can find all versions of the php package yuntian001/multi-process-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package multi-process-queue

multi-process-queue

基于swoole的多进程队列系统,manage进程管理子进程,master进程监听队列分发任务,worker进程执行任务, 多进程、低延时(最低毫秒级)、低资源占用、高可用、可多服务器分布式部署。可与 laravel thinkphp 等框架配合使用。

版本要求:

当前支持的驱动

特性

进程结构图

配置说明

配置项 类型 是否必填 默认值 说明
basics array 基础配置项
basics.name string 当前队列服务名称,多个服务同时启动时需要分别设置名字(名字自定义确保队列服务名字不重复即可)
basics.pid_path string /tmp 主进程pid文件存放路径
basics.driver string 队列驱动必须是MPQueue\Queue\Driver\DriverInterface的实现类
worker_start_handle callable 空字符串 worker进程启动后会调用(当前服务所有队列有效)
log array 日志配置
log.path string /tmp 日志存放路径
log.level int Monolog\Logger::INFO 日志记录级别 Monolog\Logger::DEBUG/Monolog\Logger::INFO
log.dirver string/class RotatingFileLogDriver 日志驱动,必须是MPQueue\Log\Driver\LogDriverInterface的实现
queue 二维数组 队列配置
queue[0].name string 队列名称
queue[0].worker_number int 3 工作进程数量
queue[0].memory_limit int 128 工作进程最大使用内存数(单位mb)(0无限制)
queue[0].sleep_seconds floot 1 监视进程休眠时间(秒,最小到0.001)
queue[0].timeout int 120 超时时间(s)以投递任务方为准
queue[0].fail_number int 3 最大失败次数以投递任务方为准,达到最大次数前(包括次数)失败后会重新投递(即任务最多允许执行fail_number+1次)
queue[0].fail_expire int 3 失败延时投递时间(s 支持小数精度到0.001)以投递任务方为准
queue[0].fail_handle callable 任务失败执行函数(当任务超时或者达到最大投递次数后会执行)
queue[0].worker_start_handle callable worker进程启动加载函数(当前队列有效)
queue[0].model int \MPQueue\Config\QueueConfig::MODEl_DISTRIBUTE 队列运行模式(\MPQueue\Config\QueueConfig::MODEl_DISTRIBUTE 分发模式 \MPQueue\Config\QueueConfig::MODEL_GRAB 抢占模式)

fail_handle 会传入两个参数 $jobInfo 任务详细信息、$e出错的异常类 fail_handle的执行时间也受timeout的控制

注意:任务超时后会直接记录为失败,不会根据fail_number进行失败重试,可以在fail_handle中根据$jobInfo['type']判断是否是超时任务。

2.0改动

  1. 取消超时回调,超时后记录为失败,触发失败回调。
  2. 由原来的每次失败都触发失败回调改为,超时或超过失败重试次数后才触发。
  3. 增加抢占模式:此模式下worker进程会主动抢任务会增加数据库查询和连接数量(1.0版本的模式为分发模式)
  4. 增加高可用性,超时时间适用于失败回调,如果进程在失败回调执行期间挂掉,其余进程会在超时时间到达后再次执行失败回调。
  5. 优化分发模式性能,按当前空闲进程数一次获取多个任务进行分发,qps大大提高。

    下个版本规划

    • redis集群(Redis Cluster)支持

配置示例

快速上手

1.安装

MPQueue\Queue\Queue::push 接收三个参数:

任务投递示例,请参考test和test/Job文件夹下的normal.php、failed.php、timeout.php、pressure.php

注意事项

在laravel中使用

在thinkphp5.0中使用

在thinkphp6.0中使用

项目推荐

在这里推荐下,我自己开源的vue中后台模版项目(vue3+vite3+element-plus),如果想搭建后台可以使用下

github地址: https://github.com/meadmin-cn/meadmin-template


All versions of multi-process-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
monolog/monolog Version ^2.2
opis/closure Version ^3.6
nategood/commando Version ^0.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yuntian001/multi-process-queue contains the following files

Loading the files please wait ....