.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "GEARMAN_CLIENT_SERVER_SELECTION_BY_UNIQUE" "3" "Oct 18, 2026" "2.2.0" "Gearmand" .SH NAME gearman_client_server_selection_by_unique \- Gearmand Documentation, https://gearman.org/gearmand/ .SH SYNOPSIS .sp #include .INDENT 0.0 .TP .B void gearman_client_set_server_selection_by_unique(\fI\%gearman_client_st\fP *client, \fI\%bool\fP enable) .UNINDENT .INDENT 0.0 .TP .B \fI\%bool\fP gearman_client_server_selection_by_unique(const \fI\%gearman_client_st\fP *client) .UNINDENT .SH DESCRIPTION .sp By default, when a client with more than one server added via \fI\%gearman_client_add_server()\fP submits a job, it is sent to the first idle server in the order the servers were added \-\- the job\(aqs unique identifier plays no part in the choice. .sp \fI\%gearman_client_set_server_selection_by_unique()\fP opts a client into choosing the destination server by hashing the job\(aqs unique instead, using a ketama consistent\-hash ring built from the client\(aqs current server list. The practical effect is that submissions sharing the same unique (from this client, or from any other client configured with the same server list and this option enabled) consistently land on the same server, and adding or removing a server only reshuffles the jobs that server itself was responsible for. .sp This only affects job submission (\fI\%gearman_client_do()\fP, \fI\%gearman_client_do_background()\fP, and their variants, plus \fI\%gearman_client_add_task()\fP and friends); commands such as status lookups are unaffected. A job submitted with an empty unique falls back to the default selection, since there is no meaningful value to hash. .sp If the hash\-selected server cannot be reached, the client fails over to the next server in ring order rather than failing the submission outright, the same way the default selection falls through the server list on a connection failure. .sp This option is disabled by default. It can also be enabled or disabled with the \fI\%GEARMAN_CLIENT_SERVER_SELECTION_BY_UNIQUE\fP flag via \fI\%gearman_client_add_options()\fP / \fI\%gearman_client_remove_options()\fP (and queried with \fI\%gearman_client_has_option()\fP), which is useful for language bindings that pass an options bitmask through to libgearman. Both ways change the same setting. It is copied by \fI\%gearman_client_clone()\fP like the client\(aqs other persistent settings. .sp \fI\%gearman_client_server_selection_by_unique()\fP returns whether the option is currently enabled. .SH RETURN VALUE .sp \fI\%gearman_client_server_selection_by_unique()\fP returns a \fBbool\fP; it returns \fBfalse\fP for a \fBNULL\fP client. .SH HOME .sp To find out more information please check: \fI\%https://gearman.org/gearmand/\fP .sp \fBSEE ALSO:\fP .INDENT 0.0 .INDENT 3.5 \fBgearmand(8)\fP \fBlibgearman(3)\fP \fBgearman_client_st\fP \fBgearman_client_add_server\fP .UNINDENT .UNINDENT .SH AUTHOR Data Differential http://www.datadifferential.com/ .SH COPYRIGHT 2011-2014, Data Differential, http://www.datadifferential.com/ .\" Generated by docutils manpage writer. .