Skip to content

[WIP] Update Ktor with 3.6.0 - #1204

Draft
bjhham wants to merge 2 commits into
MDA2AV:mainfrom
ktorio:release-3-6
Draft

[WIP] Update Ktor with 3.6.0#1204
bjhham wants to merge 2 commits into
MDA2AV:mainfrom
ktorio:release-3-6

Conversation

@bjhham

@bjhham bjhham commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

In 3.6.0, we're introducing HTTP/3 support and improving memory allocations in a few places. In anticipation of the release, I thought I'd run an early access build against the HttpArena benchmarks to see how it performs. I'll update this PR with the proper release artifact after it is published.

Fixes

  • See KTOR-9818 Performance improvements for Netty HTTP/3 ktorio/ktor#5822 - our initial implementation was getting pinned to a single thread, so we had to make several changes to the Netty implementation to use multiple ports / load balance over multiple threads. This should take advantage of parallelism in the benchmarks now. There were also a few tweaks that should improve overall throughput.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Heads up! This PR modifies the following frameworks:

@bjhham

bjhham commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

/benchmark -f ktor

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

Framework: ktor | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 882,487 6174.4% 4.8GiB +8.0% -4.0%
baseline 4096 765,151 5782.9% 4.8GiB -6.9% -49.5%
pipelined 512 576,924 4304.4% 10.9GiB -6.9% +2.8%
pipelined 4096 779,993 4536.7% 17.6GiB +33.4% -1.7%
limited-conn 512 679,658 6022.6% 4.7GiB +3.4% ~0%
limited-conn 4096 681,508 5853.0% 4.8GiB +2.4% +9.1%
json 4096 438,315 4407.1% 4.9GiB +10.9% -50.5%
json-comp 512 194,527 6382.3% 4.8GiB +6.4% -2.0%
json-comp 4096 208,377 6312.9% 8.2GiB +8.0% +57.7%
json-comp 16384 210,761 6141.3% 18.4GiB +11.2% +64.3%
json-tls 4096 402,995 4419.7% 5.0GiB +2.8% -46.2%
upload 32 1,712 3129.5% 1.4GiB +12.0% ~0%
upload 256 1,852 4598.4% 1.5GiB +1.0% ~0%
api-4 256 23,889 411.2% 626MiB -15.7% -18.8%
api-16 1024 83,927 1764.2% 1.5GiB +17.3% -25.0%
static 1024 263,198 6185.3% 3.1GiB -7.5% -27.9%
static 4096 267,237 6134.4% 4.2GiB -5.3% -4.5%
static 6800 263,078 6137.7% 5.1GiB -3.9% ~0%
static-tls 1024 194,432 6379.1% 3.2GiB -5.0% -15.8%
static-tls 4096 218,715 6242.1% 5.0GiB -8.2% ~0%
static-tls 6800 212,335 6248.5% 6.0GiB -6.4% ~0%
async-db 1024 115,909 5278.2% 9.2GiB +11.5% -4.2%
crud 4096 191,371 5370.4% 8.3GiB +10.9% +48.2%
fortunes 1024 59,570 5196.7% 13.2GiB +16.7% +76.0%
baseline-h2 256 505,139 5723.8% 30.5GiB -9.6% +2.3%
baseline-h2 1024 489,450 5816.5% 31.2GiB -9.7% +4.0%
static-h2 256 196,884 5905.0% 24.8GiB +3.8% +55.0%
static-h2 1024 182,913 5885.0% 25.8GiB +1.5% +4.5%
baseline-h2c 256 392,305 5621.9% 30.3GiB -4.8% -1.3%
baseline-h2c 1024 394,746 5100.3% 31.4GiB -2.0% +1.0%
baseline-h2c 4096 302,840 5241.0% 31.5GiB +8.2% +1.0%
json-h2c 1024 315,544 4042.7% 27.0GiB +0.4% -4.3%
json-h2c 4096 306,081 4268.5% 28.1GiB +8.2% -6.0%
baseline-h3 64 19,077 154.7% 1.4GiB NEW NEW
static-h3 64 5,525 219.1% 1.5GiB NEW NEW
echo-ws 512 1,024,064 3429.8% 2.5GiB +0.3% ~0%
echo-ws 4096 941,751 3452.9% 7.3GiB -3.9% +10.6%
echo-ws 16384 635,860 3293.9% 15.0GiB -1.5% +1.4%
echo-ws-pipeline 512 11,274,059 3391.7% 9.1GiB +0.5% -15.7%
echo-ws-pipeline 4096 10,939,667 3426.8% 14.9GiB +2.7% +14.6%
echo-ws-pipeline 16384 8,620,591 3288.8% 20.6GiB -2.9% -0.5%
Full log

  56370296 frames sent in 5.00s, 56370296 frames received
  Throughput: 11.27M req/s
  Bandwidth:  75.24MB/s
  WS upgrades: 512
  WS frames:   56370296
  Latency samples: 56370264 / 56370296 responses (100.0%)
[info] CPU 3391.7% | Mem 9.1GiB

[run 3/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     512 (8/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    730us    670us   1.12ms   1.87ms   3.86ms

  56040346 frames sent in 5.00s, 56040346 frames received
  Throughput: 11.21M req/s
  Bandwidth:  74.80MB/s
  WS upgrades: 512
  WS frames:   56040346
  Latency samples: 56040074 / 56040346 responses (100.0%)
[info] CPU 3389.0% | Mem 9.1GiB

=== Best: 11274059 req/s (CPU: 3391.7%, Mem: 9.1GiB) ===
[info] saved results/echo-ws-pipeline/512/ktor.json
httparena-bench-ktor
httparena-bench-ktor

==============================================
=== ktor / echo-ws-pipeline / 4096c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   8.14ms   5.70ms   10.90ms   47.70ms   329.30ms

  38021930 frames sent in 5.00s, 37959946 frames received
  Throughput: 7.59M req/s
  Bandwidth:  50.76MB/s
  WS upgrades: 4096
  WS frames:   37959946
  Latency samples: 37959946 / 37959946 responses (100.0%)
[info] CPU 3667.2% | Mem 14.8GiB

[run 2/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   6.15ms   5.68ms   8.48ms   15.00ms   41.90ms

  52735724 frames sent in 5.00s, 52676956 frames received
  Throughput: 10.53M req/s
  Bandwidth:  70.41MB/s
  WS upgrades: 4096
  WS frames:   52676956
  Latency samples: 52676940 / 52676956 responses (100.0%)
[info] CPU 3403.8% | Mem 14.8GiB

[run 3/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   5.96ms   5.66ms   8.01ms   14.40ms   19.90ms

  54749104 frames sent in 5.00s, 54698336 frames received
  Throughput: 10.94M req/s
  Bandwidth:  73.09MB/s
  WS upgrades: 4096
  WS frames:   54698336
  Latency samples: 54698320 / 54698336 responses (100.0%)
[info] CPU 3426.8% | Mem 14.9GiB

=== Best: 10939667 req/s (CPU: 3426.8%, Mem: 14.9GiB) ===
[info] saved results/echo-ws-pipeline/4096/ktor.json
httparena-bench-ktor
httparena-bench-ktor

==============================================
=== ktor / echo-ws-pipeline / 16384c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     16384 (256/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   44.82ms   32.00ms   63.20ms   382.80ms   414.20ms

  24373626 frames sent in 5.00s, 24111482 frames received
  Throughput: 4.82M req/s
  Bandwidth:  32.58MB/s
  WS upgrades: 16384
  WS frames:   24111482
  Latency samples: 24111482 / 24111482 responses (100.0%)
[info] CPU 3688.1% | Mem 20.6GiB

[run 2/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     16384 (256/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   31.36ms   29.20ms   46.00ms   74.30ms   110.20ms

  40664974 frames sent in 5.00s, 40402830 frames received
  Throughput: 8.08M req/s
  Bandwidth:  54.33MB/s
  WS upgrades: 16384
  WS frames:   40402830
  Latency samples: 40402830 / 40402830 responses (100.0%)
[info] CPU 3411.0% | Mem 20.6GiB

[run 3/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     16384 (256/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   29.54ms   27.60ms   42.50ms   65.50ms   89.40ms

  43365103 frames sent in 5.00s, 43102959 frames received
  Throughput: 8.62M req/s
  Bandwidth:  57.93MB/s
  WS upgrades: 16384
  WS frames:   43102959
  Latency samples: 43102959 / 43102959 responses (100.0%)
[info] CPU 3288.8% | Mem 20.6GiB

=== Best: 8620591 req/s (CPU: 3288.8%, Mem: 20.6GiB) ===
[info] saved results/echo-ws-pipeline/16384/ktor.json
httparena-bench-ktor
httparena-bench-ktor
[info] skip: ktor does not subscribe to echo-ws-limited
[info] rebuilding site/data/*.json
[purged stale] zix-grpc.json (zix-grpc)
[purged stale] zix-ws.json (zix-ws)
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/frameworks.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/results/ktor.json - 41 new, 41 total
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/current.json
[info] done
httparena-postgres
httparena-redis
[info] restoring loopback MTU to 65536

@bjhham

bjhham commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

/benchmark -f ktor

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark Results

Framework: ktor | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 888,521 6039.1% 4.8GiB +8.7% -4.0%
baseline 4096 674,862 5349.0% 9.7GiB -17.9% +2.1%
pipelined 512 687,593 4455.7% 2.7GiB +10.9% -74.5%
pipelined 4096 577,145 4269.8% 9.9GiB -1.3% -44.7%
limited-conn 512 682,637 5791.0% 4.7GiB +3.9% ~0%
limited-conn 4096 696,805 5815.9% 5.0GiB +4.7% +13.6%
json 4096 438,287 4413.0% 6.1GiB +10.9% -38.4%
json-comp 512 193,078 6281.2% 4.5GiB +5.6% -8.2%
json-comp 4096 205,976 6312.1% 5.8GiB +6.7% +11.5%
json-comp 16384 210,279 6127.9% 14.2GiB +11.0% +26.8%
json-tls 4096 412,620 4443.4% 5.8GiB +5.3% -37.6%
upload 32 1,558 3169.7% 1.4GiB +1.9% ~0%
upload 256 1,826 4493.6% 1.5GiB -0.4% ~0%
api-4 256 24,258 409.0% 708MiB -14.3% -8.2%
api-16 1024 83,288 1749.2% 1.6GiB +16.4% -20.0%
static 1024 261,085 6234.3% 3.1GiB -8.3% -27.9%
static 4096 265,163 6109.8% 4.0GiB -6.0% -9.1%
static 6800 266,671 6146.5% 4.7GiB -2.6% -7.8%
static-tls 1024 214,263 6348.2% 3.2GiB +4.7% -15.8%
static-tls 4096 218,538 6121.2% 4.8GiB -8.3% -4.0%
static-tls 6800 219,233 5888.4% 6.0GiB -3.4% ~0%
async-db 1024 115,649 5209.7% 13.4GiB +11.3% +39.6%
crud 4096 193,753 5364.2% 8.0GiB +12.3% +42.9%
fortunes 1024 58,028 5208.2% 7.3GiB +13.7% -2.7%
baseline-h2 256 434,495 5732.7% 30.4GiB -22.2% +2.0%
baseline-h2 1024 439,279 5814.5% 31.2GiB -18.9% +4.0%
static-h2 256 134,094 6246.4% 20.5GiB -29.3% +28.1%
static-h2 1024 184,142 5808.8% 24.7GiB +2.2% ~0%
baseline-h2c 256 427,063 5470.7% 30.9GiB +3.6% +0.7%
baseline-h2c 1024 499,811 4627.4% 30.0GiB +24.0% -3.5%
baseline-h2c 4096 264,224 5173.9% 31.4GiB -5.6% +0.6%
json-h2c 1024 318,853 4157.6% 27.3GiB +1.5% -3.2%
json-h2c 4096 300,744 4272.1% 29.1GiB +6.4% -2.7%
baseline-h3 64 338,966 4676.1% 3.0GiB NEW NEW
static-h3 64 37 2397.4% 592MiB NEW NEW
echo-ws 512 1,022,991 3426.3% 2.6GiB +0.2% +4.0%
echo-ws 4096 987,448 3455.8% 7.1GiB +0.8% +7.6%
echo-ws 16384 609,799 3377.9% 15.8GiB -5.5% +6.8%
echo-ws-pipeline 512 11,104,318 3381.7% 10.8GiB -1.0% ~0%
echo-ws-pipeline 4096 10,844,098 3401.1% 13.8GiB +1.8% +6.2%
echo-ws-pipeline 16384 8,767,586 3315.5% 21.4GiB -1.3% +3.4%
Full log
  Throughput: 10.82M req/s
  Bandwidth:  72.24MB/s
  WS upgrades: 512
  WS frames:   54119038
  Latency samples: 54119038 / 54119038 responses (100.0%)
[info] CPU 3382.6% | Mem 10.8GiB

[run 3/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     512 (8/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency    737us    679us   1.12ms   1.92ms   3.67ms

  55521592 frames sent in 5.00s, 55521592 frames received
  Throughput: 11.10M req/s
  Bandwidth:  74.11MB/s
  WS upgrades: 512
  WS frames:   55521592
  Latency samples: 55521448 / 55521592 responses (100.0%)
[info] CPU 3381.7% | Mem 10.8GiB

=== Best: 11104318 req/s (CPU: 3381.7%, Mem: 10.8GiB) ===
[info] saved results/echo-ws-pipeline/512/ktor.json
httparena-bench-ktor
httparena-bench-ktor

==============================================
=== ktor / echo-ws-pipeline / 4096c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   7.99ms   5.71ms   10.20ms   44.10ms   300.80ms

  38935217 frames sent in 5.00s, 38874529 frames received
  Throughput: 7.77M req/s
  Bandwidth:  51.98MB/s
  WS upgrades: 4096
  WS frames:   38874529
  Latency samples: 38874529 / 38874529 responses (100.0%)
[info] CPU 3742.2% | Mem 13.8GiB

[run 2/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   6.04ms   5.58ms   8.58ms   15.10ms   32.10ms

  53733573 frames sent in 5.00s, 53676101 frames received
  Throughput: 10.73M req/s
  Bandwidth:  71.74MB/s
  WS upgrades: 4095
  WS frames:   53676101
  Latency samples: 53676085 / 53676101 responses (100.0%)
[info] CPU 3409.9% | Mem 13.8GiB

[run 3/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     4096 (64/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   6.01ms   5.46ms   9.21ms   15.00ms   20.60ms

  54272462 frames sent in 5.00s, 54220494 frames received
  Throughput: 10.84M req/s
  Bandwidth:  72.46MB/s
  WS upgrades: 4096
  WS frames:   54220494
  Latency samples: 54218814 / 54220494 responses (100.0%)
[info] CPU 3401.1% | Mem 13.8GiB

=== Best: 10844098 req/s (CPU: 3401.1%, Mem: 13.8GiB) ===
[info] saved results/echo-ws-pipeline/4096/ktor.json
httparena-bench-ktor
httparena-bench-ktor

==============================================
=== ktor / echo-ws-pipeline / 16384c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     16384 (256/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   45.70ms   32.40ms   65.80ms   375.00ms   401.90ms

  24076052 frames sent in 5.00s, 23813908 frames received
  Throughput: 4.76M req/s
  Bandwidth:  32.19MB/s
  WS upgrades: 16384
  WS frames:   23813908
  Latency samples: 23813908 / 23813908 responses (100.0%)
[info] CPU 3723.0% | Mem 21.4GiB

[run 2/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     16384 (256/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   29.62ms   27.70ms   42.00ms   74.90ms   93.20ms

  43229507 frames sent in 5.00s, 42971459 frames received
  Throughput: 8.59M req/s
  Bandwidth:  57.75MB/s
  WS upgrades: 16384
  WS frames:   42971459
  Latency samples: 42971459 / 42971459 responses (100.0%)
[info] CPU 3386.5% | Mem 21.4GiB

[run 3/3]
gcannon v0.5.3 [WS]
  Target:    localhost:8080/ws
  Threads:   64
  Conns:     16384 (256/thread)
  Pipeline:  16
  Req/conn:  unlimited (keep-alive)
  Expected:  200
  Duration:  5s


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   29.07ms   27.70ms   39.00ms   76.80ms   95.70ms

  44100078 frames sent in 5.00s, 43837934 frames received
  Throughput: 8.77M req/s
  Bandwidth:  58.92MB/s
  WS upgrades: 16384
  WS frames:   43837934
  Latency samples: 43837934 / 43837934 responses (100.0%)
[info] CPU 3315.5% | Mem 21.4GiB

=== Best: 8767586 req/s (CPU: 3315.5%, Mem: 21.4GiB) ===
[info] saved results/echo-ws-pipeline/16384/ktor.json
httparena-bench-ktor
httparena-bench-ktor
[info] skip: ktor does not subscribe to echo-ws-limited
[info] rebuilding site/data/*.json
[purged stale] fulmine-tuned.json (fulmine-tuned)
[purged stale] oxpecker.json (oxpecker)
[purged stale] zix-grpc.json (zix-grpc)
[purged stale] zix-ws.json (zix-ws)
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/frameworks.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/results/ktor.json - 41 new, 41 total
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/current.json
[info] done
httparena-postgres
httparena-redis
[info] restoring loopback MTU to 65536

@bjhham

bjhham commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

The h3 bottleneck looks better now except for static files going down to 37 rps lol. I'll investigate this one next.

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