Connection pooling นำชุด connection ของ Redis ที่สร้างไว้แล้วกลับมาใช้ซ้ำข้ามหลายคำขอ แทนที่จะเปิดและปิด connection สำหรับทุกการดำเนินการ มันสำคัญต่อประสิทธิภาพและการใช้ทรัพยากรอย่างมีประสิทธิภาพในแอปพลิเคชันที่จัดการคำขอพร้อมกัน และไคลเอนต์ Redis ส่วนใหญ่ทำ pooling โดยค่าเริ่มต้น
ปัญหา: overhead ของการเชื่อมต่อ
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: นำ connection กลับมาใช้ซ้ำ
redis = ({
: ,
});
