Skip to content

2.27.0.0-b510

tagged this 30 Aug 10:52
Summary:
This update introduces the capability to define the maximum percentage of total physical YSQL connections that the connection manager can create. This is controlled by a new flag, ysql_conn_mgr_max_phy_conn_percent, which is set to **85% by default**.

With multi-route pooling, this means the connection manager can create up to 85% of the total physical YSQL connections. With non-multi-route pooling, this 85% limit is further subdivided by default: 10% is allocated to the control connection pool and 90% to the global pool.

**BENEFITS**

- Connection Reservation: Users can define the percentage of total physical YSQL connections that the connection manager can create, while the rest can be used to connect directly to the PostgreSQL endpoint.

- Prevents Connection Errors: Tuning this flag value ensures the connection manager does not exceed the limit for non-replication superuser connections in PostgreSQL, even when demand is high. In this case, it will wait for connections to become idle rather than creating new ones.

- Race Condition Safety: If race conditions cause the number of physical connections to marginally exceed the configured percentage, the total count will still remain under the global ysql_max_connections limit, preventing errors. Therefore it's a conservative approach for being every time within the max limit of physical connections that can be created.

All the java unit tests, is made to run with 85% of default limit as well.
Modified one connection manager test (`TestDefaultConfig.java`) to run with 100% usage. The test reads the connection manager conf file and expects connection manager to use all the available physical connections.

Jira: DB-17300

Test Plan:
Jenkins: enable connection manager, all tests

Added a test: `org.yb.ysqlconnmgr.TestYsqlMaxConnectionsPercentage#testYsqlMaxConnectionsPercentage`

Reviewers: skumar, arpit.saxena, vikram.damle, asrinivasan, rbarigidad

Reviewed By: skumar, arpit.saxena

Subscribers: svc_phabricator, yql

Differential Revision: https://phorge.dev.yugabyte.com/D45070
Assets 2
Loading