Skip to content

frameworks/kemal: add benchmark implementation - #1174

Open
nigrosimone wants to merge 2 commits into
MDA2AV:mainfrom
nigrosimone:add-kemal
Open

frameworks/kemal: add benchmark implementation#1174
nigrosimone wants to merge 2 commits into
MDA2AV:mainfrom
nigrosimone:add-kemal

Conversation

@nigrosimone

Copy link
Copy Markdown
Contributor

Adds Kemal, and with it Crystal, which is not on the board at all.

Six profiles: baseline, pipelined, limited-conn, json, json-comp, upload.

Verified locally: docker build, then the six profiles replayed against this repo's own data/dataset.json, byte identical to express and fastify for the same requests.

Written with Claude Opus 5.

@MDA2AV

MDA2AV commented Aug 15, 2026

Copy link
Copy Markdown
Owner

/benchmark --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 Results

Framework: kemal | Test: all tests

No results captured

Full log
[info] available CPUs: 128
[info] framework: kemal (kemal, Crystal)
[info] subscribed tests: baseline,pipelined,limited-conn,json,json-comp,upload
[info] building image: httparena-kemal
#0 building with "default" instance using docker driver

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

#2 [internal] load metadata for docker.io/crystallang/crystal:1.21.0
#2 ...

#3 [internal] load metadata for docker.io/library/ubuntu:24.04
#3 DONE 0.2s

#2 [internal] load metadata for docker.io/crystallang/crystal:1.21.0
#2 DONE 1.7s

#4 [internal] load .dockerignore
#4 transferring context: 2B done
#4 DONE 0.1s

#5 [internal] load build context
#5 DONE 0.0s

#6 [build 1/6] FROM docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa
#6 resolve docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa 0.0s done
#6 DONE 0.0s

#7 [stage-1 1/3] FROM docker.io/library/ubuntu:24.04@sha256:c4a8d5503dfb2a3eb8ab5f807da5bc69a85730fb49b5cfca2330194ebcc41c7b
#7 resolve docker.io/library/ubuntu:24.04@sha256:c4a8d5503dfb2a3eb8ab5f807da5bc69a85730fb49b5cfca2330194ebcc41c7b
#7 resolve docker.io/library/ubuntu:24.04@sha256:c4a8d5503dfb2a3eb8ab5f807da5bc69a85730fb49b5cfca2330194ebcc41c7b 0.0s done
#7 CACHED

#5 [internal] load build context
#5 transferring context: 6.82kB done
#5 DONE 0.1s

#8 [stage-1 2/3] RUN apt-get update &&     apt-get install -y --no-install-recommends libssl3t64 libpcre2-8-0 zlib1g &&     rm -rf /var/lib/apt/lists/*
#8 0.513 Get:1 http://archive.ubuntu.com/ubuntu noble InRelease [256 kB]
#8 0.538 Get:2 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
#8 0.759 Get:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
#8 0.817 Get:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
#8 0.876 Get:5 http://archive.ubuntu.com/ubuntu noble/restricted amd64 Packages [117 kB]
#8 0.898 Get:6 http://archive.ubuntu.com/ubuntu noble/main amd64 Packages [1808 kB]
#8 0.901 Get:7 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [1153 kB]
#8 1.061 Get:8 http://archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages [331 kB]
#8 1.070 Get:9 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages [19.3 MB]
#8 1.335 Get:10 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages [50.0 kB]
#8 1.339 Get:11 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [1524 kB]
#8 1.721 Get:12 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [1657 kB]
#8 1.829 Get:13 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [1478 kB]
#8 1.855 Get:14 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [1768 kB]
#8 1.864 Get:15 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [2141 kB]
#8 1.872 Get:16 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [55.8 kB]
#8 1.873 Get:17 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [35.9 kB]
#8 1.913 Get:18 http://archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Packages [671 B]
#8 1.913 Get:19 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Packages [48.9 kB]
#8 2.595 Fetched 32.1 MB in 2s (14.7 MB/s)
#8 2.595 Reading package lists...
#8 3.337 Reading package lists...
#8 4.086 Building dependency tree...
#8 4.257 Reading state information...
#8 4.487 libpcre2-8-0 is already the newest version (10.42-4ubuntu2.1).
#8 4.487 zlib1g is already the newest version (1:1.3.dfsg-3.1ubuntu2.1).
#8 4.487 The following packages will be upgraded:
#8 4.488   libssl3t64
#8 4.809 1 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
#8 4.809 Need to get 1942 kB of archives.
#8 4.809 After this operation, 1024 B of additional disk space will be used.
#8 4.809 Get:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 libssl3t64 amd64 3.0.13-0ubuntu3.12 [1942 kB]
#8 6.158 debconf: delaying package configuration, since apt-utils is not installed
#8 6.193 Fetched 1942 kB in 1s (1305 kB/s)
#8 6.246 (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 4381 files and directories currently installed.)
#8 6.266 Preparing to unpack .../libssl3t64_3.0.13-0ubuntu3.12_amd64.deb ...
#8 6.291 Unpacking libssl3t64:amd64 (3.0.13-0ubuntu3.12) over (3.0.13-0ubuntu3.9) ...
#8 6.461 Setting up libssl3t64:amd64 (3.0.13-0ubuntu3.12) ...
#8 6.497 Processing triggers for libc-bin (2.39-0ubuntu8.7) ...
#8 DONE 6.9s

#6 [build 1/6] FROM docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa
#6 sha256:be09d6fd4077dc4f46266315bf7404ce97294fd9dfc82cbb8137779104b15b2d 59.06MB / 59.06MB 3.7s done
#6 sha256:a5d918295bfe23fb313cd2b09d23cc9e7cd9b18b58681f664b0cdf537c8b14e0 57.77MB / 57.77MB 2.9s done
#6 sha256:70c7b0bfa7cbb00d00eb8ab1b7f67be011c53cf8524bf28b5952060ce7b7e26c 148.84MB / 148.84MB 4.4s done
#6 extracting sha256:70c7b0bfa7cbb00d00eb8ab1b7f67be011c53cf8524bf28b5952060ce7b7e26c
#6 extracting sha256:70c7b0bfa7cbb00d00eb8ab1b7f67be011c53cf8524bf28b5952060ce7b7e26c 3.6s done
#6 DONE 8.2s

#6 [build 1/6] FROM docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa
#6 extracting sha256:a5d918295bfe23fb313cd2b09d23cc9e7cd9b18b58681f664b0cdf537c8b14e0
#6 extracting sha256:a5d918295bfe23fb313cd2b09d23cc9e7cd9b18b58681f664b0cdf537c8b14e0 0.5s done
#6 DONE 8.7s

#6 [build 1/6] FROM docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa
#6 extracting sha256:be09d6fd4077dc4f46266315bf7404ce97294fd9dfc82cbb8137779104b15b2d
#6 extracting sha256:be09d6fd4077dc4f46266315bf7404ce97294fd9dfc82cbb8137779104b15b2d 1.0s done
#6 DONE 9.7s

#9 [build 2/6] WORKDIR /app
#9 DONE 0.3s

#10 [build 3/6] COPY shard.yml shard.lock ./
#10 DONE 0.1s

#11 [build 4/6] RUN shards install --production --frozen
#11 0.285 I: Resolving dependencies
#11 0.289 I: Fetching https://github.com/kemalcr/kemal.git
#11 1.865 I: Fetching https://github.com/luislavena/radix.git
#11 1.865 I: Fetching https://github.com/crystal-loot/exception_page.git
#11 2.880 I: Fetching https://github.com/sija/backtracer.cr.git
#11 3.860 I: Installing radix (0.4.1)
#11 3.860 I: Installing backtracer (1.2.4)
#11 3.872 I: Installing exception_page (0.5.0)
#11 3.877 I: Installing kemal (1.12.0)
#11 4.072 E: Error executing crystal:
#11 4.072 Unhandled exception: Arithmetic overflow (OverflowError)
#11 4.072   from /crystal/src/slice.cr:271:34 in 'default_workers_count'
#11 4.072   from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
#11 4.072   from /crystal/src/crystal/main.cr:129:5 in 'main'
#11 4.072   from /crystal/src/crystal/system/unix/main.cr:10:3 in 'main'
#11 4.072   from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
#11 4.072 
#11 ERROR: process "/bin/sh -c shards install --production --frozen" did not complete successfully: exit code: 1
------
 > [build 4/6] RUN shards install --production --frozen:
3.872 I: Installing exception_page (0.5.0)
3.877 I: Installing kemal (1.12.0)
4.072 E: Error executing crystal:
4.072 Unhandled exception: Arithmetic overflow (OverflowError)
4.072   from /crystal/src/slice.cr:271:34 in 'default_workers_count'
4.072   from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
4.072   from /crystal/src/crystal/main.cr:129:5 in 'main'
4.072   from /crystal/src/crystal/system/unix/main.cr:10:3 in 'main'
4.072   from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
4.072 
------
Dockerfile:4
--------------------
   2 |     WORKDIR /app
   3 |     COPY shard.yml shard.lock ./
   4 | >>> RUN shards install --production --frozen
   5 |     COPY src ./src
   6 |     RUN crystal build src/server.cr -o /app/server --release --no-debug
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c shards install --production --frozen" did not complete successfully: exit code: 1
[FAIL] docker build failed
[info] restoring loopback MTU to 65536

@MDA2AV

MDA2AV commented Aug 15, 2026

Copy link
Copy Markdown
Owner

/benchmark --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 --save cannot start: main has diverged and cannot be auto-merged into this branch. Please merge or rebase main manually, push, and re-run /benchmark --save.

@MDA2AV

MDA2AV commented Aug 15, 2026

Copy link
Copy Markdown
Owner

/benchmark --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 Results

Framework: kemal | Test: all tests

No results captured

Full log
[info] available CPUs: 128
[info] framework: kemal (kemal, Crystal)
[info] subscribed tests: baseline,pipelined,limited-conn,json,json-comp,upload
[info] building image: httparena-kemal
#0 building with "default" instance using docker driver

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

#2 [internal] load metadata for docker.io/library/ubuntu:24.04
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/crystallang/crystal:1.21.0
#3 DONE 0.7s

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

#5 [internal] load build context
#5 DONE 0.0s

#6 [stage-1 1/3] FROM docker.io/library/ubuntu:24.04@sha256:c4a8d5503dfb2a3eb8ab5f807da5bc69a85730fb49b5cfca2330194ebcc41c7b
#6 resolve docker.io/library/ubuntu:24.04@sha256:c4a8d5503dfb2a3eb8ab5f807da5bc69a85730fb49b5cfca2330194ebcc41c7b 0.1s done
#6 DONE 0.1s

#7 [stage-1 2/3] RUN apt-get update &&     apt-get install -y --no-install-recommends libssl3t64 libpcre2-8-0 zlib1g &&     rm -rf /var/lib/apt/lists/*
#7 CACHED

#8 [build 1/6] FROM docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa
#8 resolve docker.io/crystallang/crystal:1.21.0@sha256:32b7b908a8c3625ebd629053daf48b6f469deaf74aeb71ad101895096b1665fa 0.1s done
#8 DONE 0.1s

#5 [internal] load build context
#5 transferring context: 6.82kB done
#5 DONE 0.0s

#9 [build 2/6] WORKDIR /app
#9 CACHED

#10 [build 3/6] COPY shard.yml shard.lock ./
#10 CACHED

#11 [build 4/6] RUN shards install --production --frozen
#11 0.336 I: Resolving dependencies
#11 0.341 I: Fetching https://github.com/kemalcr/kemal.git
#11 1.958 I: Fetching https://github.com/luislavena/radix.git
#11 1.958 I: Fetching https://github.com/crystal-loot/exception_page.git
#11 2.981 I: Fetching https://github.com/sija/backtracer.cr.git
#11 3.975 I: Installing radix (0.4.1)
#11 3.988 I: Installing backtracer (1.2.4)
#11 3.994 I: Installing exception_page (0.5.0)
#11 4.005 I: Installing kemal (1.12.0)
#11 4.310 E: Error executing crystal:
#11 4.310 Unhandled exception: Arithmetic overflow (OverflowError)
#11 4.310   from /crystal/src/slice.cr:271:34 in 'default_workers_count'
#11 4.310   from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
#11 4.310   from /crystal/src/crystal/main.cr:129:5 in 'main'
#11 4.310   from /crystal/src/crystal/system/unix/main.cr:10:3 in 'main'
#11 4.310   from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
#11 4.310 
#11 ERROR: process "/bin/sh -c shards install --production --frozen" did not complete successfully: exit code: 1
------
 > [build 4/6] RUN shards install --production --frozen:
3.994 I: Installing exception_page (0.5.0)
4.005 I: Installing kemal (1.12.0)
4.310 E: Error executing crystal:
4.310 Unhandled exception: Arithmetic overflow (OverflowError)
4.310   from /crystal/src/slice.cr:271:34 in 'default_workers_count'
4.310   from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
4.310   from /crystal/src/crystal/main.cr:129:5 in 'main'
4.310   from /crystal/src/crystal/system/unix/main.cr:10:3 in 'main'
4.310   from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'
4.310 
------
Dockerfile:4
--------------------
   2 |     WORKDIR /app
   3 |     COPY shard.yml shard.lock ./
   4 | >>> RUN shards install --production --frozen
   5 |     COPY src ./src
   6 |     RUN crystal build src/server.cr -o /app/server --release --no-debug
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c shards install --production --frozen" did not complete successfully: exit code: 1
[FAIL] docker build failed
[info] restoring loopback MTU to 65536

@nigrosimone

Copy link
Copy Markdown
Contributor Author

The failed run is the build on the benchmark host, not the entry logic: shards install crashes the crystal compiler with "Unhandled exception: Arithmetic overflow (OverflowError)". The same build passes the validate runner, which has 4 CPUs, and the benchmark host reports 128 available CPUs, exactly one past what an Int8 holds, so a cpu count kept in a too-small integer somewhere in the toolchain is the suspect.

A workaround worth trying in the Dockerfile is bounding the affinity of the two build steps, taskset -c 0-63 for both shards install and crystal build. If the built server reads the cpu count at runtime the same way, it may need the same cap when it starts.

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