help icon indicating copy to clipboard operation
help copied to clipboard

MySQL pool connection.

Open Wodki opened this issue 8 years ago • 2 comments

This is more of a generic question but an important one for me.

Since one can create one connection and keep it alive as long as whatever process is connected to it is alive too, and librarys can keep it healthy (upon failing etc) why would one use a pool.

I can not understand where the performance enhancement comes into to play. The querys are just getting queued the same way they would with one connection. There is no 'parallel' processing.

Also assuming the process and the DB are in the same server there is no time lost sending the request over the network. In addition no time is lost connecting, and ending the connection with either option.

I can only see the demerits such as making sure the data selected are not currently getting updated by another connection, thus receiving old data etc.

I wanted to boost the performance of my MySQL DB and make it more scalable as I stumbled upon the pool vs 1 permanent connection argument without being sure if I should change or not.

Wodki avatar Mar 15 '18 12:03 Wodki

There are articles/blogs out there that discuss aspects of this. Try this. Connection pooling is also language neutral, so you might also consider discussion elsewhere, such as here.

Ultimately, your mileage and circumstance might vary : it will depend on the nature of your deployment, and how you tackle scaling and clustering, for example. And, your client(s) may not be exploiting parallel processing, but instead are mostly only distributed systems, but many database servers are actually parallel processing engines.

shellberg avatar Mar 15 '18 13:03 shellberg

Closing as answered.

gireeshpunathil avatar Mar 29 '18 05:03 gireeshpunathil