接続プーリングは、操作ごとに接続を開閉する代わりに、確立されたRedis接続のセットを多くのリクエストで再利用します。並行リクエストを処理するアプリケーションのパフォーマンスとリソース効率にとって重要であり、ほとんどのRedisクライアントはデフォルトでプーリングを行います。
問題: 接続のオーバーヘッド
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.
接続プーリング: 接続を再利用
redis = ({
: ,
});
