Skip to content

Conversation

@kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Feb 2, 2026

Summary

  • Allow listen_port to accept either a single port (8443) or a range string ("8443-8543") to bind multiple TCP listeners
  • Round-robin poll across all listeners to avoid starving any port
  • Remove single-port port field from HostInfo proto (no longer meaningful with port ranges)
  • Use {e:#} for cleaner connection error logs

Context

Under high concurrency (>60K connections per port), a single listen port can exhaust its accept queue or cause kernel-level backlog issues. Binding multiple ports distributes incoming connections across more kernel data structures.

Load testing confirmed: 20 ports handled 200K concurrent TLS connections at 100% success rate.

Config example

# Single port (backwards compatible)
listen_port = 8443

# Port range
listen_port = "8443-8462"

Test results

  • Deployed to gateway CVM with listen_port = "14100-14110"
  • Gateway bound all 11 ports (14100-14110), confirmed via /proc/net/tcp
  • TCP connections to non-default ports (e.g., 14105) succeed from host
  • Backwards-compatible single port config continues to work

Allow listen_port to accept either a single port (8443) or a range
string ("8443-8543") to bind multiple TCP listeners, avoiding
ephemeral port exhaustion under high connection counts.

Also removes the single-port field from HostInfo proto since
listen_port is now a range, and uses {e:#} for cleaner error logs.
@kvinwang kvinwang force-pushed the feat/gateway-multiport branch from 276476e to b325c0f Compare February 2, 2026 07:48
@kvinwang kvinwang merged commit 82f72ef into master Feb 2, 2026
11 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.

2 participants