1Gearman::Server::ClientU(s3e)r Contributed Perl DocumentaGteiaornman::Server::Client(3)
2
3
4

NAME

6       Gearman::Server::Client
7

NAME

9       Used by Gearman::Server to instantiate connections from clients.
10       Clients speak either a binary protocol, for normal operation (calling
11       functions, grabbing function call requests, returning function values,
12       etc), or a text-based line protocol, for relatively rare administrative
13       / monitoring commands.
14
15       The binary protocol commands aren't currently documented. (FIXME) But
16       they're well-implemented in Gearman::Client, Gearman::Worker, and
17       Gearman::Client::Async, if that's any consolation.
18
19       The line-based administrative commands are documented below.
20

Binary Protocol Structure

22       All binary protocol exchanges between clients (which can be callers,
23       workers, or both) and the Gearman server have common packet header:
24
25         4 byte magic  -- either "\0REQ" for requests to the server, or
26                          "\0RES" for responses from the server
27         4 byte type   -- network order integer, representing the packet type
28         4 byte length -- network order length, for data segment.
29         data          -- optional, if length is non-zero
30

Binary Protocol Commands

32   echo_req (type=16)
33       A debug command.  The server will reply with the same data, in a
34       echo_res (type=17) packet.
35
36   (and many more...)
37       FIXME: auto-generate protocol docs from internal Gearman::Util table,
38       once annotated with some English?
39

Line based commands

41       These commands are used for administrative or statistic tasks to be
42       done on the gearman server. They can be entered using a line based
43       client (telnet, etc.) by connecting to the listening port (7003) and
44       are also intended to be machine parsable.
45
46   "workers"
47       Emits list of registered workers, their fds, IPs, client ids, and list
48       of registered abilities (function names they can do).  Of format:
49
50         fd ip.x.y.z client_id : func_a func_b func_c
51         fd ip.x.y.z client_id : func_a func_b func_c
52         fd ip.x.y.z client_id : func_a func_b func_c
53         .
54
55       It ends with a line with just a period.
56
57   "status"
58       The output format of this function is tab separated columns as follows,
59       followed by a line consisting of a fullstop and a newline (".\n") to
60       indicate the end of output.
61
62       Function name
63           A string denoting the name of the function of the job
64
65       Number in queue
66           A positive integer indicating the total number of jobs for this
67           function in the queue. This includes currently running ones as well
68           (next column)
69
70       Number of jobs running
71           A positive integer showing how many jobs of this function are
72           currently running
73
74       Number of capable workers
75           A positive integer denoting the maximum possible count of workers
76           that could be doing this job. Though they may not all be working on
77           it due to other tasks holding them busy.
78
79   "jobs"
80       Output format is zero or more lines of:
81
82           [Job function name]\t[Uniq (coalescing) key]\t[Worker address]\t[Number of listeners]\n
83
84       Follows by a single line of:
85
86           .\n
87
88       \t is a literal tab character \n is perl's definition of newline
89       (literal \n on linux, something else on win32)
90
91   "clients"
92       Output format is zero or more sections of:
93
94           One line of:
95
96               [Client Address]\n
97
98           Followed by zero or more lines of:
99
100               \t[Job Function]\t[Uniq (coalescing) key]\t[Worker Address]\n
101
102       Follows by a single line of:
103
104           .\n
105
106       \t is a literal tab character \n is perl's definition of newline
107       (literal \n on linux, something else on win32)
108
109   "maxqueue" function [max_queue_size]
110       For a given function of job, the maximum queue size is adjusted to be
111       max_queue_size jobs long. A negative value indicates unlimited queue
112       size.
113
114       If the max_queue_size value is not supplied then it is unset (and the
115       default maximum queue size will apply to this function).
116
117       This function will return OK upon success, and will return ERR
118       incomplete_args upon an invalid number of arguments.
119
120   "shutdown" ["graceful"]
121       Close the server.  Or "shutdown graceful" to close the listening
122       socket, then close the server when traffic has died away.
123
124   "version"
125       Returns server version.
126
127
128
129perl v5.12.1                      2009-10-05        Gearman::Server::Client(3)
Impressum