Skip to content

Commit d311f11

Browse files
committed
v check-md examples/vanilla_http_server
1 parent c4c0be6 commit d311f11

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

examples/vanilla_http_server/DATAFLOW.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Vanilla HTTP Server - Data Flow
22

3-
This document describes the complete data flow through the high-performance HTTP server, from connection establishment to response delivery.
3+
This document describes the complete data flow through the high-performance HTTP server, from
4+
connection establishment to response delivery.
45

56
## System Architecture Overview
67

@@ -347,11 +348,15 @@ Results:
347348
**Future Optimizations:**
348349

349350
- **io_uring**: Zero-copy I/O with submission/completion queues, eliminating syscall overhead
350-
- **Batched sends**: Use `writev()` or `sendmsg()` with scatter-gather to send response in one syscall
351-
- **Response caching**: Pre-serialize common responses at startup, bypass routing/handler for cache hits
351+
- **Batched sends**: Use `writev()` or `sendmsg()` with scatter-gather to send response in one
352+
syscall
353+
- **Response caching**: Pre-serialize common responses at startup, bypass routing/handler for
354+
cache hits
352355
- **CPU affinity**: Pin worker threads to specific cores to improve cache locality
353356
- **DPDK bypass**: Bypass kernel network stack entirely for maximum throughput (userspace TCP/IP)
354-
- **HTTP/2 multiplexing**: Share single connection for multiple requests, reduce connection overhead
357+
- **HTTP/2 multiplexing**: Share single connection for multiple requests, reduce connection
358+
overhead
355359
- **JIT compilation**: V's `-prod` with PGO (profile-guided optimization) for hot paths
356360
- **Memory pool**: Pre-allocate buffers in arena to eliminate allocation overhead
357-
- **Lock-free queues**: If cross-worker communication needed, use MPSC queues instead of shared epoll
361+
- **Lock-free queues**: If cross-worker communication needed, use MPSC queues instead of shared
362+
epoll

examples/vanilla_http_server/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ Running 10s test @ http://localhost:3001
2020

2121
### Core Design
2222

23-
- **Per-worker listen sockets**: Each thread has its own listening socket using SO_REUSEPORT to avoid contention
24-
- **Distributed accept**: Accepts are handled in worker threads via EPOLLEXCLUSIVE to prevent thundering herd
23+
- **Per-worker listen sockets**: Each thread has its own listening socket using SO_REUSEPORT to
24+
avoid contention
25+
- **Distributed accept**: Accepts are handled in worker threads via EPOLLEXCLUSIVE to prevent
26+
thundering herd
2527
- **Edge-triggered epoll**: EPOLLET mode for efficient event processing
2628
- **Keep-alive connections**: Reuse connections across multiple requests
2729
- **Non-blocking I/O**: All sockets are non-blocking with accept4(SOCK_NONBLOCK)

0 commit comments

Comments
 (0)