diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-31 15:59:41 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-31 15:59:41 +0100 |
| commit | 4d030871c004c917458b5e1c296edcfc689a2e66 (patch) | |
| tree | c6c057e47a17d8b03ea28a611ff029d950acfa8c /man4/opentracker.conf.4 | |
| parent | 440cfeee71829308fa1cc9b5aef63beb7ab756dc (diff) | |
Make tcp worker multithreaded, too
This shamelessly steals the model established in the UDP workers, i.e.
if the kernel is able to bind multiple listening sockets to the same
endpoint, we will share them across threads. If it can't, all threads
will accept on the same socket.
The fast path handles most of the connections, only the rare case of
no data yet on the socket is offloaded to the slow path (which used to
be the mainloop) for completion. This scales nicely, as the higher the
load is, the higher chances are that an accept happens only after the
network roundtrip to the peer completes, leading to more connections
that already have data waiting for us.
We also consolidate the workstruct init and deinit code, preparation
for later unifying all thread state structs for all protocols (mca,
udc and tcp).
The config file gains a per tcp connection worker count and some docs
explaining what this knob buys and costs, nudging the user to either
keep it 0 or dial it up to at least 2.
Diffstat (limited to 'man4/opentracker.conf.4')
| -rw-r--r-- | man4/opentracker.conf.4 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/man4/opentracker.conf.4 b/man4/opentracker.conf.4 index aa82e1d..1bd1c7a 100644 --- a/man4/opentracker.conf.4 +++ b/man4/opentracker.conf.4 | |||
| @@ -42,6 +42,14 @@ in the thread that also serves TCP. See | |||
| 42 | .Sx TUNING | 42 | .Sx TUNING |
| 43 | before raising it. | 43 | before raising it. |
| 44 | .Pp | 44 | .Pp |
| 45 | .It listen.tcp.workers Ar threads | ||
| 46 | Specifies how many threads accept and answer HTTP connections, for every | ||
| 47 | listen statement that does not carry a | ||
| 48 | .Cm workers | ||
| 49 | option of its own. Defaults to 0, which serves them from the event loop. See | ||
| 50 | .Sx TUNING | ||
| 51 | before raising it. | ||
| 52 | .Pp | ||
| 45 | .It listen.shared Ar boolean | 53 | .It listen.shared Ar boolean |
| 46 | Permits another process to bind the same address, for every listen statement | 54 | Permits another process to bind the same address, for every listen statement |
| 47 | that does not carry a | 55 | that does not carry a |
| @@ -101,6 +109,14 @@ group only where the answer is yes. | |||
| 101 | in the source distribution sweeps the setting against a running tracker. | 109 | in the source distribution sweeps the setting against a running tracker. |
| 102 | Measure on the machine that will carry the traffic. | 110 | Measure on the machine that will carry the traffic. |
| 103 | .Pp | 111 | .Pp |
| 112 | A TCP worker accepts a connection and answers it on its own stack, without | ||
| 113 | the event loop seeing it at all; only a connection it cannot finish is handed | ||
| 114 | over. One worker serves less than none, because accepting leaves the event | ||
| 115 | loop's thread without anything gained in return, so the setting is worth | ||
| 116 | either 0 or at least 2. | ||
| 117 | .Pa tests/http_load.c | ||
| 118 | in the source distribution drives the tracker over HTTP to measure it. | ||
| 119 | .Pp | ||
| 104 | On FreeBSD the | 120 | On FreeBSD the |
| 105 | .Xr accf_data 9 | 121 | .Xr accf_data 9 |
| 106 | filter has the kernel hold a new connection until data arrives on it, so the | 122 | filter has the kernel hold a new connection until data arrives on it, so the |
