tencent cloud

Feedback

Connection Pool Overview

Last updated: 2024-06-18 16:33:11
    TencentDB for MySQL database proxy supports the connection pool feature, currently offering session-level and transaction-level connection pools, which can effectively solve the issue of high instance loads due to frequent establishments of new connections by short connection services. This document introduces the features of session-level connection pool.

    Prerequisites

    The database kernel minor version is MySQL 5.7 20211030 or later.
    The database kernel minor version is MySQL 8.0 20230630 or later.
    Note:
    The database proxy connection pool capability has been identified to cause deadlock issues during the 'change user' operation in earlier minor versions of the MySQL kernel. This issue has been rectified in the MySQL 8.0 20230630 minor kernel version. If the minor kernel version of your primary instance has not been updated to MySQL 8.0 20230630, there is a certain level of risk involved. It is recommended to disable the database proxy connection pool capability. If you want to continue utilizing the database proxy connection pool capability, it is advised to upgrade the minor kernel version of your primary instance to MySQL 8.0 20230630 or later. For instructions on upgrading, refer to upgrading kernel minor version.

    Background

    Session-level connection pool

    
    The session-level connection pool is applicable to non-persistent connection scenarios.
    The session-level connection pool is used to reduce the instance load caused by frequent establishments of new non-persistent connections. If a client connection is closed, the system will determine whether the current connection is idle, and if so, the system will put it into the proxy connection pool and retain it for a short period of time. When the client initiates a new connection, if the connection pool has an available connection, the connection can be used directly to reduce the database connection overheads; otherwise, a new connection will be established as usual.
    Note:
    The session-level connection pool does not reduce the number of concurrent connections to the database, but it can reduce the overheads of the main thread of TencentDB for MySQL by lowering the speed for connecting the application to the database, so as to better process business requests. However, idle connections in the connection pool will occupy your connection quantity temporarily.
    The session-level connection pool cannot be used to solve the problem of connection heap caused by a large number of slow SQL queries, which must first be solved by yourself.

    Notes

    Currently, the connection pool feature does not support setting different permissions for different IPs under the same account, as that may cause a permission error during connection reuse. For example, if mt@test123 has database_a permissions, while mt@test456 does not, a permission error may occur when you enable the connection pool.
    The connection pool feature is for the database proxy instead of the client. You don't need to use the connection pool of the database proxy if your client already supports it.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support