roadrunner-server / roadrunner

🤯 High-performance PHP application server, process manager written in Go and powered with plugins
https://docs.roadrunner.dev
MIT License
7.87k stars 409 forks source link

[💡FEATURE REQUEST]: Connections pool plugin for the databases [Postgres, MySql, etc]. #919

Open rustatian opened 3 years ago

rustatian commented 3 years ago

Design a plugin that will solve a problem with Postgres (will be first) connections for the PHP workers. At the moment PHP has to use pgBouncer or other tools to initialize a pool of the connections and then re-use them. The idea is to have a plugin that will provide a pool of connections to the PHP. PHP will send a packet to a local listener, then the plugin will take a free connection from the pool, redirect that packet to the Postgres with a reply to the caller.

leeyisoft commented 3 years ago

Looking forward to MySQL and Redis connection pool

wolfy-j commented 3 years ago

Redis is already there if you use it as KV storage.

OO00O0O commented 3 years ago

Would it be possible to implement non-blocking solution? Send multiple queries and wait for response afterwards. Or this is more like proxy?

rustatian commented 3 years ago

Would it be possible to implement non-blocking solution? Send multiple queries and wait for response afterwards. Or this is more like proxy?

Yep, this is a very famous optimization technique. As you can see here: https://www.techempower.com/benchmarks/#section=data-r20&hw=ph&test=query (point your attention to the lithium and drogon) first places occupied frameworks with batch queries. I'm not sure about the time, how long it costs us to develop such a plugin, but the idea is to support much more features, than just a simple proxy :)

Also, the design stage for this plugin will be closer to the end of the year.