First Place on HttpArena, Medals Lost a Day Later

8 min read vlang viltrum benchmark httparena performance epoll open-source v

On October 23 the HttpArena results page was updated. Viltrum, in the Experimental category: first out of 13 entries on HTTP/1.1. First out of 11 entries on WebSocket. 9 gold, 1 silver.

Same day, I put the medal table in the README.

Next day I looked at the table again: 7 gold, 2 silver, 1 bronze.

This post is about what happened between those two days and where my numbers come from. In the previous post I covered the engine itself; this one is the measurement side.

Why HttpArena

When people said web framework benchmark, they meant TechEmpower. On March 24, 2026 the repo was archived, and it no longer accepts new entries. The active successor is HttpArena.

Everyone runs on the same machine: a 64-core Threadripper PRO 3995WX, the server gets 64 threads, the load generator sits on separate cores. You write your own entry (a Dockerfile, the handlers, a meta.json), open a PR, and the maintainer runs the benchmark and commits the results.

Viltrum's entry lives in the repo under benches/httparena/. The first PR was merged on October 14.

How the score is calculated

If you don't understand this, you can't tell which work matters.

  • Each profile is scored from 0 to 1000. The best result in a profile gets 1000, everyone else is scored relative to it. The reference is the whole field, not the view you filtered.
  • The composite is a sum, not an average. If you skip a profile, you get 0 for it. So every missing profile is 1000 points.
  • json-comp has a size penalty. Requests/sec are first multiplied by (smallest response size / your response size)². If your response is twice as big, your score drops to a quarter.
  • The fixed-rate profiles are different. latency-1m, latency-10k and 8gbit fix the request rate. There the score is set by CPU, average latency and p99.
  • Completeness. For each of routing, middleware, request and response that you handle yourself instead of the framework, the composite drops by 2.5%.

On October 21 things looked like this: composite 5267, seventh out of 13 entries in Experimental. json-tls and 8gbit were zero because there was no TLS. 2000 points sitting on the table. json-comp was 418, the weakest scored cell.

So the to-do list wrote itself: TLS first, then json-comp.

Where I measure

My test machine is hostlab: a VMware VM with 8 vCPUs, Xeon E5-2690 v2. My live services run on it too. Not ideal for benchmarking, but it's what I have.

On this VM, ±10% swing from one run to the next is normal. So I have a few rules:

  • Alternate the A/B runs. Instead of running A three times and then B three times, do A, B, A, B, A, B. Whatever mood the VM is in gets spread evenly across both sides.
  • Read ratios, not totals. On this machine one HTTP keep-alive request eats about 80 µs of server CPU, most of it in the kernel. The absolute number can't be compared with the HttpArena machine. "B uses 20% less CPU than A" can.
  • Measure CPU per request. I pin the server to four cores with taskset -c 0-3 and the client to the other four. Before and after the run I read the server's CPU time from /proc/<pid>/stat and divide by the request count. Throughput is noisy, CPU/request is much calmer.
  • Min-of-N for microbenchmarks. The best run is the one with the least noise mixed in.

One more snag: HttpArena's load generator, gcannon, uses io_uring buffer rings, and hostlab's 5.15 kernel can't run that. So I wrote myself a small epoll client. Its only job is to send one request per connection, wait for the response, and write the latency into a histogram.

Before every PR I also run HttpArena's own validate.sh script. The last entry passed 73/73, TLS checks included.

What paid off

In short, biggest to smallest:

  • TLS (1.2.0) and my own AES-GCM record layer (1.3.2). Two zero cells filled. CPU per 10 KB TLS echo cut in half.
  • My own DEFLATE (1.2.2) and the JSON path (1.3.1). json-comp went from 418 to 902.
  • Taking GC pins out of the hot path (1.0.1). A global lock the allocation test couldn't see. On Ryzen, json-comp went from 19.9k to 51.6k requests/sec.
  • The per-fd Conn bug (1.0.3). On HttpArena, short-lived had choked at 158k requests/sec with 2.2 GiB of memory.

In the October 22 run the composite rose to 7011. In the October 23 run, 7786: first in Experimental.

What I didn't chase

In the rankings there's one entry way ahead on json-comp at 2.49 million requests/sec: vanilla-epoll. I looked at how it does it. It caches the compressed responses by (count, parameter) pair. So it never compresses the same request twice.

vanilla-epoll's type is "engine", and that category is scored separately, under its own rules. Framework rules don't allow this. So I didn't do it in my entry. If I bend the rules for points, the points stop meaning anything.

A day later

On October 24 I looked at the table and saw a new name: httparena-io_uring. Behind it is libioxd: written in C23, on top of io_uring, one ring per thread, raw syscalls, TLS records in the kernel (kTLS). It's the personal library of MDA2AV, who runs HttpArena. Entered as Experimental.

It passed me in three profiles:

ProfilelibioxdViltrumGap
Baseline4.25M4.06M4.6%
Short-lived2.74M2.70M1.7%
Async (/delay/10)2.76M2.49M11%

My first question was "did something break?" Nothing had. My numbers were the same. Someone just showed up faster. The composite dropped to 7686, but I'm still first out of 14 entries on HTTP/1.1. Gold went from 9 to 7, silver from 1 to 2, plus a bronze.

On baseline and short-lived we both saturate all 64 cores. The gap is most likely the syscall cost of io_uring versus epoll. 1.7% is small enough to swing from run to run. 4.6% looks more real. Getting it back would need an io_uring path inside the engine, and that's a big job.

Async was telling a different story. There Viltrum was only using 44 of the 64 cores. CPU wasn't the bottleneck. Average latency was 12.77 ms, against 11.53 ms for libioxd. Every request waits 10 ms and the connection count is fixed, so requests/sec is determined entirely by latency.

Where was the extra 1.2 ms coming from? The answer was simple. While the epoll loop waited for the next timer, I was rounding the timeout up to milliseconds. epoll_wait doesn't take any other unit. A response that should have gone out after 0.2 ms went out after 1 ms.

The fix is epoll_pwait2 with a nanosecond timeout. On hostlab, at 64 and 128 connections, three alternating rounds:

ConnectionsRequests/secp50CPU/request
64before~5.8k~11.0 ms57-75 µs
64after~6.15k~10.3 ms71-77 µs
128before~10.9k~11.55 ms52-62 µs
128after~12.2k~10.3 ms62-72 µs

The overshoot above 10 ms went from 1.0-1.7 ms down to 0.3-0.4 ms. The cost is 15-25% more CPU per request, because timers now fire one by one instead of in batches. The HttpArena machine had 20 idle cores, so there's room.

I also tried adding 200 µs of slack and firing timers in batches. It came out almost as bad as before and didn't save any CPU either. Threw it out.

Whether I climb above bronze on async, we'll see in the next run. I can't try 32,000 connections on this VM, so no promises.

What Experimental means

Viltrum's type on HttpArena is "experimental". The default leaderboard shows flagship and emerging entries; to see Experimental you have to tick a checkbox. Scoring is the same, only the view differs.

At first I had put "emerging". The maintainer asked me to change it. The criteria are clear: production use, users, ecosystem. Outside contributions, issues being opened, people talking about it online. Age helps but it's secondary. Having written your own engine also counts against you, because it's one more layer that needs hardening.

He's right. A few outside contributions have come in (the latest is this week's new logo), but real users are close to none so far. That's why the next phase on the roadmap isn't performance, it's community. This post is part of that.

Takeaways

Three things I learned from the benchmark:

  1. Read the scoring formula. A missing profile is 1000 points, json-comp penalizes you by bytes squared. The formula tells you what matters.
  2. Trust ratios, not totals. Even on a noisy VM, alternating A/B and CPU/request get you to the right place.
  3. Losing medals is a good thing. A day earlier I was first and couldn't see the 1 ms rounding bug in async. When someone faster showed up, I saw it.

Results page: http-arena.com/frameworks/viltrum. The entry's code: benches/httparena.

If you spot a mistake in the method, open an issue. Challenging numbers is worth more than publishing them.

← Blog