sql

All things SQL and JDBC...
dpsutton 2020-05-29T15:48:02.094300Z

does anyone have a good rule of thumb or some articles about how to set the size of their connection pool?

seancorfield 2020-05-29T15:52:19.095200Z

@dpsutton I think that's something that is so application-specific you won't find much advice beyond "measure and adjust".

seancorfield 2020-05-29T15:52:51.095900Z

It's going to depend on so many factors in how your code interacts with the database.

dpsutton 2020-05-29T15:53:09.096300Z

yeah figured. wondered if there was a good starting off point. also looking into how to measure. using Hikari i can set registerMbeans=true it seems?

dpsutton 2020-05-29T15:56:51.097300Z

we're using the default of 15 as max. just wondering if there was a good guide to get in the ballpark before tuning

seancorfield 2020-05-29T15:56:53.097500Z

We monitor how production behaves with New Relic so we look at it from a holistic performance p.o.v.

dpsutton 2020-05-29T15:57:07.097700Z

but now i'm reading > You can see from the video that reducing the connection pool size alone, in the absence of any other change, decreased the response times of the application from 100ms to 2ms -- over 50x improvement.

seancorfield 2020-05-29T15:58:10.098400Z

That's interesting... it's a bit of a "black art" TBH. Much like JVM tuning 🙂

dpsutton 2020-05-29T15:58:31.099100Z

yeah. so i'm trying to figure out the rules of thumb before refining further

seancorfield 2020-05-29T15:59:42.100400Z

We have different connection pool sizes in each app. We probably should do another round of monitoring and tuning -- it's been a while since we last did it and our traffic patterns have changed quite a bit. Although most of our response times are predicated on Elastic Search latency and response times nowadays 🙂

dpsutton 2020-05-29T16:00:34.100700Z

well i'm sorry to have added to your backlog then 🙂

seancorfield 2020-05-29T16:04:47.101600Z

FWIW, our production connection pool sizes range from minimums of 5-20 and maximums of 15-90 across a dozen apps.

dpsutton 2020-05-29T16:41:23.102200Z

@seancorfield i took that quote above from here: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing . and it seems like quite a nice document. gives a good jumping off point to begin experiments as well

1
seancorfield 2020-05-29T16:43:06.103600Z

We're still using c3p0. I've been tempted to switch to HikariCP for years. But we tried to switch to BoneCP at one point and that was a horrible experience so it made us a bit gunshy about such future changes 🙂

seancorfield 2020-05-29T16:49:35.105300Z

Our DB servers are 24 core SSD machines so, based on that, we could pull back from 90 to about 50 and be fine. Although that would just be our high-traffic app. We could probably pull the connection pools size way down in the lower traffic apps. Goes off and creates an issue in JIRA at work!

dharrigan 2020-05-29T17:38:57.106200Z

hikaricp is really good. I remember bonecp too

dharrigan 2020-05-29T17:40:03.107400Z

hikaricp is also the preferred pool library for spring boot projects too.

dharrigan 2020-05-29T17:43:58.110200Z

it's my pool of choice. currently I have an app that consumes over 250,000 trips a day into postgresql. hikaricp is one thing I don't worry about 😄