12 Jul 2016 07:48:29 UTC
- Distribution: Gearman-Server
- Module version: v1.130.1
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- KwaliteeBus factor: 0
- 11.83% Coverage
- License: unknown
- Activity24 month
- Download (17.17KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:4 non-PAUSE usersPALIK Алексей Пастуховand 1 contributors
- Brad Fitzpatrick (email@example.com), Brad Whitaker (firstname.lastname@example.org)
Gearman::Server - function call "router" and load balancer
You run a Gearman server (or more likely, many of them for both high-availability and load balancing), then have workers (using Gearman::Worker from the Gearman module, or libraries for other languages) register their ability to do certain functions to all of them, and then clients (using Gearman::Client, Gearman::Client::Async, etc) request work to be done from one of the Gearman servers.
The servers connect them, routing function call requests to the appropriate workers, multiplexing responses to duplicate requests as requested, etc.
More than likely, you want to use the provided "gearmand" in bin wrapper script, and not use Gearman::Server directly.
$server_object = Gearman::Server->new( %options )
Creates and returns a new Gearman::Server object, which attaches itself to the Danga::Socket event loop. The server will begin operating when the Danga::Socket runloop is started. This means you need to start up the runloop before anything will happen.
Specify a port which you would like the Gearman::Server to listen on for TCP connections (not necessary, but useful)
$server_object->create_listening_sock( $portnum, \%options )
Add a TCP port listener for incoming Gearman worker and client connections. Options:
Bind socket to only this address.
$pid = $server_object->start_worker( $prog ) ($pid, $client) = $server_object->start_worker( $prog )
Fork and start a worker process named by
$progand returns the pid (or pid and client object).
Module Install Instructions
To install Gearman::Server, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Gearman::Server
For more information on module installation, please visit the detailed CPAN module installation guide.