Skip to content

[C#] Add minima - HTTP/1.1#822

Merged
MDA2AV merged 1 commit into
mainfrom
add-minima
Jun 7, 2026
Merged

[C#] Add minima - HTTP/1.1#822
MDA2AV merged 1 commit into
mainfrom
add-minima

Conversation

@MDA2AV
Copy link
Copy Markdown
Owner

@MDA2AV MDA2AV commented Jun 6, 2026

Description

The Minima io_uring engine serving the H1-isolated profiles (baseline, pipelined, limited-conn) — engine-tier. Minima is a from-scratch C# multi-reactor io_uring server; this vendors the engine unchanged and adds a hand-rolled HTTP/1.1 handler (no HTTP framework). It's the HTTP/1.1 sibling of the merged minima-ws.

Engine (vendored as-is)

  • Per-reactor SO_REUSEPORT + multishot accept — each reactor thread owns its listener + ring; kernel-sharded, no central acceptor.
  • Multishot recv into a provided buffer ring.
  • RCA=false inline continuations + the reactor-thread short-circuit in Enqueue{Return,Flush,Recycle} (buffer return/flush/recycle hit the ring directly instead of the MPSC queue + eventfd wake, since the handler resumes inline on the reactor thread).

Handler (Program.cs)

Hand-rolled HTTP/1.1: request line + headers, Content-Length and chunked bodies, keep-alive, request pipelining (responses batched per drain), and fragmented-read reassembly.

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, CL POST75, chunked POST75, /pipelineok, 16× pipelining, keep-alive, fragmented reads, Connection: close — natively and via the Docker build.

io_uring needs seccomp=unconfined; engine: "io_uring" makes validate.sh enable it.

@MDA2AV MDA2AV force-pushed the add-minima branch 2 times, most recently from dd7770c to 2a5d944 Compare June 6, 2026 16:20
@MDA2AV
Copy link
Copy Markdown
Owner Author

MDA2AV commented Jun 6, 2026

/benchmark -f minima

@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: minima | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 4,124,213 6410.4% 435MiB NEW NEW
baseline 4096 4,070,442 6428.2% 492MiB NEW NEW
pipelined 512 53,646,153 6279.7% 408MiB NEW NEW
pipelined 4096 53,956,908 6185.0% 524MiB NEW NEW
limited-conn 512 2,455,170 5283.2% 484MiB NEW NEW
limited-conn 4096 2,507,329 5362.8% 596MiB NEW NEW
json 4096 2,272,728 5904.1% 757MiB NEW NEW
Full log
  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.67ms   1.32ms   2.11ms   8.11ms   22.20ms

  11522778 requests in 5.00s, 11523056 responses
  Throughput: 2.30M req/s
  Bandwidth:  144.97MB/s
  Status codes: 2xx=11523056, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11523056 / 11523056 responses (100.0%)
  Reconnects: 1150618
  Per-template: 3840872,3841022,3841162
  Per-template-ok: 3840872,3841022,3841162
[info] CPU 4711.3% | Mem 619MiB

[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.51ms   1.32ms   1.88ms   4.45ms   8.25ms

  12536550 requests in 5.00s, 12536648 responses
  Throughput: 2.51M req/s
  Bandwidth:  157.72MB/s
  Status codes: 2xx=12536648, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 12536617 / 12536648 responses (100.0%)
  Reconnects: 1253737
  Per-template: 4178882,4178646,4179089
  Per-template-ok: 4178882,4178646,4179089
[info] CPU 5362.8% | Mem 596MiB

[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.51ms   1.33ms   1.87ms   4.40ms   7.99ms

  12521927 requests in 5.00s, 12521930 responses
  Throughput: 2.50M req/s
  Bandwidth:  157.57MB/s
  Status codes: 2xx=12521930, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 12521865 / 12521930 responses (100.0%)
  Reconnects: 1251883
  Per-template: 4173882,4174013,4173970
  Per-template-ok: 4173882,4174012,4173970
[info] CPU 5224.8% | Mem 596MiB

=== Best: 2507329 req/s (CPU: 5362.8%, Mem: 596MiB) ===
[info] input BW: 193.69MB/s (avg template: 81 bytes)
[info] saved results/limited-conn/4096/minima.json
httparena-bench-minima
httparena-bench-minima

==============================================
=== minima / json / 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:  25
  Templates: 7
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.24ms    594us   2.75ms   8.03ms   28.00ms

  10491695 requests in 5.00s, 10491707 responses
  Throughput: 2.10M req/s
  Bandwidth:  7.03GB/s
  Status codes: 2xx=10491707, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 10491707 / 10491707 responses (100.0%)
  Reconnects: 417730
  Per-template: 1494905,1497904,1499767,1502055,1501698,1499501,1495877
  Per-template-ok: 1494905,1497904,1499767,1502055,1501698,1499501,1495877
[info] CPU 5325.6% | Mem 770MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    960us    468us   2.50ms   6.08ms   11.60ms

  11204307 requests in 5.00s, 11204307 responses
  Throughput: 2.24M req/s
  Bandwidth:  7.51GB/s
  Status codes: 2xx=11204307, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11204264 / 11204307 responses (100.0%)
  Reconnects: 448253
  Per-template: 1594453,1597467,1601945,1604728,1605828,1603195,1596648
  Per-template-ok: 1594453,1597467,1601945,1604728,1605828,1603195,1596648
[info] CPU 6038.7% | Mem 721MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    965us    507us   2.41ms   5.69ms   11.40ms

  11363634 requests in 5.00s, 11363643 responses
  Throughput: 2.27M req/s
  Bandwidth:  7.61GB/s
  Status codes: 2xx=11363643, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11364221 / 11363643 responses (100.0%)
  Reconnects: 454153
  Per-template: 1617230,1619892,1624132,1628108,1628552,1625797,1619870
  Per-template-ok: 1617230,1619892,1624132,1628108,1628552,1625797,1619870
[info] CPU 5904.1% | Mem 757MiB

=== Best: 2272728 req/s (CPU: 5904.1%, Mem: 757MiB) ===
[info] input BW: 108.37MB/s (avg template: 50 bytes)
[info] saved results/json/4096/minima.json
httparena-bench-minima
httparena-bench-minima
[info] skip: minima does not subscribe to json-comp
[info] skip: minima does not subscribe to json-tls
[info] skip: minima does not subscribe to upload
[info] skip: minima does not subscribe to api-4
[info] skip: minima does not subscribe to api-16
[info] skip: minima does not subscribe to static
[info] skip: minima does not subscribe to async-db
[info] skip: minima does not subscribe to crud
[info] skip: minima does not subscribe to fortunes
[info] skip: minima does not subscribe to baseline-h2
[info] skip: minima does not subscribe to static-h2
[info] skip: minima does not subscribe to baseline-h2c
[info] skip: minima does not subscribe to json-h2c
[info] skip: minima does not subscribe to baseline-h3
[info] skip: minima does not subscribe to static-h3
[info] skip: minima does not subscribe to gateway-64
[info] skip: minima does not subscribe to gateway-h3
[info] skip: minima does not subscribe to production-stack
[info] skip: minima does not subscribe to unary-grpc
[info] skip: minima does not subscribe to unary-grpc-tls
[info] skip: minima does not subscribe to stream-grpc
[info] skip: minima does not subscribe to stream-grpc-tls
[info] skip: minima does not subscribe to echo-ws
[info] skip: minima 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/json-4096.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

The Minima io_uring engine serving the H1-isolated profiles: baseline,
pipelined, limited-conn, and json. Vendors the current Minima engine
unchanged — per-reactor SO_REUSEPORT + multishot accept, multishot recv
into a provided buffer ring, RCA=false inline continuations with the
reactor-thread short-circuit on buffer return/flush/recycle. The request
handler is hand-written on Minima's raw recv/send API (no HTTP framework):
request line, headers, Content-Length + chunked bodies, keep-alive,
pipelining, fragmented reads, plus a /json/{count}?m=N serializer over the
mounted dataset (per-item static JSON precomputed at startup, dynamic
total = price*quantity*m appended per request).

Endpoints: /baseline11?a=&b= -> a+b(+body); /pipeline -> ok;
/json/{count}?m=N -> application/json. Validated against the full contract
(including the validator's json count/total checks) natively and via the
Docker build.
@MDA2AV
Copy link
Copy Markdown
Owner Author

MDA2AV commented Jun 6, 2026

/benchmark -f minima

@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: minima | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 4,108,137 6344.3% 434MiB NEW NEW
baseline 4096 4,097,165 6435.7% 489MiB NEW NEW
pipelined 512 53,707,177 6248.7% 405MiB NEW NEW
pipelined 4096 54,246,099 6174.3% 511MiB NEW NEW
limited-conn 512 2,473,009 5266.5% 479MiB NEW NEW
limited-conn 4096 2,503,437 5366.9% 591MiB NEW NEW
json 4096 2,032,626 6160.5% 802MiB NEW NEW
Full log
  Pipeline:  1
  Req/conn:  10
  Templates: 3
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.65ms   1.31ms   2.08ms   7.39ms   19.70ms

  11653286 requests in 5.00s, 11652965 responses
  Throughput: 2.33M req/s
  Bandwidth:  146.64MB/s
  Status codes: 2xx=11652965, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 11652965 / 11652965 responses (100.0%)
  Reconnects: 1163765
  Per-template: 3884529,3884311,3884125
  Per-template-ok: 3884529,3884311,3884125
[info] CPU 4825.6% | Mem 590MiB

[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   1.32ms   1.88ms   4.59ms   8.29ms

  12517232 requests in 5.00s, 12517189 responses
  Throughput: 2.50M req/s
  Bandwidth:  157.42MB/s
  Status codes: 2xx=12517189, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 12517097 / 12517189 responses (100.0%)
  Reconnects: 1251808
  Per-template: 4172203,4172710,4172184
  Per-template-ok: 4172203,4172710,4172184
[info] CPU 5366.9% | Mem 591MiB

[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   1.32ms   1.89ms   4.66ms   8.57ms

  12465819 requests in 5.00s, 12466053 responses
  Throughput: 2.49M req/s
  Bandwidth:  156.86MB/s
  Status codes: 2xx=12466053, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 12465996 / 12466053 responses (100.0%)
  Reconnects: 1246795
  Per-template: 4155427,4155303,4155266
  Per-template-ok: 4155427,4155303,4155266
[info] CPU 5198.6% | Mem 593MiB

=== Best: 2503437 req/s (CPU: 5366.9%, Mem: 591MiB) ===
[info] input BW: 193.38MB/s (avg template: 81 bytes)
[info] saved results/limited-conn/4096/minima.json
httparena-bench-minima
httparena-bench-minima

==============================================
=== minima / json / 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:  25
  Templates: 7
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.65ms    985us   3.38ms   9.64ms   24.20ms

  9176825 requests in 5.00s, 9176835 responses
  Throughput: 1.83M req/s
  Bandwidth:  6.15GB/s
  Status codes: 2xx=9176835, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 9176835 / 9176835 responses (100.0%)
  Reconnects: 365168
  Per-template: 1305217,1308389,1311444,1315363,1315944,1312878,1307600
  Per-template-ok: 1305217,1308389,1311444,1315363,1315944,1312878,1307600
[info] CPU 5626.0% | Mem 759MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.34ms    843us   3.10ms   6.66ms   14.40ms

  10082924 requests in 5.00s, 10082920 responses
  Throughput: 2.02M req/s
  Bandwidth:  6.75GB/s
  Status codes: 2xx=10082920, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 10083926 / 10082920 responses (100.0%)
  Reconnects: 403423
  Per-template: 1434881,1437827,1441267,1444556,1445089,1442316,1436937
  Per-template-ok: 1434881,1437827,1441267,1444556,1445089,1442316,1436936
[info] CPU 6349.7% | Mem 772MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   1.32ms    817us   3.06ms   6.25ms   12.80ms

  10163384 requests in 5.00s, 10163133 responses
  Throughput: 2.03M req/s
  Bandwidth:  6.81GB/s
  Status codes: 2xx=10163134, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 10163087 / 10163133 responses (100.0%)
  Reconnects: 405744
  Per-template: 1445942,1450152,1453213,1456364,1456250,1453030,1448136
  Per-template-ok: 1445942,1450152,1453213,1456364,1456249,1453030,1448135

  WARNING: 18446744073709551615/10163133 responses (181506471220140.0%) had unexpected status (expected 2xx)
[info] CPU 6160.5% | Mem 802MiB

=== Best: 2032626 req/s (CPU: 6160.5%, Mem: 802MiB) ===
[info] input BW: 96.92MB/s (avg template: 50 bytes)
[info] saved results/json/4096/minima.json
httparena-bench-minima
httparena-bench-minima
[info] skip: minima does not subscribe to json-comp
[info] skip: minima does not subscribe to json-tls
[info] skip: minima does not subscribe to upload
[info] skip: minima does not subscribe to api-4
[info] skip: minima does not subscribe to api-16
[info] skip: minima does not subscribe to static
[info] skip: minima does not subscribe to async-db
[info] skip: minima does not subscribe to crud
[info] skip: minima does not subscribe to fortunes
[info] skip: minima does not subscribe to baseline-h2
[info] skip: minima does not subscribe to static-h2
[info] skip: minima does not subscribe to baseline-h2c
[info] skip: minima does not subscribe to json-h2c
[info] skip: minima does not subscribe to baseline-h3
[info] skip: minima does not subscribe to static-h3
[info] skip: minima does not subscribe to gateway-64
[info] skip: minima does not subscribe to gateway-h3
[info] skip: minima does not subscribe to production-stack
[info] skip: minima does not subscribe to unary-grpc
[info] skip: minima does not subscribe to unary-grpc-tls
[info] skip: minima does not subscribe to stream-grpc
[info] skip: minima does not subscribe to stream-grpc-tls
[info] skip: minima does not subscribe to echo-ws
[info] skip: minima 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/json-4096.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 cbf7798 into main Jun 7, 2026
4 checks passed
@MDA2AV MDA2AV deleted the add-minima 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