Benchmarks
Mach is designed for high-performance HTTP workloads.
This page measures the performance of Mach across several workloads, from minimal request handling to controller-based endpoints with dependency injection.
Test Environment
Section titled “Test Environment”All benchmarks were run on the same machine under identical conditions.
| Component | Configuration |
|---|---|
| CPU | Intel Core i7-13620H (13th Gen) |
| Memory | 32 GB |
| OS | Ubuntu 24.04.4 LTS |
| Compiler | GCC 13.3.0 |
| Build | Release |
Methodology
Section titled “Methodology”Benchmarks were performed using wrk.
| Setting | Value |
|---|---|
| Threads | 16 |
| Connections | 100 |
| Warm-up | 5 seconds |
| Measurement | 30 seconds |
| Runs | 5 per workload |
| Reported throughput | Median of 5 runs |
Each workload is run using a fresh Mach process. After a 5-second warm-up, the workload is measured five times for 30 seconds using the same server process.
The benchmark client and Mach server run on the same machine. Results therefore measure the complete local HTTP path and are intended primarily to compare framework overhead across workloads under consistent conditions.
Results
Section titled “Results”| Workload | Requests/sec | p99 latency |
|---|---|---|
| Plain Text | 273,576 | 410 μs |
| JSON | 269,754 | 406 μs |
| Routing | 266,533 | 411 μs |
| JSON Binding | 248,484 | 437 μs |
| Minimal API | 250,477 | 439 μs |
| Controller | 244,758 | 447 μs |
| Controller + DI | 244,705 | 447 μs |
Throughput is the median of five measured runs. The reported p99 latency is the median p99 latency across those runs.
Plain Text
Section titled “Plain Text”Handles a minimal HTTP request and returns a small plain-text response.
GET /plaintext273,576 requests/sec
This workload provides a baseline for Mach’s HTTP request and response overhead.
Returns a small object serialized as JSON.
GET /json269,754 requests/sec
This measures request handling together with Mach’s JSON response serialization.
Routing
Section titled “Routing”Matches a parameterized route, extracts a typed route parameter, and returns a JSON response.
GET /users/42266,533 requests/sec
This includes parameterized routing and typed route-value extraction.
JSON Binding
Section titled “JSON Binding”Accepts a JSON request body, binds it to a C++ model, and serializes the model back into the response.
POST /users248,484 requests/sec
The request body used for POST benchmarks is:
{ "name": "Alice", "age": 28, "adult": true}Minimal API
Section titled “Minimal API”Combines parameterized routing, typed route extraction, JSON model binding, application logic, and JSON serialization in a minimal API handler.
POST /minimal/users/42250,477 requests/sec
This workload is intended to represent a more complete endpoint while retaining Mach’s minimal API programming model.
Controller
Section titled “Controller”Performs the same core work through a controller action.
POST /controller/users/42/direct244,758 requests/sec
This measures the additional framework path involved in dispatching a request through Mach’s controller model.
Controller + Dependency Injection
Section titled “Controller + Dependency Injection”Runs the controller workload with an injected service and delegates the application operation to that service.
POST /controller/users/42/service244,705 requests/sec
This workload includes parameterized routing, model binding, controller dispatch, dependency injection, service delegation, and JSON serialization.
Sustained Load
Section titled “Sustained Load”Selected workloads were also run continuously for 10 minutes after a 5-second warm-up, using the same 16 threads and 100 connections.
| Workload | Requests | Requests/sec | p99 latency | Errors |
|---|---|---|---|---|
| Plain Text | 167,136,370 | 278,514 | 391 μs | 0 |
| Minimal API | 148,558,049 | 247,556 | 444 μs | 0 |
| Controller + DI | 148,026,240 | 246,670 | 445 μs | 0 |
Across the three sustained-load tests, Mach processed more than 463 million requests over 30 aggregate minutes without a recorded socket or HTTP error.
These tests are intended to verify that throughput remains stable under sustained load. They are not a substitute for application-specific load, memory, or production reliability testing.
Reproducing the Benchmarks
Section titled “Reproducing the Benchmarks”The framework benchmark executable is built with Mach’s benchmark targets enabled:
cmake -S . -B build \ -DCMAKE_BUILD_TYPE=Release \ -DMACH_BUILD_BENCHMARKS=ON
cmake --build build --target FrameworkBenchmarks -j$(nproc)The benchmark runner can then be executed with:
python3 benchmarks/runner/framework_runner.pyThe runner performs the warm-up and measured runs and writes the raw and
summary results to benchmarks/results/.
The results shown on this page were produced from Mach commit 5705b5a.
Raw Results
Section titled “Raw Results”The complete results used on this page are published alongside the benchmark source:
-
framework_wrk_results.csv— individual performance and sustained-load measurements. -
framework_wrk_summary.csv— summarized performance results.
Each result records the benchmark session and Git commit, making the published results traceable to the version of Mach that produced them.
The results reported on this page use benchmark session 20260924_124218
from commit 5705b5a.
Limitations
Section titled “Limitations”These benchmarks measure specific HTTP workloads under controlled conditions. They are intended to characterize Mach’s framework overhead and do not represent the performance of every real-world application.
The benchmark client and server run on the same machine, so these results should not be interpreted as network throughput measurements.
Application architecture, database access, external services, hardware, operating system configuration, compiler settings, and workload characteristics can all have a significantly greater effect on application performance than framework overhead alone.