#26487·vector

Allow configuring the TCP listen backlog for server sources (currently fixed at 128 via tokio/mio)

Author: ronnocolCreated Sep 25, 2026Updated Sep 25, 2026

A note for the community

  • Please vote on this issue by adding a reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • AI Transparency: Opus 5.5 was used for this investigation and code review.

Use Cases

We run splunk_hec as the ingest endpoint for telemetry from a large consumer-device fleet. Each host runs nginx (TLS + auth) in front of Vector and proxies to splunk_hec on 127.0.0.1 over a keepalive pool. Client traffic is synchronized to wall-clock boundaries (many devices report at the top of the hour and on a fixed interval after it), so load arrives as short bursts: in the minute after the hour, request rate roughly doubles for 60 s and then drops back.

During those bursts Vector's accept queue overflows. The listen backlog of every Vector TCP listener is 128, and there is no way to change it:

$ ss -ltn '( sport = :9099 or sport = :8088 )'
State  Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0      32768        0.0.0.0:8088      0.0.0.0:*     # nginx (backlog=32768)
LISTEN 0      128        127.0.0.1:9099      0.0.0.0:*     # Vector splunk_hec
$ cat /proc/sys/net/core/somaxconn
32768

A connection that arrives while the queue is full has its SYN dropped (net.ipv4.tcp_abort_on_overflow = 0); the client retransmits after 1 s, then 3 s, then 7 s. The end goal is to be able to size the accept queue for the burst, the way nginx (listen ... backlog=), HAProxy (backlog) and Go's net (which uses somaxconn) allow.

Measured on 6 hosts (4 vCPU arm64, Vector 0.58.0, Amazon Linux 2023, kernel 6.18), fleet totals per minute. TcpExtListenOverflows is host-wide; nginx's own listener has a 32768-deep queue and does not overflow, so these are Vector's. Connect times are nginx's $upstream_connect_time to Vector.

minute client req/s kernel ListenOverflows connects to Vector > 1 s connects 1.0-1.2 s connects 3.0-3.5 s 502 busiest host CPU
23:59 5,904 0 0 0 0 0 36%
00:01 15,610 65,014 56,319 (6.2% of proxied requests) 16,458 18,098 28 100%
00:02 9,208 0 0 0 0 0 80%
00:06 (interval wave) 11,342 32,879 11,443 (1.7%) 10,709 734 1 69%
00:07 5,977 0 0 0 0 0 37%

Over one 7.5-hour evening (the minute-level data above is its busiest boundary), the distribution of connect times to Vector shows the SYN-retransmit signature directly:

connect time connections
<= 5 ms 156,644,634
5-50 ms 12,365
50-250 ms 6,883
250-500 ms 3,896
0.5-1.0 s 8,899
1.0-1.2 s 91,863 (first SYN retransmit)
1.2-1.7 s 12,255
1.7-3.5 s 32,747 (second retransmit, ~3 s)
3.5-10 s 29,303 (third retransmit, ~7 s)

Each of those requests is delayed by 1-7 s at exactly the moment the host is busiest, and the ones that exceed the proxy's patience become client-visible errors (the 502s and 499s above). The accept loop falls behind because the host is CPU-bound during the burst (100% on the busiest host); a deeper queue lets the kernel hold the connections for the few hundred milliseconds it takes Vector to catch up instead of dropping them.

Attempted Solutions

  • Raising net.core.somaxconn / tcp_max_syn_backlog (both 32768): no effect. The kernel uses min(listen() argument, somaxconn), and the argument is 128.
  • A larger nginx upstream keepalive pool (1024 idle connections): reduces how many fresh connects a burst needs and was the biggest improvement, but a burst still opens more new connections than the pool holds.
  • More hosts: works linearly, but we are adding hosts to cover a kernel queue depth, not CPU or memory.

There is no Vector setting for this. The value comes from tokio's TcpListener::bind, which calls mio's TcpListener::bind, which hardcodes the backlog on Linux (mio 1.2.0, src/net/tcp/listener.rs):

rust
// Use the same backlog value as the standard libary.
let backlog = if cfg!(target_os = "horizon") { 20 } else if cfg!(target_os = "haiku") { 32 } else { 128 };
listen(&listener.inner, backlog)?;

Every production Vector TCP listener goes through MaybeTlsSettings::bind_reloadable in lib/vector-core/src/tls/incoming.rs (splunk_hec, http_server, socket in TCP mode, datadog_agent, aws_kinesis_firehose, opentelemetry HTTP/gRPC, the vector source, the prometheus_exporter and websocket_server sinks), and it calls TcpListener::bind(addr). The API gRPC server calls tokio::net::TcpListener::bind directly. Nothing sets a backlog, so all of them get 128.

Proposal

  1. In MaybeTlsSettings::bind_reloadable (lib/vector-core/src/tls/incoming.rs), create the listener with tokio::net::TcpSocket instead of TcpListener::bind: TcpSocket::new_v4() / new_v6() by address family, set_reuseaddr(true) (keeps mio's behaviour), bind(addr), then listen(backlog). listen returns the same tokio::net::TcpListener, so the rest of the function (TLS acceptor, keepalive, allowlist) is unchanged.

  2. Take the backlog as a parameter through a new bind_reloadable_with_backlog(addr, reloader, backlog: Option<u32>), with the existing bind_reloadable / bind passing None, so the ~12 existing call sites do not change.

  3. Expose it per source, starting with splunk_hec and http_server, as an optional setting, for example:

    yaml
    sources:
      hec_in:
        type: splunk_hec
        address: 127.0.0.1:9099
        listen_backlog: 4096   # default: unchanged (128), capped by net.core.somaxconn
  4. Separately, consider raising the default for None. 128 was the std default when Linux capped somaxconn at 128; Linux has defaulted somaxconn to 4096 since 5.4, and nginx's own default is 511. A default of 1024 or 4096 would remove the cliff for most users without any configuration.

References

Version

vector 0.58.0 (aarch64-unknown-linux-gnu 2bcad9b 2026-08-26 13:37:07.557544670)