1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-10-19 11:15:48 +02:00
juanfont.headscale/hscontrol
Kristoffer Dalby b6d5788231 mapper: produce map before poll
Before this patch, we would send a message to each "node stream"
that there is an update that needs to be turned into a mapresponse
and sent to a node.

Producing the mapresponse is a "costly" afair which means that while
a node was producing one, it might start blocking and creating full
queues from the poller and all the way up to where updates where sent.

This could cause updates to time out and being dropped as a bad node
going away or spending too time processing would cause all the other
nodes to not get any updates.

In addition, it contributed to "uncontrolled parallel processing" by
potentially doing too many expensive operations at the same time:

Each node stream is essentially a channel, meaning that if you have 30
nodes, we will try to process 30 map requests at the same time. If you
have 8 cpu cores, that will saturate all the cores immediately and cause
a lot of wasted switching between the processing.

Now, all the maps are processed by workers in the mapper, and the number
of workers are controlable. These would now be recommended to be a bit
less than number of CPU cores, allowing us to process them as fast as we
can, and then send them to the poll.

When the poll recieved the map, it is only responsible for taking it and
sending it to the node.

This might not directly improve the performance of Headscale, but it will
likely make the performance a lot more consistent. And I would argue the
design is a lot easier to reason about.

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2025-09-09 09:40:00 +02:00
..
assets update flake, fix prettier lint 2023-09-05 08:47:43 +02:00
capver mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
db Refactor to use reflect.TypeFor 2025-08-23 20:43:49 +02:00
derp chore(derp): allow nil regions in DERPMaps 2025-08-23 06:54:14 +02:00
dns integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00
mapper mapper: produce map before poll 2025-09-09 09:40:00 +02:00
policy fix: allow all traffic if acls field is omited from the policy 2025-08-18 16:13:14 +02:00
routes Fix typos 2025-07-21 12:06:07 +02:00
state derp: increase update frequency and harden on failures (#2741) 2025-08-22 10:40:38 +02:00
templates integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00
types derp: increase update frequency and harden on failures (#2741) 2025-08-22 10:40:38 +02:00
util mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
app.go derp: increase update frequency and harden on failures (#2741) 2025-08-22 10:40:38 +02:00
auth.go Log registrationID to simplify interactive node registration 2025-08-15 17:11:38 +02:00
debug.go bunch of qol (#2748) 2025-08-27 17:09:13 +02:00
grpcv1_test.go rename package name to hscontrol 2023-05-10 20:47:51 +02:00
grpcv1.go mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
handlers.go Fix Internal server error on /verify (#2735) 2025-08-18 14:39:42 +00:00
metrics.go integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00
noise.go mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
oidc.go OIDC: Query userinfo endpoint before verifying user 2025-08-11 17:51:16 +02:00
platform_config.go Return better web errors to the user (#2398) 2025-02-01 15:25:18 +01:00
poll.go mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
suite_test.go Redo OIDC configuration (#2020) 2024-10-02 14:50:17 +02:00
tailsql.go integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00