You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pooled connections are reused by sessions and transactions to avoid the overhead added by establishing new connections for every query.
371
+
The connection pool always starts up empty.
372
+
New connections are created on demand by sessions and transactions.
373
+
When a session or a transaction is done with its execution, the connection will be returned to the pool to be reused.
374
+
375
+
Application users can tune connection pool settings to configure the driver for different use cases based on client performance requirements and database resource consumption limits.
376
+
377
+
Detailed descriptions of connection pool settings available via driver configuration are listed below:
378
+
379
+
`MaxConnectionLifetime`::
380
+
Pooled connections older than this threshold will be closed and removed from the pool.
381
+
Such removal happens during connection acquisition so that new session is never backed by an old connection.
382
+
Setting this option to a low value will cause a high connection churn and might result in a performance drop.
383
+
It is recommended to set driver's maximum lifetime to a value smaller than the maximum lifetime configured in its application system infrastructure (such as operation system, router, load balancer, proxy and firewall).
384
+
Negative values result in lifetime not being checked.
385
+
Default value: 1h.
386
+
387
+
`MaxConnectionPoolSize`::
388
+
This setting defines the maximum total number of connections allowed to be managed by the connection pool on each host.
389
+
In other words, for a direct driver, this sets the maximum amount of connections towards a single database.
390
+
For a routing driver this sets the maximum amount of connections towards each cluster member.
391
+
If a session or transaction tries to acquire a connection at a time when the pool size is at its full capacity, it must wait until a free connection is available in the pool or the request to acquire a new connection times out.
392
+
The connection acquiring timeout is configured via `ConnectionAcquisitionTimeout`.
393
+
Default value: This is different for different drivers, but is a number in the order of 100.
394
+
395
+
`ConnectionAcquisitionTimeout`::
396
+
This setting limits the amount of time a session or transaction can spend waiting for a free connection to appear in the pool before throwing an exception.
397
+
The exception thrown in this case is `ClientException`.
398
+
Timeout only applies when connection pool is at its max capacity.
A routing driver contains a load balancer to route queries evenly among many cluster members.
486
+
The built-in load balancer provides two strategies: `least-connected` and `round-robin`.
487
+
The `least-connected` strategy in general gives a better performance as it takes query execution time and server load into consideration when distributing queries among the cluster members.
0 commit comments