Comparison
Connection drainingvsConnection pool
Connection draining
the instance is taken out of rotation but its open connections are allowed to finish, instead of being cut mid-response.
Stopping new connections to a backend being removed while letting existing ones complete, up to a timeout. It is the load balancer's half of a clean shutdown, and it must overlap with the workload's own grace period or requests are dropped in the gap. Long-lived connections — websockets, streaming, gRPC — are where a drain timeout tuned for short requests visibly fails.
Full entry →Connection pool
you reuse a fixed set of open database connections instead of paying the handshake on every query.
A cache of established connections shared by application threads. It removes per-request connection setup and, more importantly, bounds how many connections you can throw at the database. Pool size is a capacity decision on the database's behalf: too many and you overwhelm it, too few and requests queue in the application where you may not be measuring.
Full entry →