Gearman::Server(3pm)
π Gearman::Server π
okay bestie, so this is the manual page for Gearman::Server (that's the 3pm perl doc version, iykyk) β function call "router" and load balancer. no cap. let's get into it π«Ά
β¨ NAME β¨
Gearman::Server β function call "router" and load balancer. that's the whole vibe. it routes. it balances. it slays π
πΈ DESCRIPTION πΈ
so here's the whole situation, fr fr:
you run a Gearman server β or, honestly, more likely many of them, because you want both high-availability and load balancing (yes queen, redundancy) β and then you have workers. those workers use Gearman::Worker from the Gearman module, or libraries for other languages (perl isn't the only icon here π
), and they register their ability to do certain functions to all of them.
then you have clients. those use Gearman::Client, Gearman::Client::Async, etc etc, and they request work to be done from one of the Gearman servers. that's it, that's the group chat.
the servers connect them all together, routing function call requests to the appropriate workers, multiplexing responses to duplicate requests as requested, etc. etc. etc. β just connecting everybody like the world's most efficient group chat admin π§
ok real talk though: more than likely, you want to use the providedgearmandin bin wrapper script, and not useGearman::Serverdirectly. that's the main character. this is the supporting cast. π
π METHODS π
π new
$server_object = Gearman::Server->new( %options )
creates and returns a new Gearman::Server object β and this is the important part bestie, it attaches itself to the Danga::Socket event loop. so the server will begin operating when the Danga::Socket runloop is started. which means... you need to start up the runloop before anything will happen. nothing happens until the runloop goes. that's the rule. periodt.
Options:
portβ specify a port which you would like theGearman::Serverto listen on for TCP connections. not necessary, but useful π (ngl it's usually pretty useful)
π¦ create_listening_sock
$server_object->create_listening_sock( $portnum, \%options )
add a TCP port listener for incoming Gearman worker and client connections. it's giving "open for business" β¨
Options:
accept_per_loopβ yes, this is an option, and it's literally just sitting there being onelocal_addrβ bind socket to only this address
π start_worker
$pid = $server_object->start_worker( $prog )
($pid, $client) = $server_object->start_worker( $prog )
fork and start a worker process named by $prog, and returns the pid β or, in scalar/list context depending on which form you use, the pid and client object. two flavors, same icon behavior π
π SEE ALSO π
"gearmand"in bin
and that's the whole page, bestie!! πΈ go forth and route some function calls, you absolute icon π¦
this was perl v5.34.0, dated 2022-06-05, and it's the Gearman::Server(3pm) page from User Contributed Perl Documentation β mwah, love that for us πβ¨
π¦ where this page comes from
- debian bookworm: gearman-server 1.130.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: gearman-server 1.130.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: gearman-server 1.130.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: gearman-server 1.130.1-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms