Git Product home page Git Product logo

net_gearman's Introduction

Net_Gearman
About

Net_Gearman is a PEAR package for interfacing with Danga's Gearman. Gearman is a system to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance lots of function calls, or to call functions between languages.

Net_Gearman is currently in production at Yahoo! and Digg doing all sorts of offloaded near time processing.
Installation

   1. Install PEAR if it is not already installed on your system.
   2. Run pear install http://netgearman.googlecode.com/files/Net_Gearman-x.y.z.tgz (Replace x.y.z with the latest version from the featured download to the right). 

Examples
Client

<?php

require_once 'Net/Gearman/Client.php';

$client = new Net_Gearman_Client('localhost:7003');
$client->someBackgroundJob(array(
    'userid' => 5555,
    'action' => 'new-comment'
));

?>

Job

<?php

class Net_Gearman_Job_someBackgroundJob extends Net_Gearman_Job_Common
{
    public function run($args)
    {
        if (!isset($args['userid']) || !isset($args['action'])) {
            throw new Net_Gearman_Job_Exception('Invalid/Missing arguments');
        }

        // Insert a record or something based on the $args

        return array(); // Results are returned to Gearman, except for 
                        // background jobs like this one.
    }
}

?>

Worker

<?php

require_once 'Net/Gearman/Worker.php';

$worker = new Net_Gearman_Worker('localhost:7003');
$worker->addAbility('someBackgroundJob');
$worker->beginWork();

?>

net_gearman's People

Contributors

joestump avatar lenn0x avatar

Stargazers

Somkiat Puisungnoen avatar

Watchers

Somkiat Puisungnoen avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.