Releases: awneesht/Strike-mq
v0.1.5 — io_uring Kernel Bypass & Latency Optimizations
What's New
StrikeMQ v0.1.5 brings sharded storage locks, circular I/O buffers, and an optional io_uring event loop on Linux — delivering measured 4.4μs p99.9 produce latency (log append path).
Performance (measured)
| Metric | p50 | p99.9 |
|---|---|---|
| Log append 1KB | 83 ns | 4.4 μs |
| SPSC ring push+pop | — | 42 ns |
| Pool alloc+free | — | 42 ns |
| Kafka header decode | — | 42 ns |
New Features
-
ShardedLogMap<64> — 64 cache-line-aligned shards replace the global
logs_mumutex. Concurrent Produce/Fetch/ListOffsets to different shards never contend on the same lock. -
FixedCircularBuffer — Power-of-2 ring buffer (128KB) replaces
std::vector<uint8_t>for connection I/O. Monotonic head/tail counters with bitmask wrapping — all operations O(1). Eliminateserase(begin, begin+n)reallocation overhead. -
io_uring event loop (Linux,
STRIKE_IO_URING) — Submission-based I/O withio_uring_prep_recv/io_uring_prep_send. Attempts SQPOLL first (kernel-side submission thread), falls back gracefully. -
MAP_POPULATE + pre-fault — Linux segment mmaps avoid TLB misses on initial writes. First 2MB of each new segment is pre-faulted.
-
SO_BUSY_POLL — Optional busy-poll on accepted sockets (Linux) for reduced wakeup latency.
-
1ms event loop timeout — All event loops (kqueue, epoll, io_uring, acceptor) reduced from 100ms to 1ms.
-
String hoisting in decode paths — One string copy per topic instead of per partition in Kafka protocol decoders.
New Config Fields
| Parameter | Default | Description |
|---|---|---|
busy_poll |
false |
Enable SO_BUSY_POLL on accepted sockets (Linux) |
io_uring_sq_entries |
256 |
io_uring submission queue size |
io_uring_buf_count |
512 |
io_uring registered buffer count |
New Tests
strikemq_test_circular_buffer— FixedCircularBuffer unit testsstrikemq_test_sharded_log_map— ShardedLogMap unit tests- All 5/5 tests pass on macOS
Verified On
- macOS (Apple Silicon, kqueue) — build + 5/5 tests + kcat smoke test + HTTP API
- Smoke test with kcat (produce, consume, keyed messages)
Full Changelog
See CHANGELOG.md for detailed changes, design decisions, and file-level diffs.
v0.1.4 — REST/HTTP Admin API
What's New
BlazeMQ now includes a built-in REST API on port 8080 — inspect and control the broker with just curl, no Kafka tooling required.
REST API Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /v1/broker |
Broker info (version, uptime, config) |
| GET | /v1/topics |
List all topics with partition count and offsets |
| GET | /v1/topics/{name} |
Topic detail with per-partition offsets |
| DELETE | /v1/topics/{name} |
Delete a topic and its data |
| GET | /v1/topics/{name}/messages?offset=0&limit=10 |
Peek at messages as JSON |
| POST | /v1/topics/{name}/messages |
Produce messages via JSON body |
| GET | /v1/groups |
List consumer groups |
| GET | /v1/groups/{id} |
Group detail with members and committed offsets |
Quick Example
# Start the broker
./blazemq
# Produce via REST
curl -X POST localhost:8080/v1/topics/demo/messages \
-d '{"messages":[{"value":"hello"},{"key":"k1","value":"world"}]}'
# Peek at messages
curl "localhost:8080/v1/topics/demo/messages?offset=0&limit=10"
# Consume via Kafka — REST-produced messages are fully wire-compatible
kcat -b 127.0.0.1:9092 -C -t demo -eHighlights
- Single-threaded HTTP/1.1 server with kqueue/epoll event loop (own thread)
- Minimal JSON writer — no library dependencies
- Messages produced via REST use Kafka v2 record batch format, consumable by any Kafka client
- Messages produced via Kafka clients are visible through the REST peek endpoint
- CORS headers included for browser-based tools
- Proper error responses with HTTP status codes (400, 404, 405, 413)
Bug Fixes
- Linux build fix — Removed duplicate
size_t/uint64_toverload inJsonWriterthat caused a compilation error on GCC (Linux). On GCC,size_tanduint64_tare the same type (unsigned long), while on Clang (macOS) they are distinct.
Verified On
- macOS (Apple Silicon, kqueue) — all tests pass, full REST + Kafka interop
- Linux (Ubuntu 22.04, GCC 11.4, epoll) — all tests pass, full REST + Kafka interop
Full Changelog
See CHANGELOG.md for detailed changes, design decisions, and verification steps.