Cassandra Java Driver connection pool saturation and request queuing
24K reputation · 14 Jun 2021, 04:02 UTC
Connection Pool Exhaustion Behavior
Apache Cassandra drivers manage a pool of connections per host to distribute requests across TCP streams. When the volume of in-flight requests exceeds the maxRequestsPerConnection threshold, the driver must decide whether to queue the request locally or signal a failure to the application.
Configuration Constraints
The behavior of the request queue varies between Java Driver 3.x and 4.x architectures. While parameters like pooling.local.max_requests define the saturation point, there is uncertainty regarding the internal trigger mechanisms that differentiate a saturated pool from a node that is considered down.
Specifically, it is unclear how the driver prioritizes reconnection attempts when the pool is marked as exhausted due to request volume versus when a connection is dropped due to network instability.
- Does the driver treat a saturated request queue as a trigger for connection renewal?
- What is the precise mechanism that determines when a
NoHostAvailableExceptionis thrown versus when a request is queued?