QPM-PHP multi-process development-Supervisor configuration reference
Release: 2016-08-08 09:29:07
Original
1200 people have browsed it
QPM is a PHP process management framework that can be used to simplify Daemon development. The project address is: https://github.com/Comos/qpm
As of version 0.2, QPM supports 3 Supervison modes, OneForOne MultiGroupOneForOne and TaskFactoryMode. Different modes can establish different process tree combinations, restart sub-processes, and concurrency control strategies to adapt to different application scenarios. Different modes correspond to different factory methods. For example, the creation method of OneForOne is qpmsupervisorSupervisor::oneForOne($config);OneForOnemethodqpmsupervisorSupervisor::oneForOne($config)usage scenariosall The child processes all use the same callback function or Runnable class. Configuration fields*runnableCallback or runnableClass. Type callable or qpmprocessRunnable runnableCallback is the callback that performs the actual task in the child process. runnableClass is a class that performs actual tasks in the child process, and runnableCallback is a choice.
quantity type integer default 1 concurrent quantity.
maxRestartTimes type integer maximum number of restarts, used in conjunction with withInSeconds.
withInSeconds type integer and maxRestartTimes indicate the maximum number of restarts of the master process within the agreed time.
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::oneForOne($config);
$sup->start();
MultiGroupOneForOneMethodqpmsupervisorSupervisor::oneForOne($config)Usage scenariosMultiGroupOne ForOne is an upgraded version of OneForOne, which can manage multiple groups of OneForOne process. The configuration of MultiGroupOneForOne is an array embedded with several OneForOne configurations. TaskFactoryModeTask factory mode, tasks are generated by the specified factory method. MethodqpmsupervisorSupervisor::taskFactoryMode($config)Usage scenariosThe tasks performed by each child process are different and require different parameters, classes or Run functions, so each task is generated by the task factory . Configuration fields*factoryMethod callable is used to generate task objects or callable factory methods. factoryMethod return value can be qpmprocessRunnable or callablequantity type integer default 1 concurrent quantity.
As of version 0.2, QPM supports 3 Supervison modes, OneForOne MultiGroupOneForOne and TaskFactoryMode. Different modes can establish different process tree combinations, restart sub-processes, and concurrency control strategies to adapt to different application scenarios. Different modes correspond to different factory methods. For example, the creation method of OneForOne is qpmsupervisorSupervisor::oneForOne($config);OneForOnemethodqpmsupervisorSupervisor::oneForOne($config)usage scenariosall The child processes all use the same callback function or Runnable class. Configuration fields*runnableCallback or runnableClass. Type callable or qpmprocessRunnable runnableCallback is the callback that performs the actual task in the child process. runnableClass is a class that performs actual tasks in the child process, and runnableCallback is a choice.
quantity type integer default 1 concurrent quantity.
maxRestartTimes type integer maximum number of restarts, used in conjunction with withInSeconds.
withInSeconds type integer and maxRestartTimes indicate the maximum number of restarts of the master process within the agreed time.
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::oneForOne($config);
$sup->start();
MultiGroupOneForOneMethodqpmsupervisorSupervisor::oneForOne($config)Usage scenariosMultiGroupOne ForOne is an upgraded version of OneForOne, which can manage multiple groups of OneForOne process. The configuration of MultiGroupOneForOne is an array embedded with several OneForOne configurations. TaskFactoryModeTask factory mode, tasks are generated by the specified factory method. MethodqpmsupervisorSupervisor::taskFactoryMode($config)Usage scenariosThe tasks performed by each child process are different and require different parameters, classes or Run functions, so each task is generated by the task factory . Configuration fields*factoryMethod callable is used to generate task objects or callable factory methods. factoryMethod return value can be qpmprocessRunnable or callablequantity type integer default 1 concurrency quantity.
The above introduces the QPM-PHP multi-process development-Supervisor configuration reference, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31