gearman-combined with PHP (1)

Source: Internet
Author: User
Tags pear

The project requires a scheduling module that schedules scheduled tasks, condition-triggered tasks, such as traffic. My design is: A scanner regularly scan the database in the non-start task, the task is sent to Gearman,gearman distributed to workers,worker distribution to determine the task trigger conditions, if the trigger conditions are met, the package task sent to Gearman, Gearman distributed to Workers,workers to perform the task.

Gearman the operating architecture:

Gearman's Client&worker API supports many languages and I need PHP. PHP is divided into two kinds, one is Gearman Extension, is the PHP extension, is a package of Libgearman C library extension, Using the. so extension to let PHP load, the approximate step is: Need to install Libgearman (this to install libevent and so on), and then use pecl install PHP Gearman extension, the other is Net_gearman, this is a pure PHP library, You can use pear to get down and use the words need require come in.

Here I also figure out the difference between pecl and pear:
Pear: PHP Extension Code package, all the extensions are in the form of PHP code, powerful, easy to install, even can be changed. When used, the include in the code can be used.
PECL: PHP is a standard extension that complements the functionality required in real-world development, all extensions need to be installed and configured in php.ini to restart PHP.

When I installed Gearman extension, I met n problems, I couldn't make it, I gave up, instead of Net_gearman.
Installation:
Pear Install Net_gearman
Will usually be decompressed here:
Php/lib/php/net/gearman

API documentation

I found a foreigner to write the Net_gearman tutorial, feel good, there are some examples. I ran through an example and then learned and tested each example.

gearman-combined with PHP (1)

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.