headscale/hscontrol/mapper
Kristoffer Dalby 3ebe4d99c1 mapper/batcher: reduce lock contention with two-phase send
Rewrite multiChannelNodeConn.send() to use a two-phase approach:
1. RLock: snapshot connections slice (cheap pointer copy)
2. Unlock: send to all connections (50ms timeouts happen here)
3. Lock: remove failed connections by pointer identity

Previously, send() held the write lock for the entire duration of
sending to all connections. With N stale connections each timing out
at 50ms, this blocked addConnection/removeConnection for N*50ms.
The two-phase approach holds the lock only for O(N) pointer
operations, not for N*50ms I/O waits.
2026-03-14 02:52:28 -07:00
..
batcher.go mapper/batcher: restructure internals for correctness 2026-03-14 02:52:28 -07:00
batcher_bench_test.go mapper/batcher: restructure internals for correctness 2026-03-14 02:52:28 -07:00
batcher_concurrency_test.go mapper/batcher: reduce lock contention with two-phase send 2026-03-14 02:52:28 -07:00
batcher_lockfree.go mapper/batcher: reduce lock contention with two-phase send 2026-03-14 02:52:28 -07:00
batcher_test.go mapper/batcher: restructure internals for correctness 2026-03-14 02:52:28 -07:00
batcher_unit_test.go mapper/batcher: add unit tests and benchmarks 2026-03-14 02:52:28 -07:00
builder.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
builder_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
mapper.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
mapper_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
tail_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00