qpm-php Multi-process development-supervisor Configuration Reference

Source: Internet
Author: User

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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.