A C++17 message queue project focused on high-throughput data path, low-overhead networking, and production-style concurrency control.
Role: Core Developer | Focus: System Design / Network IO / Storage Engine / Concurrency
Workload
- 4,000,000 messages
- Message size: ~200-300B
- End-to-end push + pull + commit path
Hardware
- Client: Intel i7-12650H, NVMe SSD
- Server: Intel i7-12650H, NVMe SSD
| Metric | Throughput | Path Definition |
|---|---|---|
| Push (Producer) | ~331,198 msg/s | User API -> Server Page Cache -> ACK -> Client Callback |
| Pull + commit_sync (Consumer) | ~255,983 msg/s | Fetch -> Parse -> Consume -> Commit |
Notes: Numbers are measured on my local setup and intended to show engineering direction/capability, not universal peak claims.
- Designed and implemented a full C++ MQ stack (client + broker) rather than a toy queue API.
- Built around batch-first data path to reduce syscall and protocol overhead.
- Implemented epoll ET + TLS + kTLS sendfile path on server side.
- Built log-segment + sparse-index storage with recovery logic.
- Added consumer-group generation fencing and rebalance-aware commit checks.
- Implemented sharded threading model on both server and client hot paths.
- Event loop:
epoll(ET) + non-blocking TLS. - Session abstraction:
TcpSessiondecouples protocol logic from socket lifecycle. - Zero-copy attempt path:
SSL_sendfilewhen kTLS send is available. - Protocol: custom binary frame with fixed 12-byte header:
total_length+event_type+correlation_id+ack_level
- Partitioned append-only log by topic-partition.
- Segment files:
.logfor sequential append.indexfor sparse index lookup
- Startup recovery:
- rebuild index from log
- truncate corrupted tail entries
- Timed flush and segment maintenance are integrated in storage pipeline.
- Server:
- Connection events routed by FD-sharded thread pool
- Same FD tends to stay on same worker for locality and lower contention
- Client:
- Producer batching + ready queue + backpressure
- Consumer parse path uses parallel processing for pulled batches
- Lock strategy:
- shared/exclusive split in storage write path
- reduced critical sections in request handling
- Group state tracks:
generation_idassigned_partitionscurrent_holdingtarget_assignment
- Commit is fenced by:
- member existence
- generation match
- partition ownership validation
- Long-poll requests are aware of rebalance/revocation.
- Language:
C++17 - Network/IO:
epoll, non-blocking socket,OpenSSL,kTLS/sendfile - Concurrency:
Intel TBB, sharded thread pool,moodycamelqueues - Storage: append log, sparse index, mmap-based index operations
- Compression/Integrity:
ZSTD,CRC32 - Build:
CMake
- API Guide (CN):
docs/API_Guide.md - API Guide (EN):
docs/API_Guide_EN.md - Architecture (Code-Fact):
docs/Architecture_Design.md
cd server
mkdir -p build
cd build
cmake ..
cmake --build .Runtime requirements:
- valid
server.crtandserver.keyin runtime directory
cd client
mkdir -p build
cd build
cmake -G "MinGW Makefiles" ..
cmake --build .- Public API:
client/include/MYMQ_C.h - Client core:
client/src/MYMQ_Client.cpp - Client transport:
client/src/Communication.h - Broker core:
server/src/MessageQueue.h - Broker network:
server/src/Server.h - Storage core:
server/src/Logsegment.h - Group coordinator state:
server/include/MYMQ_Server_ns.h
MIT (LICENSE)