Skip to content

Network and timeouts

Last updated: 2026-11-27T02:00:32-03:00 (UTC-3)

How the gateway reaches providers: outbound proxy, private CA, mTLS, forced IPv4, connection pool, timeouts and the limit on concurrent inferences per instance. By default it connects directly to the provider with the system’s TLS trust; you configure only what you need.

The network block configures the global inference transport at boot. Optional per-provider profiles explicitly replace only CA/mTLS/proxy selection for that connection; global numeric limits remain inherited. It does not change the trust for OIDC, JWT, MCP or catalogs. logging.level controls structured JSON logs (info, warn, error); it does not enable payloads or credentials in logs.

The default profile connects directly to the provider, with the system’s TLS trust: it does not require an outbound proxy, a private CA, mTLS, forced IPv4 or a cloud service. To use one of these pieces, declare only the fields implemented in the YAML and provide the values/files referenced by the process environment/Secret. network.proxy_url_env selects the inference proxy; the application does not create this proxy, nor does it use it for the PostgreSQL, cache or IdP connection. The database proxy, remote cache and OIDC discovery have their own contracts.

Configuration chooses behavior and references; the deployment mounts files and injects variables, and the operator provisions the network, DNS, certificates and external services. Docker, Kubernetes, binary and NPX do not change this separation. Switching to a hosted endpoint does not add implicit network options or convert the provider’s protocol.

Field Default Limits / effect
network.request_timeout 120s 100ms–30m; deadline for buffered operations and legacy streams, including target queue, allowed attempts and consumption. Opt-in stream clocks are separate.
network.stream_first_byte_timeout / network.stream_idle_timeout / network.stream_max_duration / network.client_write_stall_timeout 60s / 120s / 30m / 60s Active only with stream_timeouts; individual bounds, overrides and runtime editor in stream timeouts.
network.response_header_timeout 30s 10ms–5m; wait for headers per attempt, separate from the total deadline
network.connect_timeout 10s 10ms–1m; connection dial
network.tls_handshake_timeout 10s 10ms–1m; TLS handshake
network.idle_connection_timeout 90s 1s–30m; idle connection in the pool, not the interval between SSE events
network.max_idle_connections 1024 1–10000 when set; zero uses the default
network.max_idle_connections_per_host 256 1–total when set; zero uses the default. With an HTTP/1.1 provider, each concurrent stream above this number opens a new connection (and TLS handshake) and closes it when done
network.max_connections_per_host 0 0–10000; per-transport/host connection ceiling, including dialing, active and idle connections. Zero adds no ceiling; the base file selects 512. A finite limit can queue dials under the request context; it is separate from request/relay admission. See the applied-limit contract below.
network.force_ipv4 false Explicit IPv4 TCP dial; does not change the provider’s protocol
network.max_inflight_requests 512 1–100000; inference requests admitted at the same time per instance, adding up chat, Gemini and operations. Waiting requests are admitted in arrival order. An internal call made for a request that holds a slot (moderation guardrail, auto-route embedding, semantic fallback) runs under that slot; batches and evals take their own
network.max_buffered_request_mib 256 in legacy mode; automatic with relay admission 0 selects automatic/default sizing; explicit 8–65536. Logical wire-body reservation held through completion, including after relay handoff; chunked input reserves the route maximum.
network.max_relay_streams auto 0 for automatic sizing or explicit 1–100000. Counts detached relays only. A full room retains the generation slot; this is not a total open-stream cap.
network.max_relay_buffer_mib auto 0 for automatic sizing or explicit 16–65536. Logical buffer room for detached relays.
network.admission_memory_percent 50 0/omission uses 50; explicit 1–100. Fraction of a detected memory limit available to automatic admission budgets.
network.stream_reservation_kib 80 0/omission uses 80; explicit 80–65536. Nominal per-relay overhead, with translator/observer reservations added separately.
network.max_request_body_mib 0 0 keeps the route defaults (1 MiB chat, 8 MiB other inference routes); explicit 1–64 MiB applies to every inference route, and models[].max_request_body_mib overrides it per alias. An explicit max_buffered_request_mib must be at least the largest limit. See request body limits. GET /api/v1/admin/config returns the configured value as infrastructure.network.max_request_body_mib (and client_keepalive_interval likewise) next to the applied limits in inference_http; the console shows both.
network.client_keepalive_interval empty (off) Empty or 0s for off, or 1s–5m. After that much silence on a streamed inference answer, the SSE comment : keepalive is written to the client between events, so a load balancer’s idle timeout does not cut a silent stream. See keepalive comments.
network.inflight_wait 2s 0s–30s; how long a request waits for a slot before 503 overloaded with Retry-After: 1. 0s refuses immediately
network.proxy_url_env absent Reference to a variable holding an HTTP(S) URL, with no path beyond /, query or fragment. Proxy authentication stays only in the environment
network.ca_file_env absent Variable with the path of a mounted PEM CA; adds trust on top of the system roots and keeps hostname verification
network.client_cert_file_env / network.client_key_file_env absent Variables with the paths of the PEM pair for mTLS; both are required

HTTP/2: HTTPS providers that advertise h2 (OpenAI, Anthropic, Azure, Gemini) are called over HTTP/2, with several streams per connection. Local http:// endpoints (llama.cpp, vLLM) stay on HTTP/1.1.

Files are regular files, limited to 1 MiB and read without blocking on a FIFO in the Unix profile. Symlinks from Kubernetes Secret volumes are accepted and the open descriptor is validated. On Windows the file and every directory above it must be protected from untrusted accounts, and a link as the last component is refused (mounted files on Windows); the Windows runtime certification is still pending. Other operating systems refuse mounted certificates. Errors print neither the content nor the Secret’s path.

The alias accepts models[].request_timeout, with the same range of 100 ms to 30 min. When absent, it inherits the global policy. Editing goes through the existing models API/UI, full validation, optimistic versioning and audit. The client’s deadline always wins when it ends first. Ending SSE does not repeat the call or invent a termination/usage; incomplete proofs and reservations stay unknown as their contract defines.

request_timeout is one budget for the whole operation. When an alias has two targets and the first one hangs, that budget is spent waiting for it, and the second target, which would have answered, is never called. The attempt timeout bounds each attempt instead, so a hung target hands over while there is still time. Flag: attempt_timeouts (off by default).

features:
attempt_timeouts: true
models:
- id: chat-default
request_timeout: 120s # the whole operation, every attempt included
attempt_timeout: 20s # each attempt, until the provider starts answering
targets:
- {provider: primary, model: gpt-5-mini}
- {provider: secondary, model: gpt-5-mini}
Parameter Default Accepted values When it applies
features.attempt_timeouts false true, false Next request (runtime flag, Settings → Features)
models[].attempt_timeout empty: off 100ms to 30m, and below the alias’s effective request_timeout (parameter catalogue V27) Next request after the model is saved
  • What it measures. From the moment an attempt is sent until the provider’s response headers arrive. A buffered answer is produced before its headers, so this is the whole wait for a buffered call. For a stream it is the wait for the stream to open.
  • What happens when it fires. The attempt ends. The next target of the alias is tried, when there is one and the total deadline has time left; otherwise the client gets 504. The same target is not tried again: a provider that did not answer in time may still be working on the request, and a second copy could be billed twice. This is the rule the stream clocks already follow.
  • What it never does. It never cuts an answer that has started. Once headers arrive, a buffered answer is read under the total deadline and a stream under the stream clocks. It never extends anything: the total deadline, network.response_header_timeout and the client’s X-Gateway-Timeout-Ms still end the operation when they come first.
  • Where it applies. Every provider attempt of the alias on Chat Completions, Messages, Responses, GenerateContent and the other operations that route through the alias’s targets. Another alias called for the same request (a semantic fallback, a guardrail judge, a cache embedding) uses its own attempt_timeout, or none; it never inherits this one.
  • Relation to network.response_header_timeout. That setting is one value for every provider, applied by the connection (default 30s). attempt_timeout is per alias and can only be the stricter of the two: a value above response_header_timeout never fires, because the connection gives up first. Raise response_header_timeout for slow models and set attempt_timeout on the aliases that should hand over sooner.
  • Without a second target it still shortens the wait to a 504, which a client’s own retry can use.

Logs. The attempt that timed out is logged as upstream transport failure with the cause gateway attempt timeout after 20s, next to its upstream_attempt record (status 504), and its stored span carries timeout_kind: attempt. When that attempt was the last one and the client got the 504, the request itself is recorded with timeout_kind: attempt (request log, Timeout column, usage export, alert rules), so these requests can be filtered. A request that a later target answered is not a timed-out request and records none.

Console and API. Model catalog → Edit routing → Attempt timeout, shown when the flag is on or a value is stored; PUT /api/v1/admin/models/{id} takes attempt_timeout with the same validation. With the flag off a stored value is kept, validated and inactive.

Upgrade. Nothing changes until the flag is on and an alias sets a value. Before rolling back to an older binary, remove attempt_timeout from the YAML, because its strict parser refuses the field.

The deadline starts when the upstream operation is admitted, after authentication/preparation and reading the input; it is not a deadline for the whole listener nor an upload budget. HTTP input and asynchronous video jobs have their own controls. The ordinary total deadline includes consuming buffered responses and legacy streams. With stream_timeouts enabled, four separate stream clocks replace it for streaming operations. Their runtime override is separate from the read-only boot admission limits.

Open Settings & sources → Infrastructure → Upstream network → Inspect startup settings to inspect nine existing startup settings without editing them. GET /api/v1/admin/config exposes the same infrastructure.network_settings rows when boot_settings_view and configuration-read permissions allow it. Each row has its captured value, field default, source and rollout requirement. Hiding this view never disables network enforcement. The older infrastructure summary and the separate connection-ceiling rows remain available under their existing contracts.

The inspector distinguishes two policies from seven construction options:

  • Default operation timeout (request_timeout) is the global default used by buffered operations and legacy streams. A model timeout, an inherited deadline, an allowed client timeout header or enabled independent stream clocks can produce a different effective limit. This row does not describe every request or http.Client.Timeout.
  • Admission queue wait (inflight_wait) is the wait installed in the inference gate. Zero means fail fast when room is unavailable, independently of the later operation clock.
  • Transport construction options are response_header_timeout, connect_timeout, tls_handshake_timeout, idle_connection_timeout, max_idle_connections, max_idle_connections_per_host and force_ipv4. Normal and forced-HTTP/1 clients retain separate transports with the same selected settings. These are startup policies, not a health check, negotiated protocol or live connection count.

Go’s transport separates waiting for response headers after sending the request from reading its body, TLS establishment and keepalive reuse. Idle connection expiry is separate from SSE inactivity. The two idle counts bound reuse, rather than active inference or detached relay admission. Dialer timeout bounds establishing the gateway’s connection; other deadlines can end it earlier. IPv4 forcing selects the gateway’s own TCP dial, including the first hop to a configured proxy; it does not certify the proxy’s eventual upstream address family. False permits ordinary selection and does not force IPv6.

The parameter table above remains the default/bounds reference. Omitted, null or empty durations select Default; a nonempty explicit duration, including the default itself or valid queue wait 0s, has source YAML. Idle-count zero selects the existing normalized default (1024 total / 256 per host) with YAML source when explicitly declared. Explicit force_ipv4: false also has YAML source. These nine fields have no direct environment override. Values can use equivalent canonical Go duration notation, such as 2m0s for a 2m default.

The gateway records scalar facts where the owned transports, dialer and admission gate are constructed, then captures them before the first control refresh. Startup config_applied.network_settings uses the same safe rows in structured logs/OTLP. Later model/clock/flag edits preserve this startup snapshot; they do not resize or rebuild the transport. An unknown, uncaptured, failed or inconsistent factory reports Unavailable with null value/source, preserving field defaults. Endpoints, hostnames, credentials, certificate paths and environment-variable names are excluded.

The inspector is read-only and requires a rollout for changes. When an existing refresh or API response reports loss of access or a disabled view, the dialog and old snapshot are removed. An authorized refresh does not reopen it automatically. This uses the current refresh model; it adds no polling, push notification, provider probe or instantaneous revocation detection. Close/Escape restores focus to the trigger when it remains available, and the dialog scrolls within the viewport on narrow screens.

Settings & sources → Infrastructure and GET /api/v1/admin/config expose infrastructure.pool_settings when boot_settings_view and the existing configuration-read permission allow it. The three read-only rows are the HTTP per-host ceiling and PostgreSQL maximum/minimum, with defaults, captured source and restart requirement. Disabling the view hides these rows; it never changes connection limits or grants a permission. Unknown or unopened captures are Unavailable, not inferred from configuration or a live connection count.

For network.max_connections_per_host, omission and explicit zero both apply zero; an explicit YAML zero still has source YAML. The base file explicitly selects 512, so a process using it reports 512 · YAML, not an automatically calculated default. Default in the metadata describes the field default (zero), separately from the applied value. Startup captures the actual normal and forced-HTTP/1 transport options once; an unrecognized or inconsistent factory cannot claim an applied value. Configuration refreshes preserve this capture.

The ceiling counts dialing, active and idle connections per transport and host, as defined by Go HTTP transport. Normal negotiated HTTP/2 and forced HTTP/1 use separate transports. HTTP/2 can multiplex requests over a connection; this setting is not a global request, stream, provider or tenant limit. A finite ceiling can queue a dial until a connection is available or the request context ends. Zero means No extra connection ceiling; request admission, deadlines and relay accounting still apply. No CPU or memory formula changes this zero into 512.

For PostgreSQL defaults, explicit zero, DSN precedence and per-replica sizing, see the pool contract. These are startup controls: edit YAML, validate and roll out. There is no hot pool writer, new feature switch or database migration in this presentation change. Hostnames, endpoints, DSNs, environment-variable names and credentials are absent from the new rows.

Enable the boot flag stream_admission to let an admitted stream move into separately reserved relay room and release its generation slot. Its input-body reservation stays until the operation ends. If relay room is full, the stream keeps its generation slot; it is neither rejected nor replayed for that reason. The combined open-stream population can include both detached relays and generation-held streams.

The flag defaults to false. Disabled mode preserves the existing slot/body lifecycle; new unused infrastructure fields are null and the console shows Disabled. GET /api/v1/admin/config and Settings & sources → Infrastructure expose the actual applied boot values, origin and restart requirement. These startup settings are read-only under the boot-setting exception; there is no pending-restart settings writer in this integration. Flag changes use the existing Rollout behavior and runtime writes return 422.

For a detected memory limit, automatic budgets use admission_memory_percent, rounded down to whole MiB. The fully automatic share must fit 8 MiB input plus 16 MiB relay, or startup fails before listening. With both budgets automatic, body allocation uses half the share, capped at 256 MiB, while reserving the relay floor; relay gets the remainder. A 24 MiB share therefore yields 8+16 MiB. Explicit budgets win, with visible diagnostics when they exceed the share. Without a detected limit, fallback budgets are 256 MiB each and the relay count starts at 2048 before pool constraints.

Automatic relay count respects finite connection-pool headroom. Zero spare room means zero detached capacity and generation-slot fallback; it does not disable inference. The shipped pool remains 512. An opt-in profile can choose 2560 for 512 generation slots and up to 2048 detached relays. HTTP/2 multiplexing and explicit operator choices differ from an HTTP/1.1 connection ceiling; inspect the actual provider profile.

Automatic GC and admission share the same startup cgroup observation, including tighter visible ancestors. Later resource changes require a process restart to resize admission. Unsupported or hidden topology is not inferred. CPU-aware Go scheduling does not automatically resize generation slots or transport/database pools.

Sources are yaml, derived or default; Derived can reflect pool constraints as well as memory. A detected-memory value of 0 means no cgroup limit was detected. Unknown or missing active values in the console show Unavailable. The body and relay budgets account for logical retained buffers and nominal overhead. They are not total RSS limits or a replacement for Kubernetes/Docker memory limits and runtime GC controls. Size generation slots separately for the largest native/translated frame and provider profile; generation-held buffers are not detached relay room. The default 512 slots and nominal 80 KiB reservation are not universal capacity guarantees.

features:
stream_admission: true
network:
max_inflight_requests: 512
max_connections_per_host: 2560
max_buffered_request_mib: 0
max_relay_streams: 0
max_relay_buffer_mib: 0
admission_memory_percent: 50
stream_reservation_kib: 80

The six existing admission inputs share their actual defaults, validation bounds and console constraints through the parameter registry. This consolidation preserves the table and formulas above. The six admission descriptors record raw policy default 0, a separate positive fallback and the documented zero behavior. The table above describes selected defaults or automatic sizing, so its values are not replaced by six effective zero limits. A definition describes the configured input; it is not a live applied capacity. Raw zero selects automatic/default behavior where documented, whereas an applied relay count of zero can result from connection-pool headroom. Explicit positive choices keep their existing YAML source and continue to win over automatic sizing.

The Infrastructure summary preserves its separate effective values, sources, disabled/null relay fields and rollout requirement. Metadata does not reconfigure an admitted request or stream, grant permission, probe the service or resize a pool. The separate nine-row startup-network inspector and three pool rows retain their own families. No new flag, environment override, tuning parameter or hot writer is introduced.

network:
request_timeout: 120s
response_header_timeout: 30s
connect_timeout: 10s
tls_handshake_timeout: 10s
idle_connection_timeout: 90s
max_idle_connections: 1024
max_idle_connections_per_host: 256
max_connections_per_host: 512
force_ipv4: false
max_inflight_requests: 512
max_buffered_request_mib: 256
inflight_wait: 2s
# proxy_url_env: GATEWAY_OUTBOUND_PROXY
# ca_file_env: GATEWAY_UPSTREAM_CA_FILE
# client_cert_file_env: GATEWAY_UPSTREAM_CERT_FILE
# client_key_file_env: GATEWAY_UPSTREAM_KEY_FILE
logging:
level: info

These are deployment options, not trust that a user session can redefine. The global administrative API exposes only an allowlisted summary in infrastructure; Settings & sources shows safe values and whether a rollout is needed. Host, URL, variable names and paths do not appear in that summary. Team roles do not receive the global inventory.

  1. Review the model/stream: adjust the total deadline and the orchestrator’s shutdown/grace time to allow draining. Increasing the alias timeout does not automatically increase those times.
  2. Mount the CA/mTLS pair read-only; use gateway.existingTrustSecret in Helm or the deploy/profiles/external-infrastructure component in Kustomize. Configure the paths under /var/run/gateway/trust in the environment Secret.
  3. Run /gateway validate with the same references as the runtime. Boot also validates the transport; there is no fallback to insecure TLS if the material is invalid.
  4. Check the applied admission mode, sources, pool headroom and memory diagnostics; distinguish detached relay counts from total streams. Roll out and test an authorized route, correlation and error/stream in the target environment. The outbound proxy applies only to inference; do not assume the IdP or the Collector use that connection.
  5. On a CA/hostname error, review the certificate’s issuer, SAN and validity; do not turn verification off. On a timeout, distinguish connection, headers, client deadline and operation before raising limits.
  6. Rollback: restore the YAML and the previous version of the Secret and roll out. Rotating a file does not reload the transport in processes that have already started. A proxy with credentials can observe traffic depending on its transport mode; its origin is trusted by the operator.

Go runtime settings control GC pacing and a soft Go-managed-memory limit. They do not resize admission, generation slots, body/relay reservations or connection pools. A detected cgroup limit is an input to each separate policy, not a promise that either logical admission accounting or Go’s soft limit caps RSS. Inspect each applied source independently.

m7gtwcontact@m7gtw.com