Skip to content

[Rust] Add tokio-uring - HTTP/1.1#821

Merged
MDA2AV merged 3 commits into
mainfrom
add-tokio-uring
Jun 7, 2026
Merged

[Rust] Add tokio-uring - HTTP/1.1#821
MDA2AV merged 3 commits into
mainfrom
add-tokio-uring

Conversation

@MDA2AV
Copy link
Copy Markdown
Owner

@MDA2AV MDA2AV commented Jun 6, 2026

Description

A minimal HTTP/1.1 server on tokio-uring — the io_uring-backed Rust runtime with a completion/owned-buffer API — for the H1-isolated profiles (baseline, pipelined, limited-conn). No HTTP framework. Added as an engine-tier entry.

Serving model

One tokio_uring::start per core, each with its own SO_REUSEPORT listener (socket2 + from_std). Reads/writes use tokio-uring's owned-buffer model: a Vec<u8> is passed by value into read/write_all and handed back, reused across iterations. Responses are batched per read.

Hand-rolled HTTP/1.1

Request line + headers, Content-Length and Transfer-Encoding: chunked bodies, keep-alive, request pipelining, and fragmented-read reassembly. Shares the same parser as the tokio entry; only the I/O layer differs.

Endpoint Response
GET/POST /baseline11?a=&b= text/plaina + b (+ POST body as an integer)
GET /pipeline text/plainok

Tests

Subscribes to baseline, pipelined, limited-conn. Verified against the full contract — GET55, Content-Length POST75, chunked POST75, /pipelineok, 16× pipelining, keep-alive, and fragmented reads — natively and via the Docker build.

io_uring requires --security-opt seccomp=unconfined; engine: "io_uring" makes validate.sh enable it (the harness already runs benchmark containers unconfined).

Minimal HTTP/1.1 server on tokio-uring (the io_uring-backed runtime with
a completion/owned-buffer API) for the H1-isolated profiles (baseline,
pipelined, limited-conn). No HTTP framework: a hand-rolled request parser
(Content-Length + chunked bodies, keep-alive, pipelining, fragmented-read
reassembly) on tokio-uring's owned-buffer TcpStream, one runtime per core
with SO_REUSEPORT.

Endpoints: /baseline11?a=&b= -> a+b(+body) text/plain; /pipeline -> ok.
Validated against the baseline/pipelined contract natively and via the
Docker build.
@MDA2AV
Copy link
Copy Markdown
Owner Author

MDA2AV commented Jun 6, 2026

/benchmark -f tokio-uring --save

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

👋 /benchmark request received. A collaborator will review and approve the run.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

Benchmark Results

Framework: tokio-uring | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 3,418,714 6575.9% 45MiB NEW NEW
baseline 4096 3,602,450 6619.8% 170MiB NEW NEW
pipelined 512 46,374,713 6594.7% 45MiB NEW NEW
pipelined 4096 48,871,257 6569.8% 177MiB NEW NEW
limited-conn 512 2,237,040 5825.5% 94MiB NEW NEW
limited-conn 4096 2,639,285 6393.3% 174MiB NEW NEW
Full log
  Threads:   64
  Conns:     512 (8/thread)
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    215us    187us    360us    731us   2.04ms

  11185211 requests in 5.00s, 11185203 responses
  Throughput: 2.24M req/s
  Bandwidth:  140.77MB/s
  Status codes: 2xx=11185203, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11185166 / 11185203 responses (100.0%)
  Reconnects: 1118523
  Per-template: 3728367,3728385,3728414
  Per-template-ok: 3728367,3728385,3728414
[info] CPU 5825.5% | Mem 94MiB

[run 2/3]
gcannon v0.5.3
  Target:    localhost:8080/
  Threads:   64
  Conns:     512 (8/thread)
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    216us    187us    362us    738us   2.15ms

  11141349 requests in 5.00s, 11137205 responses
  Throughput: 2.23M req/s
  Bandwidth:  140.16MB/s
  Status codes: 2xx=11137205, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11137173 / 11137205 responses (100.0%)
  Reconnects: 1113717
  Per-template: 3712343,3712364,3712466
  Per-template-ok: 3712343,3712364,3712466
[info] CPU 5857.3% | Mem 94MiB

[run 3/3]
gcannon v0.5.3
  Target:    localhost:8080/
  Threads:   64
  Conns:     512 (8/thread)
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    217us    187us    363us    766us   2.24ms

  11074512 requests in 5.00s, 11074526 responses
  Throughput: 2.21M req/s
  Bandwidth:  139.38MB/s
  Status codes: 2xx=11074526, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11074506 / 11074526 responses (100.0%)
  Reconnects: 1107433
  Per-template: 3691467,3691359,3691680
  Per-template-ok: 3691467,3691359,3691680
[info] CPU 5684.0% | Mem 97MiB

=== Best: 2237040 req/s (CPU: 5825.5%, Mem: 94MiB) ===
[info] input BW: 172.81MB/s (avg template: 81 bytes)
[info] saved results/limited-conn/512/tokio-uring.json
httparena-bench-tokio-uring
httparena-bench-tokio-uring

==============================================
=== tokio-uring / limited-conn / 4096c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
gcannon v0.5.3
  Target:    localhost:8080/
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.53ms    568us    914us   21.20ms   26.10ms

  13129074 requests in 5.00s, 13129062 responses
  Throughput: 2.62M req/s
  Bandwidth:  165.21MB/s
  Status codes: 2xx=13129062, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 13129056 / 13129062 responses (100.0%)
  Reconnects: 1312309
  Per-template: 4376444,4376377,4376235
  Per-template-ok: 4376444,4376377,4376235
[info] CPU 6138.4% | Mem 135MiB

[run 2/3]
gcannon v0.5.3
  Target:    localhost:8080/
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.52ms    571us    910us   20.80ms   24.90ms

  13196591 requests in 5.00s, 13196427 responses
  Throughput: 2.64M req/s
  Bandwidth:  166.05MB/s
  Status codes: 2xx=13196427, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 13196337 / 13196427 responses (100.0%)
  Reconnects: 1319747
  Per-template: 4398867,4399129,4398341
  Per-template-ok: 4398867,4399129,4398341
[info] CPU 6393.3% | Mem 174MiB

[run 3/3]
gcannon v0.5.3
  Target:    localhost:8080/
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.52ms    579us    919us   20.70ms   25.10ms

  13192507 requests in 5.00s, 13192571 responses
  Throughput: 2.64M req/s
  Bandwidth:  165.98MB/s
  Status codes: 2xx=13192571, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 13192519 / 13192571 responses (100.0%)
  Reconnects: 1319227
  Per-template: 4397606,4397547,4397366
  Per-template-ok: 4397606,4397547,4397366
[info] CPU 6194.4% | Mem 201MiB

=== Best: 2639285 req/s (CPU: 6393.3%, Mem: 174MiB) ===
[info] input BW: 203.88MB/s (avg template: 81 bytes)
[info] saved results/limited-conn/4096/tokio-uring.json
httparena-bench-tokio-uring
httparena-bench-tokio-uring
[info] skip: tokio-uring does not subscribe to json
[info] skip: tokio-uring does not subscribe to json-comp
[info] skip: tokio-uring does not subscribe to json-tls
[info] skip: tokio-uring does not subscribe to upload
[info] skip: tokio-uring does not subscribe to api-4
[info] skip: tokio-uring does not subscribe to api-16
[info] skip: tokio-uring does not subscribe to static
[info] skip: tokio-uring does not subscribe to async-db
[info] skip: tokio-uring does not subscribe to crud
[info] skip: tokio-uring does not subscribe to fortunes
[info] skip: tokio-uring does not subscribe to baseline-h2
[info] skip: tokio-uring does not subscribe to static-h2
[info] skip: tokio-uring does not subscribe to baseline-h2c
[info] skip: tokio-uring does not subscribe to json-h2c
[info] skip: tokio-uring does not subscribe to baseline-h3
[info] skip: tokio-uring does not subscribe to static-h3
[info] skip: tokio-uring does not subscribe to gateway-64
[info] skip: tokio-uring does not subscribe to gateway-h3
[info] skip: tokio-uring does not subscribe to production-stack
[info] skip: tokio-uring does not subscribe to unary-grpc
[info] skip: tokio-uring does not subscribe to unary-grpc-tls
[info] skip: tokio-uring does not subscribe to stream-grpc
[info] skip: tokio-uring does not subscribe to stream-grpc-tls
[info] skip: tokio-uring does not subscribe to echo-ws
[info] skip: tokio-uring does not subscribe to echo-ws-pipeline
[info] rebuilding site/data/*.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/frameworks.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/baseline-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/baseline-512.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/limited-conn-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/limited-conn-512.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/pipelined-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/pipelined-512.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/current.json
[info] done
[info] restoring loopback MTU to 65536

@MDA2AV MDA2AV merged commit 8033f17 into main Jun 7, 2026
2 checks passed
@MDA2AV MDA2AV deleted the add-tokio-uring branch June 7, 2026 14:31
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