summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-28 19:40:34 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-10-28 19:40:34 +0100
commitdd0ad26ea9824b75accced2b56328cbb222c4c6d (patch)
tree2b58b194f47edf83426d48b0623a7529461f157d
parent82faf0af92e6c3a8c56d591e674b33708f60aa32 (diff)
Default udp workers to 1, as it is the most sane choice everywhere, also reflect the new udp parallelism in the man pages
-rw-r--r--man4/opentracker.conf.439
-rw-r--r--opentracker.conf.sample14
-rw-r--r--ot_config.c2
3 files changed, 50 insertions, 5 deletions
diff --git a/man4/opentracker.conf.4 b/man4/opentracker.conf.4
index 2bc1389..b28879f 100644
--- a/man4/opentracker.conf.4
+++ b/man4/opentracker.conf.4
@@ -1,5 +1,5 @@
1.Dd 2024-04-18 1.Dd 2026-10-28
2.Dt opentracker.conf 5 2.Dt opentracker.conf 4
3.Os Unix 3.Os Unix
4.Sh NAME 4.Sh NAME
5.Nm opentracker.conf 5.Nm opentracker.conf
@@ -25,8 +25,29 @@ Specifies the address opentracker will listen on for TCP connections. Can be add
25.It listen.udp Ar address 25.It listen.udp Ar address
26Specifies the address opentracker will listen on for UDP connections. Can be added more than once. 26Specifies the address opentracker will listen on for UDP connections. Can be added more than once.
27.Pp 27.Pp
28A listen statement may carry options after the address, as in
29.Dl listen.udp 10.0.0.5:6969 workers=4 shared
30where
31.Cm workers Ns = Ns Ar count
32sets the worker count for that socket alone and is ignored for TCP, and
33.Cm shared
34permits another process to bind the same address.
35.Pp
28.It listen.udp.workers Ar threads 36.It listen.udp.workers Ar threads
29Specifies how many threads will be spawned to handle UDP connections. Defaults to 4. 37Specifies how many threads will be spawned to handle UDP requests, for every
38listen statement that does not carry a
39.Cm workers
40option of its own. Defaults to 1. A count of 0 serves UDP from the event loop,
41in the thread that also serves TCP. See
42.Sx TUNING
43before raising it.
44.Pp
45.It listen.shared Ar boolean
46Permits another process to bind the same address, for every listen statement
47that does not carry a
48.Cm shared
49option of its own. Defaults to 0, and is useful only where a second tracker is
50deliberately run on the same address.
30.Pp 51.Pp
31.It access.whitelist Ar path/to/whitelist 52.It access.whitelist Ar path/to/whitelist
32Specifies the path to the whitelist file containing all torrent hashes that opentracker will serve. Use this option if opentracker runs in a non-open mode. 53Specifies the path to the whitelist file containing all torrent hashes that opentracker will serve. Use this option if opentracker runs in a non-open mode.
@@ -67,6 +88,18 @@ Specifies the user opentracker will setuid to after binding to potentially privi
67.It tracker.redirect_url Ar URL 88.It tracker.redirect_url Ar URL
68Specifies the URL opentracker will redirect to in response to a "GET / HTTP" request. 89Specifies the URL opentracker will redirect to in response to a "GET / HTTP" request.
69.El 90.El
91.Sh TUNING
92A worker is a thread that blocks in a read until a datagram arrives. Where the
93kernel spreads arriving datagrams over a group of sockets bound to one address,
94opentracker binds one socket per worker and throughput rises with the worker
95count. Linux does so, and FreeBSD since 12.0. Where a kernel does not, every
96worker reads the same socket and they contend for its receive queue, so more
97than one worker costs throughput. opentracker asks at start up and binds a
98group only where the answer is yes.
99.Pp
100.Pa tests/udp_scaling.py
101in the source distribution sweeps the setting against a running tracker.
102Measure on the machine that will carry the traffic.
70.Sh EXAMPLES 103.Sh EXAMPLES
71To specify the address opentracker will listen on for both TCP and UDP connections: 104To specify the address opentracker will listen on for both TCP and UDP connections:
72.Dl listen.tcp_udp 0.0.0.0:6969 105.Dl listen.tcp_udp 0.0.0.0:6969
diff --git a/opentracker.conf.sample b/opentracker.conf.sample
index 4adb736..1d535e8 100644
--- a/opentracker.conf.sample
+++ b/opentracker.conf.sample
@@ -23,7 +23,7 @@
23# 23#
24# workers=<count> handle this udp socket in blocking reads in that 24# workers=<count> handle this udp socket in blocking reads in that
25# many dedicated worker threads instead of in the 25# many dedicated worker threads instead of in the
26# event loop. Ignored for tcp. 26# event loop. Defaults to 1. Ignored for tcp.
27# shared allow another process to bind the same address and 27# shared allow another process to bind the same address and
28# let the kernel share the traffic. Only useful if you 28# let the kernel share the traffic. Only useful if you
29# deliberately run a second tracker there. 29# deliberately run a second tracker there.
@@ -37,6 +37,18 @@
37# listen.udp.workers 4 37# listen.udp.workers 4
38# listen.shared 1 38# listen.shared 1
39# 39#
40# Raising the worker count pays off where the kernel spreads arriving
41# datagrams over a group of sockets bound to one address. Linux does so
42# and FreeBSD has since 12.0, Darwin does not. opentracker asks at start
43# up and binds one socket per worker only where the answer is yes. Where
44# it is no, all workers read the one socket and contend for its receive
45# queue, which costs more than it returns. See the TUNING section of
46# opentracker.conf(5); tests/udp_scaling.py sweeps the setting on the
47# machine that will carry the traffic.
48#
49# A count of 0 answers udp from the event loop, in the thread that also
50# serves tcp, which is what opentracker did before.
51#
40# Note, that using 0.0.0.0 for udp sockets may yield surprising results. 52# Note, that using 0.0.0.0 for udp sockets may yield surprising results.
41# An answer packet sent on that socket will not necessarily have the 53# An answer packet sent on that socket will not necessarily have the
42# source address that the requesting client may expect, but any address 54# source address that the requesting client may expect, but any address
diff --git a/ot_config.c b/ot_config.c
index ee6bc12..a0dbef1 100644
--- a/ot_config.c
+++ b/ot_config.c
@@ -32,7 +32,7 @@ const char *g_statefile;
32static ot_listen *g_listen; 32static ot_listen *g_listen;
33static size_t g_listen_count; 33static size_t g_listen_count;
34static int g_listen_shared; 34static int g_listen_shared;
35static int g_listen_workers; 35static int g_listen_workers = 1;
36 36
37static void panic(const char *routine) __attribute__((noreturn)); 37static void panic(const char *routine) __attribute__((noreturn));
38static void panic(const char *routine) { 38static void panic(const char *routine) {