Proxies, APIs and Real-Time Protocols

Pick REST, RPC, queues, long polling, WebSockets, TCP or UDP based on the interaction shape.

Advanced⏱ 1 min readLesson 10 of 30#system-design#api#websocket#tcp#udp#proxy

Communication choices: reverse proxy at the edge, request APIs, queues and persistent real-time connectionsCommunication choices: reverse proxy at the edge, request APIs, queues and persistent real-time connections

NeedGood starting pointTrade-off
Public resource APIREST over HTTPSFamiliar and cache-friendly
Internal typed callgRPC/RPCTighter coupling
Slow workQueueEventual result and lag
Occasional updatesLong pollingRepeated connections
Live two-way chatWebSocketConnection lifecycle/fan-out
Ordered reliable bytesTCPMore overhead
Loss-tolerant mediaUDP/QUICApp tolerates loss/reordering

A forward proxy represents clients. A reverse proxy represents servers: it can terminate TLS, route, cache and rate-limit. A queue is not a WebSocket, and a WebSocket is not a durable message log.