SMProxy (Swoole MySQL Proxy) is a MySQL database connection pool developed by Swoole based on the MySQL protocol.
principle
The database connection is stored in memory as an object. When the user needs to access the database, a connection will be established for the first time. Later, instead of establishing a new connection, an established idle connection object will be taken out from the connection pool. After use, the user does not close the connection, but puts the connection back into the connection pool for the next request. The establishment and disconnection of connections are managed by the connection pool itself.
At the same time, you can also control the initial number of connections in the connection pool, the upper and lower limits of connections, the maximum number of uses of each connection, the maximum idle time, etc. by setting the parameters of the connection pool. It can also monitor the number, usage, etc. of database connections through its own management mechanism. If the maximum number of connections is exceeded, the coroutine will be suspended. Wait until a connection is closed before resuming the coroutine to continue operation.
characteristic
Support reading and writing separation
Supports database connection pool, which can effectively solve the database connection bottleneck caused by PHP
Supports SQL92 standard
Use coroutine scheduling
Support multiple database connections, multiple databases, multiple users, flexible matching
Comply with MySQL native protocol, cross-language, cross-platform universal middleware agent
Support MySQL transactions
Support HandshakeV10 protocol
Perfectly compatible with MySQL5.5 - 8.0
Compatible with major frameworks to seamlessly improve performance