Latency (độ trễ per packet), Bandwidth (dung lượng tối đa), và Throughput (data thực sự truyền) là 3 metric khác nhau — tối ưu từng metric cần chiến lược riêng.
Latency: thời gian một packet đi từ A đến B (RTT = round-trip time). Bao gồm: propagation delay (tốc độ ánh sáng, không thể thay đổi), transmission delay (kích thước packet / bandwidth), processing delay (router, load balancer).
Bandwidth: dung lượng tối đa của đường truyền (Mbps/Gbps).
Throughput: data thực sự truyền được trong thực tế — bị ảnh hưởng bởi packet loss, latency, protocol overhead. Throughput ≤ bandwidth.
Bandwidth-Delay Product (BDP): bandwidth × RTT = số bytes 'in flight' tối đa. TCP window size phải >= BDP để không bottleneck.
Tối ưu latency: CDN (giảm physical distance), connection pooling (tránh TCP+TLS handshake mỗi request), HTTP/2 multiplexing, DNS prefetch, giảm số round-trips (batching).
Tối ưu throughput: compression (gzip/brotli giảm bytes), larger TCP window size, HTTP/2 server push, pipelining, tránh head-of-line blocking.
Tối ưu bandwidth: compression, binary protocol (protobuf thay vì JSON), image optimization, lazy loading.
Latency (delay per packet), Bandwidth (maximum capacity), and Throughput (actual data transferred) are 3 distinct metrics — optimizing each requires a different strategy.
Latency: the time a packet takes to travel from A to B (RTT = round-trip time). It includes: propagation delay (speed of light — cannot be changed), transmission delay (packet size / bandwidth), and processing delay (routers, load balancers).
Bandwidth: the maximum capacity of a link (Mbps/Gbps).
Throughput: the actual data transferred in practice — affected by packet loss, latency, and protocol overhead. Throughput ≤ bandwidth.
Bandwidth-Delay Product (BDP): bandwidth × RTT = maximum bytes that can be 'in flight'. The TCP window size must be >= BDP to avoid bottlenecks.
Optimizing latency: CDN (reduce physical distance), connection pooling (avoid TCP+TLS handshake per request), HTTP/2 multiplexing, DNS prefetch, reduce round-trips (batching).
Optimizing throughput: compression (gzip/brotli to reduce bytes), larger TCP window sizes, HTTP/2 server push, pipelining, avoid head-of-line blocking.
Optimizing bandwidth: compression, binary protocols (Protobuf instead of JSON), image optimization, lazy loading.