Skip to content

Add a high-latency server preset - #5

Merged
TaJirax merged 1 commit into
mainfrom
server-high-latency-preset
Aug 4, 2026
Merged

Add a high-latency server preset#5
TaJirax merged 1 commit into
mainfrom
server-high-latency-preset

Conversation

@TaJirax

@TaJirax TaJirax commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • adds a server-only high-latency preset, with high_latency, highlatency, latency, and mobile accepted as aliases
  • applyServerConfigPreset now validates against the server preset set, which already existed but was unused — it was checking the client list
  • ships server_config.high-latency.toml alongside the other preset files

Why

Neither existing preset addresses round trip time. speed shortens the retransmit timeout to 0.5s, and survival leaves it at the 0.6s default while concentrating on FEC. On a mobile carrier with a 400ms base RTT and 100ms of jitter, both resend packets whose ACKs are still in flight; the duplicates add the delay that expires the next timer, and the tunnel degrades toward a standstill while reporting no loss at all. A 1000 packet window also cannot keep such a path full.

An operator running against Hamrahe Avval had already hand tuned a server for this, with # RTO tuned for 400ms base RTT + 100ms jitter and # NACK delays tuned for high latency (was 0.05s / 0.2s — WAY too aggressive) in their config. This preset is those findings, so the next operator does not have to rediscover them.

Values

Key Default Preset
ARQ_INITIAL_RTO_SECONDS 0.6 1.0
ARQ_MAX_RTO_SECONDS 3.0 4.0
ARQ_DATA_NACK_INITIAL_DELAY_SECONDS 0.4 0.3
ARQ_DATA_NACK_REPEAT_SECONDS 0.8 0.8
ARQ_DATA_NACK_MAX_GAP 64 64
ARQ_WINDOW_SIZE 1000 4096
MAX_PACKETS_PER_BATCH 10 32
MAX_DNS_RESPONSE_BYTES 32768 65535
UDP_READERS / DNS_REQUEST_WORKERS cpu derived 16 / 16
MAX_CONCURRENT_REQUESTS 16384 32768
MAX_INGRESS_QUEUE_BYTES 64 MB 128 MB
SOCKET_BUFFER_SIZE default 32 MB
DEFERRED_SESSION_WORKERS / _QUEUE_LIMIT 8 / 4096 16 / 16384

SESSION_TIMEOUT_SECONDS is deliberately not raised, even though the deployed config sets it to 1200. Holding abandoned sessions four times longer in a fixed size table is what makes a client that reconnects mid stall meet SESSION_BUSY and reconnect again.

Validation

  • new test covers the applied values, that an explicit operator key still wins, that the aliases normalize, and that clients are not offered a server-only preset
  • go build ./..., go vet ./..., and go test ./... pass

🤖 Generated with Claude Code

Neither existing preset addresses round trip time. "speed" shortens the
retransmit timeout to 0.5s and "survival" leaves it at the 0.6s default while
concentrating on FEC, so on a mobile carrier with a 400ms base RTT and 100ms
of jitter the server resends packets whose ACKs are still in flight. The
duplicates add the delay that expires the next timer, and a 1000 packet window
cannot keep such a path full in the first place.

The values come from a deployed Hamrahe Avval server that was hand tuned
against exactly this before a preset existed: a 1.0s initial and 4.0s maximum
RTO, NACK delays that wait for the reordering window, a 4096 packet window,
32 packet batches, and ingress sized for the requests a long path keeps in
flight. SESSION_TIMEOUT_SECONDS is deliberately not raised, because holding
abandoned sessions in a fixed size table is what makes a reconnecting client
meet SESSION_BUSY and reconnect again.

The preset is server-only; applyServerConfigPreset now validates against the
server set, which it already had but did not use.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@TaJirax
TaJirax merged commit b8b8c7e into main Aug 4, 2026
12 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.

1 participant