Improve accuracy in http.md

This commit is contained in:
2025-08-18 16:46:25 -04:00
parent 3a874b0acf
commit 1141251002

19
http.md
View File

@@ -10,8 +10,8 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
#### Accept Threads
- **Configurable number** of dedicated accept threads
- Each thread runs **synchronous accept() loop** on listening socket
- Accept returns file descriptor used to construct connection object
- Each thread calls `accept` in a loop on listening socket
- `accept` returns file descriptor used to construct connection object
- Connection posted to epoll with **EPOLLIN | EPOLLONESHOT** interest
#### Network Threads
@@ -19,10 +19,11 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
- Each thread calls **epoll_wait()** to receive connection ownership
- **EPOLLONESHOT** ensures clean ownership transfer without thundering herd
- Handle connection state transitions and HTTP protocol processing
- Either respond directly or post the connection to a service
#### Service Threads
- **Configurable service pipelines** (e.g., commit and status can share pipeline)
- **Dequeue connections** from shared LMAX Disruptor inspired ring buffer
- **Service Pipelines** (e.g., commit and status can share pipeline)
- **Dequeue connections** from shared LMAX Disruptor inspired ring buffer `src/ThreadPipeline.h`
- Process business logic and generate responses
- **Post completed connections** back to epoll for response writing
@@ -61,7 +62,6 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
#### Ring Buffer Communication
- **Ring buffer** for high-performance inter-thread communication
- **Shared ring buffers** between related services (e.g., commit and status share pipeline)
- **Backpressure handling** via ring buffer capacity limits
### Error Handling
@@ -69,18 +69,18 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
#### Backpressure Response
- **Ring buffer full**: Network thread writes immediate error response
- **Partial write**: Connection re-posted to epoll with write interest
- **Graceful degradation** under high load conditions
- **Connections are rejected** if there are too many concurrent connections.
Tries to maintain a configurable limit (best effort only.)
#### Protocol Errors
- **Malformed HTTP**: Proper HTTP error responses (400 Bad Request, etc.)
- **Partial I/O**: Re-registration with epoll for completion
- **Client disconnection**: Clean connection state cleanup
- **Client disconnection**: Clean up connection state
## Integration Points
### Parser Selection
- **Content-Type header inspection** for parser routing
- **ParserInterface implementation** for format-agnostic parsing
- **CommitRequestParser extensibility** for future format support (protobuf, msgpack)
### Configuration System
@@ -94,7 +94,6 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
### Request Routing
- **Path-based routing** to service handlers
- **Shared ring buffers** for related services with flexible pipeline configuration
- **Handler registration** for extensible endpoint support
## Performance Characteristics
@@ -113,7 +112,6 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
### Resource Management
- **Bounded memory usage** via arena reset and ring buffer limits
- **Graceful backpressure** prevents resource exhaustion
- **Clean connection lifecycle** with deterministic cleanup
## Implementation Phases
@@ -123,7 +121,6 @@ High-performance HTTP server implementation for WeaselDB using epoll-based event
- llhttp integration for request parsing
### Phase 2: Service Integration
- Ring buffer implementation for service communication
- Request routing and handler registration
- Arena-based memory management