English | 中文
/$$$$$$ /$$ /$$ /$$$$$$$ /$$__ $$| $$$ /$$$| $$__ $$ | $$ \__/| $$$$ /$$$$| $$ \ $$ /$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$ | $$$$$$ | $$ $$/$$ $$| $$$$$$$//$$__ $$ /$$__ $$| $$ /$$/| $$ | $$ \____ $$| $$ $$$| $$| $$____/| $$ \__/| $$ \ $$ \ $$$$/ | $$ | $$ /$$ \ $$| $$\ $ | $$| $$ | $$ | $$ | $$ >$$ $$ | $$ | $$ | $$$$$$/| $$ \/ | $$| $$ | $$ | $$$$$$/ /$$/\ $$| $$$$$$$ \______/ |__/ |__/|__/ |__/ \______/ |__/ \__/ \____ $$ /$$ | $$ | $$$$$$/ \______/
A MySQL database connection pool based on MySQL protocol and Swoole.
Store the database connection as an object in memory. When users need to access the database, a connection will be established for the first time. After that, instead of establishing a new connection, free connections will be retrieved from the connection pool when users require. Also, users don't need to close connection but put it back into the connection pool for other requests to use.
All these things, connecting, disconnecting are managed by the connection pool itself. At the same time, you can also configure the parameters of the connection pool, like:
It's also possible to monitor the number of database connections, usage, etc. through its own management system.
If the maximum number of connections is exceeded, the coroutine will be suspended and wait until a connection is released.
For early design reasons, PHP does not have a native connection pool. So the number of database connections will be easily increasing and reaching the maximum when we got lots of requests. Using one of many database middlewares like Mycat will cause some limitations, e.g. batch inserts. And it's also too heavy in most cases. So we created SMProxy using 100% PHP + Swoole, which only supports connection pool and read/write separation, but much more lightweight. Not like Mycat, we're trying to build SMProxy with Swoole Coroutine to schedule HandshakeV10 packet forwarding, so we don't have to parse all SQL packets. That really makes SMProxy more stable and reliable.
This project exists thanks to all the people who contribute. [Contribute].
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]
：Code submit frequency
：React/respond to issue & PR etc.
：Well-balanced team members and collaboration
：Recent popularity of project
：Star counts, download counts etc.