Pro Tip
You can never scale a system if you do not fundamentally understand how servers talk to each other. Deep knowledge of WebSockets versus Long Polling is guaranteed to be tested.
1. TCP vs UDP: Choosing Your Transport Layer
TCP is connection-oriented and guarantees delivery (three-way handshake). UDP is connectionless and fires packets without checking if they arrive. If you are building a video streaming or gaming backend, use UDP. If you are building a financial ledger, use TCP.
2. HTTP/REST vs RPC/gRPC
REST uses standard HTTP methods (GET, POST) and usually deals with JSON. It is universally understood. **gRPC** uses Protocol Buffers directly over HTTP/2, packing data in binary format instead of text. It is significantly faster and excellent for internal microservice communication.
protobuf
// example.proto defining a fast gRPC service
syntax = "proto3";
service PaymentGateway {
rpc ProcessTransaction (PaymentRequest) returns (PaymentResponse);
}
message PaymentRequest {
string user_id = 1;
double amount = 2;
string currency = 3;
}
message PaymentResponse {
bool success = 1;
string transaction_id = 2;
}3. WebSockets vs Server-Sent Events (SSE)
If you are building a chat application or stock ticker, REST is terrible because the client must constantly "poll" the server. WebSockets provide a persistent, bi-directional connection. SSE provides a unidirectional stream (Server pushes to Client).
Take the Phase Interview
Solidify your knowledge. We will ask you 5 random highly-technical questions from the HLD Phase 1: Networking & Protocols bucket. A Staff Engineer AI will strictly evaluate your answers.