Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions frameworks/blitz/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:bookworm-slim AS build
RUN apt-get update && apt-get install -y wget xz-utils && \
wget -q https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz && \
tar xf zig-linux-x86_64-0.14.0.tar.xz && \
mv zig-linux-x86_64-0.14.0 /usr/local/zig
ENV PATH="/usr/local/zig:$PATH"
WORKDIR /app
COPY build.zig build.zig.zon ./
COPY src ./src
RUN zig build -Doptimize=ReleaseFast

FROM debian:bookworm-slim
COPY --from=build /app/zig-out/bin/blitz /server
EXPOSE 8080
CMD ["/server"]
37 changes: 37 additions & 0 deletions frameworks/blitz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# blitz ⚡

A blazing-fast HTTP/1.1 server written in Zig, built to compete in [HttpArena](https://github.com/MDA2AV/HttpArena).

## Design

- **Language:** Zig — C-level performance with better ergonomics
- **I/O:** epoll with edge-triggered notifications
- **Threading:** SO_REUSEPORT multi-threading (one accept socket per core, no lock contention)
- **Parsing:** Zero-copy HTTP request parsing
- **Responses:** Pre-computed static responses, pipeline batching
- **Memory:** Arena-style per-connection buffers, minimal heap allocations in hot path

## Endpoints

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/pipeline` | GET | Returns "ok" — pipelining benchmark |
| `/baseline11` | GET/POST | Query param sum, optional body parsing |
| `/baseline2` | GET | Query param sum (H2 baseline) |
| `/json` | GET | Pre-computed JSON dataset response |
| `/upload` | POST | Returns body byte count |
| `/static/{file}` | GET | Pre-loaded static files |

## Building

```bash
zig build -Doptimize=ReleaseFast
```

## Running

```bash
./zig-out/bin/blitz
```

The server listens on port 8080 and spawns one worker thread per available CPU core.
23 changes: 23 additions & 0 deletions frameworks/blitz/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const exe = b.addExecutable(.{
.name = "blitz",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.single_threaded = false,
});

exe.linkLibC();

b.installArtifact(exe);

const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the server");
run_step.dependOn(&run_cmd.step);
}
10 changes: 10 additions & 0 deletions frameworks/blitz/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.{
.name = .blitz,
.version = "0.1.0",
.fingerprint = 0xe8a54ff4e60f9038,
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
}
17 changes: 17 additions & 0 deletions frameworks/blitz/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"display_name": "blitz",
"language": "Zig",
"type": "engine",
"engine": "epoll",
"description": "Custom Zig HTTP server built on epoll with SO_REUSEPORT multi-threading. Zero allocations in the hot path, pre-computed responses, pipeline batching.",
"repo": "https://github.com/BennyFranciscus/blitz",
"enabled": true,
"tests": [
"baseline",
"pipelined",
"noisy",
"limited-conn",
"json",
"upload"
]
}
Loading
Loading