Chinese | English
/$$$$$$ /$$ /$$ /$$$$$$$
/$$__ $$| $$$ /$$$| $$__ $$
| $$ __/| $$$$ /$$$$| $$ $$ /$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$
| $$$$$$ | $$ $$/$$ $$| $$$$$$$//$$__ $$ /$$__ $$| $$ /$$/| $$ | $$
____ $$| $$ $$$| $$| $$____/| $$ __/| $$ $$ $$$$/ | $$ | $$
/$$ $$| $$ $ | $$| $$ | $$ | $$ | $$ >$$ $$ | $$ | $$
| $$$$$$/| $$ / | $$| $$ | $$ | $$$$$$/ /$$/ $$| $$$$$$$
______/ |__/ |__/|__/ |__/ ______/ |__/ __/ ____ $$
/$$ | $$
| $$$$$$/
______/
A MySQL database connection pool developed by Swoole based on the MySQL protocol.
Store the database connection as an object in memory. When the user needs to access the database, a connection will be established for the first time. 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, and the coroutine will be resumed until a connection is closed to continue the operation.
PHP does not have a connection pool, so the database will be full of connections when concurrency is high. Database middleware such as Mycat will cause some SQL to be unusable. For example, batch addition is not supported, and it is too bloated. So I wrote this lightweight middleware myself that only supports connection pooling and read-write separation. Using Swoole coroutine to schedule HandshakeV10 protocol forwarding makes the program more stable. It does not need to parse all SQL package bodies like Mycat, which increases complexity.
Because of you, SMProxy can reach this point.
Thank you to all our backers! [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]