Skip to content

v2.2.0

Choose a tag to compare

@dancixx dancixx released this 28 Sep 21:42
· 35 commits to main since this release
c847bba

Tako 2.2.0 removes two sources of cross-thread contention from the HTTP/1 request path and balances per-thread connections across workers. Measured side by side on the same Linux container, the default server's hello-world throughput at 1,000 connections rose from about 670k to 1.07M requests per second; the refreshed benchmarks show it keeping pace with Axum at 100 connections and ahead of it at 1,000, with the per-thread server within a few percent of Actix Web and ntex.

This release includes one breaking API change. Read the 2.2 migration guide before upgrading from 2.1.x. All eight workspace crates are versioned together at 2.2.0 and require Rust 1.95 or newer.

Breaking changes and migration

  • PerThreadConfig has a new balance_connections field, true by default. Struct literals that list every field need the new field or ..PerThreadConfig::default().

Added

  • Per-thread connection balancing. A Tokio per-thread worker that accepts a connection while it serves more live connections than the least busy worker hands the socket to that worker. This evens out the hash-based SO_REUSEPORT spread on Linux and lets every worker serve traffic on macOS, where the kernel sends each connection to one listener. Set balance_connections: false to keep kernel-only distribution; the Compio flavour does not balance.

Fixed and improved

  • The Tokio HTTP/1 servers (plain, TLS, Unix, vsock, PROXY protocol, and per-thread workers) reuse one header-read timer per connection instead of registering a Tokio timer for every request. Under high concurrency this removes contention on Tokio's time driver, which had capped the multi-threaded server well below Axum. header_read_timeout keeps its meaning.
  • Requests no longer update reference counts that every worker thread shares: connections hold their own router handle, dispatch borrows the matched route, MatchedPath values come from per-thread copies of the route template, and per-thread workers watch a per-worker shutdown token.
  • The benchmarks page and README section were rebuilt around a Linux methodology with charts, latency percentiles, and working reproduction commands. The README quickstart and doctest dependency handling were also fixed since 2.1.0.

Full diff: v2.1.0...v2.2.0