Skip to main content

Module http

Module http 

Source
Expand description

Shared HTTP client tunings.

Every exchange client (Polymarket, Kalshi, Opinion, and any future addition) should build its reqwest::Client via tuned_client_builder(). Centralising the tunings here means one edit rolls out to every exchange — we don’t want performance fixes to drift across three independent builders.

Flags applied:

  • http2_adaptive_window(true)
  • http2_initial_stream_window_size(512 KB) — empirically optimal for the ~480 KB /simplified-markets response class.
  • tcp_nodelay(true) — disable Nagle’s. Right call for HTTP/2.
  • pool_max_idle_per_host(10) — deep enough for burst patterns.
  • http2_keep_alive_interval(15s) — keeps the HTTP/2 connection hot across bursty call patterns.
  • no_proxy() — skip the slow OS proxy lookup.

Exchange-specific settings (.timeout(…), .user_agent(…), .connector(…)) layer on top of the returned builder.

Constants§

HTTP2_INITIAL_STREAM_WINDOW_BYTES
HTTP2_KEEP_ALIVE_INTERVAL
POOL_MAX_IDLE_PER_HOST