29 Star 263 Fork 51

GVPlouislivi / SMProxy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README-EN.md 6.47 KB
一键复制 编辑 原始数据 按行查看 历史
louislivi 提交于 2019-06-28 14:24 . Update docs mysql version

English | 中文

  /$$$$$$  /$$      /$$ /$$$$$$$
 /$$__  $$| $$$    /$$$| $$__  $$
| $$  \__/| $$$$  /$$$$| $$  \ $$ /$$$$$$   /$$$$$$  /$$   /$$ /$$   /$$
|  $$$$$$ | $$ $$/$$ $$| $$$$$$$//$$__  $$ /$$__  $$|  $$ /$$/| $$  | $$
 \____  $$| $$  $$$| $$| $$____/| $$  \__/| $$  \ $$ \  $$$$/ | $$  | $$
 /$$  \ $$| $$\  $ | $$| $$     | $$      | $$  | $$  >$$  $$ | $$  | $$
|  $$$$$$/| $$ \/  | $$| $$     | $$      |  $$$$$$/ /$$/\  $$|  $$$$$$$
 \______/ |__/     |__/|__/     |__/       \______/ |__/  \__/ \____  $$
                                                               /$$  | $$
                                                              |  $$$$$$/
                                                               \______/

SMProxy

release forks stars Build Status Gitter license SMProxy Backers on Open Collective Sponsors on Open Collective

Swoole MySQL Proxy

A MySQL database connection pool based on MySQL protocol and Swoole.

Principle

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:

  • The initial number of connections
  • Min / Max number of connections
  • Number of max requests per connection
  • Max idle time of connections

...etc.

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.

Features

  • Read/Write Splitting
  • Connection Pool
  • SQL92 Standard
  • Coroutine Scheduling
  • Multiple database connections, multiple databases, multiple users...
  • Build with MySQL native protocol, cross-language, cross-platform.
  • Compatible with MySQL Transaction
  • Compatible with HandshakeV10
  • Compatible with MySQL 5.5 - 8.0
  • Compatible with Various Frameworks

Why This

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.

Contributing & Discussing

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

PHP
1
https://gitee.com/louislivi/smproxy.git
git@gitee.com:louislivi/smproxy.git
louislivi
smproxy
SMProxy
master

搜索帮助