Skip to content

atunnel benchmark measures 100,000 idle egress connections - #3072

Merged
Bowei Du (bowei) merged 2 commits into
agent-substrate:mainfrom
chuangw6:atunnel-bench-100k
Oct 21, 2026
Merged

Bowei Du (bowei) merged 2 commits into
agent-substrate:mainfrom
chuangw6:atunnel-bench-100k

Conversation

@chuangw6

@chuangw6 Chuang Wang (chuangw6) commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

EgressIdleConns couldn't get past 64,512 connections. All of them came
from the egress actor in one sandbox, and atunnel's redirect sends every
connection to the same listener, so only the source port tells them
apart. That's a per-actor limit, not a per-worker one.

The worker now runs an egress actor in every sandbox, and EgressIdleConns
splits its connections across them. The other egress scenarios still use
actor-0's, so their numbers stay comparable with earlier runs.

Also adds a 100k run, with atunnel at 4 CPUs / 16 GiB so neither limit
is reached:

idle connections per connection (after GC) goroutines/conn atunnel cgroup memory CPU opening 200 conns/s
25,000 26.9 KiB 4.0 1.3 GiB 0.15 cores
50,000 27.1 KiB 4.0 2.6 GiB 0.14 cores
100,000 26.8 KiB 4.0 5.2 GiB 0.19 cores

Memory per connection stays flat. Before #2908 it was about 157 KiB. The
CPU is what opening new connections costs (about 1 ms each); holding the
idle ones costs almost none.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

A sandbox has one address, and atunnel's redirect leaves only the
source port to tell its egress connections apart, so one sandbox can
hold at most about 64k of them. EgressIdleConns now splits its
connections across an egress actor in each sandbox, which lets it
reach 100,000. The other egress scenarios still use actor-0's.
EgressIdleConns at 25k, 50k and 100k connections with atunnel at 4 CPUs
and 16 GiB: about 27 KiB and 4 goroutines per idle connection, flat
across the three, with no limit reached.
@bowei

Copy link
Copy Markdown
Collaborator

This is a benchmark only change.

@bowei
Bowei Du (bowei) added this pull request to the merge queue Oct 21, 2026
Merged via the queue into agent-substrate:main with commit 52386bd Oct 21, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants