Connection pooling tái sử dụng một tập các connection Redis đã thiết lập qua nhiều request thay vì mở và đóng một connection cho mỗi thao tác. Nó quan trọng cho hiệu năng và hiệu quả tài nguyên trong các ứng dụng xử lý request đồng thời, và hầu hết các Redis client pool theo mặc định.
Vấn đề: chi phí connection
Opening a new connection per request is wasteful:
→ TCP handshake + (TLS handshake) + AUTH on EVERY request → latency + CPU
→ many short-lived connections exhaust file descriptors / Redis's client limit
→ Under load, creating/destroying connections becomes a real bottleneck.
Connection pooling: tái sử dụng connection
redis = ({
: ,
});
