See https://www.rfc-editor.org/rfc/rfc9000.html#section-8.1.2 for more
information about QUIC retry.
-shards <number> | by-thread
+shards <number> | by-thread | by-group
In multi-threaded mode, on operating systems supporting multiple listeners on
the same IP:port, this will automatically create this number of multiple
identical listeners for the same line, all bound to a fair share of the number
thread). The special "by-thread" value also creates as many shards as there
are threads on the "bind" line. Since the system will evenly distribute the
incoming traffic between all these shards, it is important that this number
- is an integral divisor of the number of threads.
+ is an integral divisor of the number of threads. Alternately, the other
+ special value "by-group" will create one shard per thread group. This can
+ be useful when dealing with many threads and not wanting to create too many
+ sockets. The load distribution will be a bit less optimal but the contention
+ (especially in the system) will still be lower than with a single socket.
ssl
This setting is only available when support for OpenSSL was built in. It
shards = bind_conf->settings.shards;
todo = thread_set_count(&bind_conf->thread_set);
- /* special values: -1 = "by-thread" */
+ /* special values: -1 = "by-thread", -2 = "by-group" */
if (shards == -1)
shards = todo;
+ else if (shards == -2)
+ shards = my_popcountl(bind_conf->thread_set.grps);
/* no more shards than total threads */
if (shards > todo)
return 0;
}
-/* parse the "shards" bind keyword. Takes an integer or "by-thread" */
+/* parse the "shards" bind keyword. Takes an integer, "by-thread", or "by-group" */
static int bind_parse_shards(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
int val;
if (strcmp(args[cur_arg + 1], "by-thread") == 0) {
val = -1; /* -1 = "by-thread", will be fixed in check_config_validity() */
+ } else if (strcmp(args[cur_arg + 1], "by-group") == 0) {
+ val = -2; /* -2 = "by-group", will be fixed in check_config_validity() */
} else {
val = atol(args[cur_arg + 1]);
if (val < 1 || val > MAX_THREADS) {