-
Couldn't load subscription status.
- Fork 38
Open
Description
Currently, when you start an application using MySQL/OTP+Poolboy, you immediately see a number of connections to the DB server. Most of them are idle.
This is an idea of reducing the number of connections to the server to what is actually needed. With MySQL/OTP 1.6.0, no error is logged when the server disconnects. This, with the new lazy connect strategy, allows us to have a more server-friendly approach:
- Change poolboy strategy to LIFO (which is the default for poolboy, so we just remove the
{strategy, fifo}option) - Turn off keep-alive
- Set connect strategy to lazy
The scenario would look like this:
- Poolboy starts starts a pool of workers. The workers don't connect to the DB yet.
- When a worker is used and a query is executed, the worker connects to the DB.
- On load spikes, more workers are used, thus more workers connect to the DB.
- When the load goes down, the last connected nodes will be disconnected because of inactivity. (The timeout can be set on the server side.) This causes poolboy to restart the worker, but it will be started in disconnected (lazy connect) state.
I suggest we make these options the default in this project.
Metadata
Metadata
Assignees
Labels
No labels