Unify accept and network threads into io threads

This commit is contained in:
2025-08-20 16:50:54 -04:00
parent 7e28e6503d
commit 130ff2062a
10 changed files with 157 additions and 216 deletions

View File

@@ -19,7 +19,7 @@ WeaselDB is a high-performance write-side database component designed for system
- **Ultra-fast arena allocation** (~1ns vs ~20-270ns for malloc)
- **High-performance JSON parsing** with streaming support and SIMD optimization
- **Multi-threaded networking** using epoll with thread pools
- **Multi-threaded networking** using epoll with unified I/O thread pool
- **Zero-copy design** throughout the pipeline
- **Factory pattern safety** ensuring correct object lifecycle management
@@ -90,13 +90,13 @@ Ultra-fast memory allocator optimized for request/response patterns:
#### **Networking Layer**
**Server** (`src/server.{hpp,cpp}`):
- **High-performance multi-threaded networking** using epoll with thread pools
- **High-performance multi-threaded networking** using epoll with unified I/O thread pool
- **Factory pattern construction** via `Server::create()` ensures proper shared_ptr semantics
- **Safe shutdown mechanism** with async-signal-safe shutdown() method
- **Connection ownership management** with automatic cleanup on server destruction
- **Pluggable protocol handlers** via ConnectionHandler interface
- **Multi-threaded architecture:** separate accept and network thread pools
- **EPOLL_EXCLUSIVE** load balancing across accept threads
- **Unified I/O architecture:** single thread pool handles both connection acceptance and I/O processing
- **EPOLL_EXCLUSIVE** on listen socket prevents thundering herd across I/O threads
**Connection** (`src/connection.{hpp,cpp}`):
- **Efficient per-connection state management** with arena-based memory allocation