Subtracks & Tasks
TCP From Scratch
Build a TCP Echo Server from Raw Syscalls
Build a TCP echo server using raw syscalls. No standard library network abstractions allowed. The server should: 1. Create a socket using `socket(AF_...
Add a Connection Pool with Configurable Backlog
Extend your TCP server to accept up to N concurrent connections. When N is exceeded, queue new connections in a backlog. If the backlog is also full, ...
Implement Graceful Shutdown with In-Flight Drain
Implement graceful shutdown: when the server receives a shutdown signal, it should drain all in-flight requests before closing sockets. New connection...
Implement Application-Level TCP Keep-Alive
Implement application-level TCP keep-alive detection. If a client goes silent for more than 30 seconds, detect it and close the connection. Use period...
Benchmark Server Throughput and Latency
Measure your TCP server's throughput (requests/sec) and latency (p50, p95, p99). Profile where the bottleneck is. Implement a benchmark framework: `...
Message Framing and Serialization
Implement Length-Prefixed Message Framing
TCP is a byte stream, not a message protocol. You need framing to know where one message ends and the next begins. Length-prefixed framing prepends ea...
Implement Line-Delimited Framing (Redis RESP Style)
Implement line-delimited framing where messages end with `\r\n`. This is the approach used by Redis RESP, HTTP/1.1 headers, and SMTP. The challenge: ...
Implement a Binary Serialization Format
Implement a binary serialization format (similar to MessagePack). Support four types: integers, strings, arrays, and maps. Compare size and performanc...
Add Message Compression with CPU-Bandwidth Tradeoff Analysis
Add compression to your message framing. Benchmark the CPU vs bandwidth tradeoff at different payload sizes to determine when compression helps versus...
Implement Protocol Versioning with Backward Compatibility
Implement a protocol versioning scheme. The sender includes a `protocol_version` in the header. The receiver handles backward compatibility for older ...
gRPC and Protocol Buffers
Define and Encode Protocol Buffer Messages
Protocol Buffers use a schema definition (.proto file) and a compact binary wire format. Each field has a number, type, and wire encoding. Wire forma...
Implement a gRPC Unary RPC Service
Implement a gRPC-style unary RPC service. In unary RPC, the client sends exactly one request and receives exactly one response. gRPC message format o...
Implement gRPC Server and Bidirectional Streaming
Implement gRPC streaming RPCs: 1. **Server streaming**: Client sends one request, server sends a stream of responses 2. **Bidirectional streaming**: ...
Build gRPC Interceptors for Logging, Auth, and Rate Limiting
Build a gRPC interceptor pipeline. Interceptors are middleware that wrap gRPC handler calls, running logic before and after the actual service method....
Compare gRPC vs REST: Latency, Size, and DX
Compare gRPC and REST across multiple dimensions. Build both a REST-style and gRPC-style endpoint for the same service and measure the differences. I...
Concepts Covered
Prerequisites
It is recommended to complete the previous tracks before starting this one. Concepts build progressively throughout the curriculum.