QPM is a PHP process management framework that can be used to simplify daemon development, with project addresses in:https://github.com/Comos/qpm
As of version 0.2, QPM supports 3 Supervison modes, Oneforone Multigrouponeforone and Taskfactorymode. Different patterns can be set up for different process tree combinations, sub-process restarts, and concurrency control strategies are varied to suit different application scenarios. Different modes correspond to different factory methods, for example Oneforone is created by Qpm\supervisor\supervisor::oneforone ($config);
Oneforone
Method
Qpm\supervisor\supervisor::oneforone ($config)
Usage Scenarios
All child processes use the same callback function or Runnable class.
Configuration fields
*runnablecallback or Runnableclass. The type callable or Qpm\process\runnable Runnablecallback is the callback that performs the actual task in the child process. Runnableclass the class that performs the actual task in the child process, and runnablecallback two to select one.
The quantity type integer defaults to 1 concurrent quantities.
Maxrestarttimes type integer maximum number of restarts, used in conjunction with Withinseconds.
Withinseconds type Integer and Maxrestarttimes, which indicates the maximum number of restarts for the master process over the agreed time period. Example 1
' Justdoit ', ' quantity ' = 3]; $sup = Qpm\supervisor\supervisor::oneforone ($config); $sup->start (); Example 2
' Foo ', ' quantity ' = 5, ' maxrestarttimes ' =>100, ' withinseconds ' =>10]; $sup = Qpm\supervisor\supervisor::o Neforone ($config); $sup->start (); Multigrouponeforone
Method
Qpm\supervisor\supervisor::oneforone ($config)
Usage Scenarios
Multigrouponeforone is an upgraded version of Oneforone that manages multiple sets of oneforone processes. The Multigrouponeforone configuration is an array with several Oneforone configurations embedded in it.
Taskfactorymode
Task Factory mode, the task is generated by the specified factory method.
Method
Qpm\supervisor\supervisor::taskfactorymode ($config)
Usage Scenarios
Each time a child process executes a different task, it requires a separate parameter, class, or run function, so each task is generated by the task factory.
Configuration fields
*factorymethod callable The factory method used to build the task object or callable. The FactoryMethod return value can be qpm\process\runnable or callable
The quantity type integer defaults to 1 concurrent quantities.
As of version 0.2, QPM supports 3 Supervison modes, Oneforone Multigrouponeforone and Taskfactorymode. Different patterns can be set up for different process tree combinations, sub-process restarts, and concurrency control strategies are varied to suit different application scenarios. Different modes correspond to different factory methods, for example Oneforone is created by Qpm\supervisor\supervisor::oneforone ($config);
Oneforone
Method
Qpm\supervisor\supervisor::oneforone ($config)
Usage Scenarios
All child processes use the same callback function or Runnable class.
Configuration fields
*runnablecallback or Runnableclass. The type callable or Qpm\process\runnable Runnablecallback is the callback that performs the actual task in the child process. Runnableclass the class that performs the actual task in the child process, and runnablecallback two to select one.
The quantity type integer defaults to 1 concurrent quantities.
Maxrestarttimes type integer maximum number of restarts, used in conjunction with Withinseconds.
Withinseconds type Integer and Maxrestarttimes, which indicates the maximum number of restarts for the master process over the agreed time period. Example 1
' Justdoit ', ' quantity ' = 3]; $sup = Qpm\supervisor\supervisor::oneforone ($config); $sup->start (); Example 2
' Foo ', ' quantity ' = 5, ' maxrestarttimes ' =>100, ' withinseconds ' =>10]; $sup = Qpm\supervisor\supervisor::o Neforone ($config); $sup->start (); Multigrouponeforone
Method
Qpm\supervisor\supervisor::oneforone ($config)
Usage Scenarios
Multigrouponeforone is an upgraded version of Oneforone that manages multiple sets of oneforone processes. The Multigrouponeforone configuration is an array with several Oneforone configurations embedded in it.
Taskfactorymode
Task Factory mode, the task is generated by the specified factory method.
Method
Qpm\supervisor\supervisor::taskfactorymode ($config)
use scene
config field
*factorymethod callable The factory method used to build the task object or callable. The FactoryMethod return value can be qpm\process\runnable or callable
quantity type integer default 1 concurrent number.
Above describes the qpm-php multi-process development-supervisor configuration reference, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.