The http4k server backends are a very thin adapter over the raw server APIs, so they run at very low overhead compared to the bare server. We’ll be straight with you though: our north star is developer experience, not topping a leaderboard. Happily, you rarely have to choose.
http4k is entered into the TechEmpower Framework Benchmarks - an independent project that runs frameworks through a series of realistic tests. No custom tuning of the underlying servers: the default app HttpHandler is plugged into each backend, exactly as you’d write it.
JVM command-line options were tuned to take advantage of JVM features. The full implementation is public on GitHub.
// one HttpHandler, every backend val app: HttpHandler = routes( "/json" bind GET to { Response(OK) .with(jsonLens of Message("Hello")) }, "/plaintext" bind GET to { Response(OK).body("Hello, World!") } ) // plug into Netty, Jetty, Apache...
Rankings below are filtered to JVM libraries, best backend shown per test. Each links to the live TechEmpower data. Lower rank is better.
The headline, all-round score across every test type.
Backends & drivers vary per test (Apache, Jetty Loom, Netty; PostgreSQL / Vert.x with a Hikari pool; Rocker templating). See the full Round 22 data.
Chasing the very top of a benchmark table tends to produce hostile, un-http4k-like APIs. We'd rather give you friendly, testable, composable code that still lands comfortably in the top half of the JVM pack. For the vast majority of real systems, http4k is nowhere near your bottleneck - your database is.
Swap Netty for Jetty Loom for Apache with one line, and benchmark what actually matters: your app.
