brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
20.01k stars 2.93k forks source link

Connection Pooling questions #1448

Open vwalters47 opened 5 years ago

vwalters47 commented 5 years ago

If we are developing 10 microservices and each uses 4 Docker Containers How do you configure HiKariCP to share connections pools. Based on your article about Total number of pools our system should run no more then 200. But we have each pool being set to 25 max That would be a total of 25 x 4 x 10 or 1000 connections 3 times the size. Is there a way to group pools into

  1. Fast quick answers
  2. Medium time
  3. Long running

Then have the MicroServices share the connections starting with 10 min pools 25 max for the max of 75 pools. This would allow adding more connections based on total use of Microservices rather then guessing what is needed

JoyceLikeRose commented 5 years ago

Maybe this answer is close to you need ? please visit: https://github.com/Chris2018998/BeeCP/issues/7

It is regrettable, it was written with Chinese,you can translate it to English in Google tools. BeeCP( found in a issue) maybe faster than HikariCP.

Hope it to help you, thanks

brettwooldridge commented 5 years ago

BeeCP is definitely not faster.

What is the spec. of your DB server? 25 connections sounds high. I would recommend trying minimumIdle=3 and maxPoolSize=10.

JoyceLikeRose commented 5 years ago

There is a test result with HikariCP-benchmark at BeeCP(https://github.com/Chris2018998/BeeCP) page, URL: https://github.com/Chris2018998/BeeCP/blob/master/doc/performance/20190903_I3_7100_HikariCP_Bech_1.png

test source file URL: https://github.com/Chris2018998/BeeCP/blob/master/doc/performance/BenchBase.java

maybe the result was tested with new version(BeeCP_0.96.jar)? or maybe wrong? I don't know, just interesting with it, and studying it.

JoyceLikeRose commented 5 years ago

I don't care about CP performance at all, please help to answer the issue (1444). thanks.

vwalters47 commented 5 years ago

Hi Brett,

The server is configured as follows 11 CPUs 4 Cores each based on your calculation the max CP Queues is 88

Currently there is a TomCat pool of 300 and an IIS pool of 1000 now

SpringBoot is going to have 50 Microservices each has 4 containers running HiKariCP lets take your configurations 50 x 4 200 containers x 3 min setting is 200 50 x 4 200 containers x 10 max setting is 2000 Even at the min setting you don't meet the documented suggested best performance of 88

How can you have a shared Connection Pool configurations

Thanks for your time I am trying to understand how to share with all others.

vwalters47 commented 5 years ago

Hi Brett,

I have not heard back from you on my question . Do you not have a solution for a large install of docker containers? Is your documentations incorrect This is what it states:

The formula below is provided by the PostgreSQL project as a starting point, but we believe it will be largely applicable across databases. You should test your application, i.e. simulate expected load, and try different pool settings around this starting point: connections = ((core_count * 2) + effective_spindle_count)

My question is how to you mange that with say 100 docker containers each running HikariCP

thanks

billoneil commented 5 years ago

Is there a way to group pools into

Fast quick answers Medium time Long running

Yes you just make multiple pools.

If you have many containers all connecting to the same database you are going to have difficulties maintaining the connection pools. What's the scale / load of your system if it's relatively low it probably won't matter much. It's often recommended for each unique microservice to have its own database which helps mitigate this issue. Having tons of unique services all talk to the same database defeats some of the benefits of microservices.