Skip to content

[sinatra] Return database results with symbols instead of strings#786

Open
p8 wants to merge 1 commit into
MDA2AV:mainfrom
p8:sinatra/pg-symbol-results
Open

[sinatra] Return database results with symbols instead of strings#786
p8 wants to merge 1 commit into
MDA2AV:mainfrom
p8:sinatra/pg-symbol-results

Conversation

@p8
Copy link
Copy Markdown
Contributor

@p8 p8 commented Jun 2, 2026

Reuse symbols instead of creating new strings everytime.

Reuse symbols instead of creating new strings everytime.
@p8
Copy link
Copy Markdown
Contributor Author

p8 commented Jun 2, 2026

/benchmark -f sinatra -t async-db

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Benchmark Results

Framework: sinatra | Test: async-db

Test Conn RPS CPU Mem Δ RPS Δ Mem
async-db 1024 112,472 6232.2% 3.3GiB +11.9% +17.9%
Full log
[info] available CPUs: 128
[info] framework: sinatra (sinatra, Ruby)
[info] subscribed tests: baseline,pipelined,limited-conn,json,json-comp,json-tls,upload,api-4,api-16,async-db,static
[info] building image: httparena-sinatra
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 572B done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/ruby:4.0-slim
#2 DONE 0.6s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [internal] load build context
#4 transferring context: 202B done
#4 DONE 0.0s

#5 [1/7] FROM docker.io/library/ruby:4.0-slim@sha256:86a2ff44ce474c1c9bd11dfb2fd7fe5408a5bfe8236b9bc6013e2c6ef4c02d39
#5 resolve docker.io/library/ruby:4.0-slim@sha256:86a2ff44ce474c1c9bd11dfb2fd7fe5408a5bfe8236b9bc6013e2c6ef4c02d39 0.0s done
#5 DONE 0.0s

#6 [6/7] RUN bundle install --jobs=$(nproc)
#6 CACHED

#7 [3/7] WORKDIR /app
#7 CACHED

#8 [2/7] RUN apt-get update &&     apt-get install -y --no-install-recommends build-essential libpq-dev libjemalloc2 &&     rm -rf /var/lib/apt/lists/*
#8 CACHED

#9 [4/7] COPY Gemfile* .
#9 CACHED

#10 [5/7] RUN bundle config set deployment 'true'
#10 CACHED

#11 [7/7] COPY . .
#11 CACHED

#12 exporting to image
#12 exporting layers done
#12 exporting manifest sha256:9890f6666930e6b8e3d7a73fcf5e6d5a9d9b86e7d5641d5a79261f820dfd6c5b done
#12 exporting config sha256:7d9f268eae4e2e93787e935e215203f5aeed664cb5252d82a670e4379c66fb24 done
#12 exporting attestation manifest sha256:8d7abb82cbd81adec185ff1b28b004666e4576ca7a1ced7f23218240f8ac506d
#12 exporting attestation manifest sha256:8d7abb82cbd81adec185ff1b28b004666e4576ca7a1ced7f23218240f8ac506d 0.0s done
#12 exporting manifest list sha256:265e745f6c75a274273dc4555bfb5c22414e239940db9fefaa4055b3521325e0 0.0s done
#12 naming to docker.io/library/httparena-sinatra:latest done
#12 unpacking to docker.io/library/httparena-sinatra:latest done
#12 DONE 0.1s
[info] tuning host for benchmark runs
[info] CPU governor → performance
[info] setting kernel socket limits
[info] setting UDP buffer sizes for QUIC
[info] setting loopback MTU to 1500 (realistic Ethernet)
[info] restarting docker daemon
[info] dropping kernel caches
[info] starting postgres sidecar
[info] postgres ready (seeded)

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

[run 1/3]
gcannon v0.5.3
  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   212.62ms   209.30ms   471.30ms   787.70ms   898.00ms

  47327 requests in 10.00s, 47328 responses
  Throughput: 4.73K req/s
  Bandwidth:  11.50MB/s
  Status codes: 2xx=27485, 3xx=0, 4xx=0, 5xx=19843
  Latency samples: 47328 / 47328 responses (100.0%)
  Reconnects: 1365
  Per-template: 9319,9336,9411,9667,9595
  Per-template-ok: 5363,5292,5616,5763,5451

  WARNING: 19843/47328 responses (41.9%) had unexpected status (expected 2xx)
[info] CPU 768.2% | Mem 2.0GiB

[run 2/3]
gcannon v0.5.3
  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   8.42ms   7.91ms   13.40ms   20.20ms   28.70ms

  1124728 requests in 10.00s, 1124728 responses
  Throughput: 112.45K req/s
  Bandwidth:  454.65MB/s
  Status codes: 2xx=1124728, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 1124727 / 1124728 responses (100.0%)
  Reconnects: 44705
  Per-template: 224515,225019,225359,225270,224564
  Per-template-ok: 224515,225019,225359,225270,224564
[info] CPU 6232.2% | Mem 3.3GiB

[run 3/3]
gcannon v0.5.3
  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   8.55ms   8.06ms   13.70ms   19.70ms   25.90ms

  1108908 requests in 10.00s, 1108908 responses
  Throughput: 110.86K req/s
  Bandwidth:  448.22MB/s
  Status codes: 2xx=1108908, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 1108907 / 1108908 responses (100.0%)
  Reconnects: 44080
  Per-template: 221173,221932,222379,222248,221175
  Per-template-ok: 221173,221932,222379,222248,221175
[info] CPU 6328.8% | Mem 3.2GiB

=== Best: 112472 req/s (CPU: 6232.2%, Mem: 3.3GiB) ===
[info] input BW: 7.51MB/s (avg template: 70 bytes)
[info] saved results/async-db/1024/sinatra.json
httparena-bench-sinatra
httparena-bench-sinatra
[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/async-db-1024.json
[updated] /home/diogo/actions-runner/_work/HttpArena/HttpArena/site/data/current.json
[info] done
httparena-postgres
[info] restoring loopback MTU to 65536

@p8
Copy link
Copy Markdown
Contributor Author

p8 commented Jun 2, 2026

/benchmark -f sinatra --save

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Benchmark Results

Framework: sinatra | Test: all tests

Test Conn RPS CPU Mem Δ RPS Δ Mem
baseline 512 93,007 4596.9% 6.6GiB -5.3% -1.5%
baseline 4096 63,825 3762.6% 4.9GiB +9.1% ~0%
pipelined 512 481,582 6455.7% 2.0GiB +11.9% -4.8%
pipelined 4096 471,046 6410.4% 2.1GiB +10.3% ~0%
limited-conn 512 37,979 2877.6% 3.8GiB +1.9% +8.6%
limited-conn 4096 40,577 3160.4% 4.4GiB +1.8% +2.3%
json 4096 209,845 6305.3% 4.9GiB +4.1% +6.5%
json-comp 512 115,942 6419.5% 5.0GiB -1.9% +8.7%
json-comp 4096 124,782 6455.2% 4.7GiB +0.7% +6.8%
json-comp 16384 126,266 6209.6% 5.1GiB +3.9% +13.3%
json-tls 4096 193,481 6513.8% 7.1GiB +4.3% +18.3%
upload 32 951 3087.2% 7.7GiB +0.2% -10.5%
upload 256 901 6344.9% 8.4GiB -2.2% +1.2%
api-4 256 17,221 393.4% 409MiB +7.2% -5.3%
api-16 1024 43,403 1619.4% 1.2GiB +7.1% -7.7%
static 1024 23,715 6509.6% 7.2GiB +1.0% +9.1%
static 4096 23,598 6519.4% 7.0GiB +1.3% ~0%
static 6800 23,439 6472.5% 7.2GiB +1.0% +1.4%
async-db 1024 110,540 6226.0% 3.3GiB +10.0% +17.9%
Full log
Running 5s test @ http://localhost:8080
  64 threads and 4096 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   161.06ms   47.04ms 469.33ms   74.57%
    Req/Sec   373.25    122.82     2.16k    85.41%
  120358 requests in 5.10s, 2.09GB read
Requests/sec:  23598.62
Transfer/sec:    420.42MB
[info] CPU 6519.4% | Mem 7.0GiB

[run 3/3]
Running 5s test @ http://localhost:8080
  64 threads and 4096 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   162.40ms   49.83ms 509.25ms   76.54%
    Req/Sec   371.29    125.31     2.76k    87.48%
  119732 requests in 5.11s, 2.08GB read
Requests/sec:  23448.84
Transfer/sec:    418.07MB
[info] CPU 6487.5% | Mem 7.3GiB

=== Best: 23598 req/s (CPU: 6519.4%, Mem: 7.0GiB) ===
[info] saved results/static/4096/sinatra.json
httparena-bench-sinatra
httparena-bench-sinatra

==============================================
=== sinatra / 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   259.93ms   83.71ms 884.78ms   72.90%
    Req/Sec   359.15    159.14     0.93k    77.75%
  112752 requests in 5.14s, 1.96GB read
Requests/sec:  21936.88
Transfer/sec:    390.81MB
[info] CPU 6458.1% | Mem 6.8GiB

[run 2/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   255.22ms   95.36ms 939.81ms   74.45%
    Req/Sec   372.16    165.47     2.38k    78.89%
  119464 requests in 5.10s, 2.08GB read
Requests/sec:  23410.67
Transfer/sec:    417.56MB
[info] CPU 6525.9% | Mem 6.8GiB

[run 3/3]
Running 5s test @ http://localhost:8080
  64 threads and 6800 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   255.19ms   94.91ms   1.10s    75.79%
    Req/Sec   372.44    168.46     2.64k    78.70%
  119693 requests in 5.11s, 2.08GB read
Requests/sec:  23439.03
Transfer/sec:    417.87MB
[info] CPU 6472.5% | Mem 7.2GiB

=== Best: 23439 req/s (CPU: 6472.5%, Mem: 7.2GiB) ===
[info] saved results/static/6800/sinatra.json
httparena-bench-sinatra
httparena-bench-sinatra

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

[run 1/3]
gcannon v0.5.3
  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   255.94ms   258.30ms   503.00ms   854.50ms   921.80ms

  39327 requests in 10.00s, 39327 responses
  Throughput: 3.93K req/s
  Bandwidth:  8.17MB/s
  Status codes: 2xx=19671, 3xx=0, 4xx=0, 5xx=19656
  Latency samples: 39327 / 39327 responses (100.0%)
  Reconnects: 1030
  Per-template: 7738,7965,7970,7933,7721
  Per-template-ok: 3892,4031,3937,4038,3773

  WARNING: 19656/39327 responses (50.0%) had unexpected status (expected 2xx)
[info] CPU 725.0% | Mem 2.0GiB

[run 2/3]
gcannon v0.5.3
  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   8.65ms   8.19ms   13.70ms   20.70ms   29.80ms

  1105401 requests in 10.00s, 1105406 responses
  Throughput: 110.52K req/s
  Bandwidth:  446.84MB/s
  Status codes: 2xx=1105406, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 1105405 / 1105406 responses (100.0%)
  Reconnects: 43920
  Per-template: 220301,221197,221959,221418,220530
  Per-template-ok: 220301,221197,221959,221418,220530
[info] CPU 6226.0% | Mem 3.3GiB

[run 3/3]
gcannon v0.5.3
  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   8.63ms   8.14ms   13.80ms   20.30ms   27.10ms

  1094422 requests in 10.00s, 1094425 responses
  Throughput: 109.42K req/s
  Bandwidth:  442.41MB/s
  Status codes: 2xx=1094425, 3xx=0, 4xx=0, 5xx=0
  Latency samples: 1094424 / 1094425 responses (100.0%)
  Reconnects: 43503
  Per-template: 218396,219057,219317,219103,218551
  Per-template-ok: 218396,219057,219317,219103,218551
[info] CPU 6330.5% | Mem 3.2GiB

=== Best: 110540 req/s (CPU: 6226.0%, Mem: 3.3GiB) ===
[info] input BW: 7.38MB/s (avg template: 70 bytes)
[info] saved results/async-db/1024/sinatra.json
httparena-bench-sinatra
httparena-bench-sinatra
[info] skip: sinatra does not subscribe to crud
[info] skip: sinatra does not subscribe to fortunes
[info] skip: sinatra does not subscribe to baseline-h2
[info] skip: sinatra does not subscribe to static-h2
[info] skip: sinatra does not subscribe to baseline-h2c
[info] skip: sinatra does not subscribe to json-h2c
[info] skip: sinatra does not subscribe to baseline-h3
[info] skip: sinatra does not subscribe to static-h3
[info] skip: sinatra does not subscribe to gateway-64
[info] skip: sinatra does not subscribe to gateway-h3
[info] skip: sinatra does not subscribe to production-stack
[info] skip: sinatra does not subscribe to unary-grpc
[info] skip: sinatra does not subscribe to unary-grpc-tls
[info] skip: sinatra does not subscribe to stream-grpc
[info] skip: sinatra does not subscribe to stream-grpc-tls
[info] skip: sinatra does not subscribe to echo-ws
[info] skip: sinatra 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/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/json-tls-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/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

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