Skip to content

SlimeWeb Python -few improvement changes#606

Open
ATOMMAX-2001 wants to merge 2 commits intoMDA2AV:mainfrom
ATOMMAX-2001:slimeweb-python
Open

SlimeWeb Python -few improvement changes#606
ATOMMAX-2001 wants to merge 2 commits intoMDA2AV:mainfrom
ATOMMAX-2001:slimeweb-python

Conversation

@ATOMMAX-2001
Copy link
Copy Markdown
Contributor

  • precompress lookup in static
  • pong frame for ws
  • async removed lock logic
  • reduce no of worker for both async and sync thread to prevent too much context switching.

Hoping to see few more RPS than previous run.

@ATOMMAX-2001
Copy link
Copy Markdown
Contributor Author

/benchmark -f slimeweb

@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 run triggered for slimeweb (all tests). Results will be posted here when done.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results

Framework: slimeweb | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 83,865 1375.2% 168MiB +19.9% -8.7%
baseline 4096 86,362 1399.8% 126MiB +20.4% -16.0%
pipelined 512 83,343 1251.0% 115MiB +17.9% -14.8%
pipelined 4096 91,600 1347.5% 124MiB +26.0% -30.3%
limited-conn 512 85,894 1393.1% 112MiB +18.2% -14.5%
limited-conn 4096 94,152 1465.7% 172MiB +35.5% +13.9%
json 4096 62,375 2293.4% 188MiB +23.7% -12.6%
json-comp 512 61,560 2559.4% 138MiB +29.8% -24.2%
json-comp 4096 66,844 2903.8% 213MiB +44.0% -5.8%
json-comp 16384 52,696 2510.3% 240MiB +10.1% -23.3%
upload 32 1,075 2838.2% 1.0GiB -1.0% -16.7%
upload 256 1,166 5483.5% 3.0GiB -0.4% -26.8%
api-4 256 14,366 282.4% 104MiB +11.3% -1.0%
api-16 1024 12,694 372.0% 151MiB +3.7% -1.9%
static 1024 36,737 1177.6% 724MiB +195.0% -18.3%
static 4096 35,112 1118.8% 1.4GiB +190.0% -26.3%
static 6800 37,088 1185.8% 1.4GiB +181.3% -33.3%
async-db 1024 4,884 202.1% 275MiB +17.8% -10.4%
Full log
[info] CPU 1122.4% | Mem 1.4GiB

=== Best: 35112 req/s (CPU: 1118.8%, Mem: 1.4GiB) ===
[info] saved results/static/4096/slimeweb.json
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / static / 6800c (tool=wrk) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   142.57ms  143.63ms   2.00s    93.59%
    Req/Sec   617.11    263.76     5.50k    72.38%
  188575 requests in 5.10s, 2.89GB read
  Socket errors: connect 0, read 0, write 0, timeout 5
Requests/sec:  36972.84
Transfer/sec:    579.78MB
[info] CPU 1206.7% | Mem 1.3GiB

[run 2/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   138.77ms   73.49ms 528.96ms   68.15%
    Req/Sec   584.06    209.34     9.83k    92.35%
  189169 requests in 5.10s, 2.90GB read
Requests/sec:  37088.98
Transfer/sec:    581.78MB
[info] CPU 1185.8% | Mem 1.4GiB

[run 3/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   160.57ms  103.74ms   1.54s    78.69%
    Req/Sec   583.92    180.69     8.27k    91.39%
  189139 requests in 5.10s, 2.90GB read
  Socket errors: connect 0, read 0, write 0, timeout 131
Requests/sec:  37087.45
Transfer/sec:    581.66MB
[info] CPU 1191.7% | Mem 1.4GiB

=== Best: 37088 req/s (CPU: 1185.8%, Mem: 1.4GiB) ===
[info] saved results/static/6800/slimeweb.json
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / async-db / 1024c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   196.60ms   121.30ms   377.60ms    1.10s    2.76s

  49333 requests in 10.00s, 48842 responses
  Throughput: 4.88K req/s
  Bandwidth:  18.71MB/s
  Status codes: 2xx=48842, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 48842 / 48842 responses (100.0%)
  Reconnects: 1504
  Per-template: 9757,9861,9715,9754,9755
  Per-template-ok: 9757,9861,9715,9754,9755
[info] CPU 202.1% | Mem 275MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   209.01ms   137.30ms   316.00ms   921.00ms    2.41s

  46988 requests in 10.00s, 46624 responses
  Throughput: 4.66K req/s
  Bandwidth:  17.80MB/s
  Status codes: 2xx=46624, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 46624 / 46624 responses (100.0%)
  Reconnects: 1375
  Per-template: 9358,9384,9307,9420,9155
  Per-template-ok: 9358,9384,9307,9420,9155
[info] CPU 197.9% | Mem 357MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   206.86ms   133.10ms   316.40ms   914.00ms    1.67s

  46440 requests in 10.00s, 46047 responses
  Throughput: 4.60K req/s
  Bandwidth:  17.65MB/s
  Status codes: 2xx=46047, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 46047 / 46047 responses (100.0%)
  Reconnects: 1336
  Per-template: 9150,9202,9220,9414,9061
  Per-template-ok: 9150,9202,9220,9414,9061
[info] CPU 196.3% | Mem 447MiB

=== Best: 4884 req/s (CPU: 202.1%, Mem: 275MiB) ===
[info] input BW: 333.87KB/s (avg template: 70 bytes)
[info] saved results/async-db/1024/slimeweb.json
httparena-bench-slimeweb
httparena-bench-slimeweb
[info] skip: slimeweb does not subscribe to crud
[info] skip: slimeweb does not subscribe to baseline-h2
[info] skip: slimeweb does not subscribe to static-h2
[info] skip: slimeweb does not subscribe to baseline-h3
[info] skip: slimeweb does not subscribe to static-h3
[info] skip: slimeweb does not subscribe to gateway-64
[info] skip: slimeweb does not subscribe to gateway-h3
[info] skip: slimeweb does not subscribe to production-stack
[info] skip: slimeweb does not subscribe to unary-grpc
[info] skip: slimeweb does not subscribe to unary-grpc-tls
[info] skip: slimeweb does not subscribe to stream-grpc
[info] skip: slimeweb does not subscribe to stream-grpc-tls

==============================================
=== slimeweb / echo-ws / 512c (tool=gcannon) ===
==============================================
[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / echo-ws / 4096c (tool=gcannon) ===
==============================================
[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / echo-ws / 16384c (tool=gcannon) ===
==============================================
[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping
httparena-bench-slimeweb
httparena-bench-slimeweb
[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/api-16-1024.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/api-4-256.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/async-db-1024.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/json-comp-16384.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/json-comp-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/json-comp-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/static-1024.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/static-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/static-6800.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/upload-256.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/upload-32.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/current.json
[info] done
httparena-postgres
[info] restoring loopback MTU to 65536
[info] restoring CPU governor → performance

@ATOMMAX-2001
Copy link
Copy Markdown
Contributor Author

well 10k rps is increased interesting..

[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping

Hey @MDA2AV , can you tell me how you’re checking whether the echo-ws server is up or not? In all three cases, it’s showing the same log. I thought there was an issue with the ping-pong frames, so I fixed that, but the problem still persists. Since it passed validation phase, I’m a bit confused.

@ATOMMAX-2001
Copy link
Copy Markdown
Contributor Author

/benchmark -f slimeweb --save

@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 run triggered for slimeweb (all tests) with --save. Results will be posted here when done.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results

Framework: slimeweb | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 85,240 1539.1% 168MiB +21.9% -8.7%
baseline 4096 82,494 1370.1% 125MiB +15.0% -16.7%
pipelined 512 82,213 1322.6% 113MiB +16.3% -16.3%
pipelined 4096 81,574 1323.8% 159MiB +12.3% -10.7%
limited-conn 512 88,480 1585.7% 114MiB +21.8% -13.0%
limited-conn 4096 101,595 1712.7% 160MiB +46.2% +6.0%
json 4096 79,804 3496.7% 172MiB +58.3% -20.0%
json-comp 512 86,588 3953.5% 147MiB +82.6% -19.2%
json-comp 4096 86,972 4083.0% 170MiB +87.4% -24.8%
json-comp 16384 83,267 3754.0% 274MiB +73.9% -12.5%
upload 32 1,107 2869.1% 1.1GiB +1.9% -8.3%
upload 256 1,185 5203.3% 1.7GiB +1.2% -58.5%
api-4 256 14,636 282.5% 102MiB +13.4% -2.9%
api-16 1024 13,047 371.9% 150MiB +6.6% -2.6%
static 1024 34,930 1161.0% 707MiB +180.4% -20.2%
static 4096 33,833 1120.5% 1.2GiB +179.4% -36.8%
static 6800 32,538 1096.2% 1.2GiB +146.8% -42.9%
async-db 1024 4,868 205.0% 312MiB +17.4% +1.6%
Full log
[info] CPU 1098.7% | Mem 1.3GiB

=== Best: 33833 req/s (CPU: 1120.5%, Mem: 1.2GiB) ===
[info] saved results/static/4096/slimeweb.json
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / static / 6800c (tool=wrk) ===
==============================================
[info] waiting for server...
[info] server ready

[run 1/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   163.95ms  155.79ms   2.00s    90.73%
    Req/Sec   528.33    237.44     4.21k    75.19%
  165551 requests in 5.10s, 2.54GB read
  Socket errors: connect 0, read 0, write 0, timeout 11
Requests/sec:  32455.37
Transfer/sec:    509.09MB
[info] CPU 1113.1% | Mem 1.2GiB

[run 2/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   169.07ms   88.35ms 687.27ms   67.98%
    Req/Sec   512.35    198.53     9.61k    94.04%
  165963 requests in 5.10s, 2.54GB read
Requests/sec:  32538.07
Transfer/sec:    510.31MB
[info] CPU 1096.2% | Mem 1.2GiB

[run 3/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   177.50ms  164.27ms   1.86s    92.83%
    Req/Sec   510.59    203.07     8.64k    90.94%
  165531 requests in 5.10s, 2.54GB read
  Socket errors: connect 0, read 0, write 0, timeout 139
Requests/sec:  32451.86
Transfer/sec:    508.97MB
[info] CPU 1098.3% | Mem 1.2GiB

=== Best: 32538 req/s (CPU: 1096.2%, Mem: 1.2GiB) ===
[info] saved results/static/6800/slimeweb.json
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / async-db / 1024c (tool=gcannon) ===
==============================================
[info] waiting for server...
[info] server ready

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   196.05ms   128.10ms   360.00ms   434.00ms   899.50ms

  49044 requests in 10.00s, 48420 responses
  Throughput: 4.84K req/s
  Bandwidth:  18.57MB/s
  Status codes: 2xx=48420, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 48420 / 48420 responses (100.0%)
  Reconnects: 1418
  Per-template: 9678,9694,9668,9695,9685
  Per-template-ok: 9678,9694,9668,9695,9685
[info] CPU 202.8% | Mem 276MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   199.81ms   197.90ms   304.30ms   493.20ms   982.50ms

  49093 requests in 10.00s, 48686 responses
  Throughput: 4.87K req/s
  Bandwidth:  18.68MB/s
  Status codes: 2xx=48686, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 48686 / 48686 responses (100.0%)
  Reconnects: 1519
  Per-template: 9610,9773,9831,9775,9697
  Per-template-ok: 9610,9773,9831,9775,9697
[info] CPU 205.0% | Mem 312MiB

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


  Thread Stats   Avg      p50      p90      p99    p99.9
    Latency   202.17ms   132.90ms   310.00ms   882.90ms    1.87s

  48481 requests in 10.00s, 48098 responses
  Throughput: 4.81K req/s
  Bandwidth:  18.42MB/s
  Status codes: 2xx=48098, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 48098 / 48098 responses (100.0%)
  Reconnects: 1477
  Per-template: 9525,9625,9791,9653,9504
  Per-template-ok: 9525,9625,9791,9653,9504
[info] CPU 202.8% | Mem 330MiB

=== Best: 4868 req/s (CPU: 205.0%, Mem: 312MiB) ===
[info] input BW: 332.77KB/s (avg template: 70 bytes)
[info] saved results/async-db/1024/slimeweb.json
httparena-bench-slimeweb
httparena-bench-slimeweb
[info] skip: slimeweb does not subscribe to crud
[info] skip: slimeweb does not subscribe to baseline-h2
[info] skip: slimeweb does not subscribe to static-h2
[info] skip: slimeweb does not subscribe to baseline-h3
[info] skip: slimeweb does not subscribe to static-h3
[info] skip: slimeweb does not subscribe to gateway-64
[info] skip: slimeweb does not subscribe to gateway-h3
[info] skip: slimeweb does not subscribe to production-stack
[info] skip: slimeweb does not subscribe to unary-grpc
[info] skip: slimeweb does not subscribe to unary-grpc-tls
[info] skip: slimeweb does not subscribe to stream-grpc
[info] skip: slimeweb does not subscribe to stream-grpc-tls

==============================================
=== slimeweb / echo-ws / 512c (tool=gcannon) ===
==============================================
[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / echo-ws / 4096c (tool=gcannon) ===
==============================================
[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping
httparena-bench-slimeweb
httparena-bench-slimeweb

==============================================
=== slimeweb / echo-ws / 16384c (tool=gcannon) ===
==============================================
[info] waiting for server...
[warn] slimeweb did not come up for echo-ws; skipping
httparena-bench-slimeweb
httparena-bench-slimeweb
[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/api-16-1024.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/api-4-256.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/async-db-1024.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/json-comp-16384.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/json-comp-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/json-comp-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/static-1024.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/static-4096.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/static-6800.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/upload-256.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/upload-32.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/current.json
[info] done
httparena-postgres
[info] restoring loopback MTU to 65536
[info] restoring CPU governor → powersave

@MDA2AV
Copy link
Copy Markdown
Owner

MDA2AV commented Apr 23, 2026

The readiness check is just curl -s -o /dev/null --max-time 2 http://localhost:8080/ws looped for 30s. It accepts any HTTP response code. It sounds like your /ws handler closes the socket on a plain GET (no Upgrade: websocket header) instead of returning an HTTP error. Have it return a 400 or 426 on non-upgrade requests and the probe will pass.

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.

2 participants