5

I've implemented HikariCP for a few apps. So far, in the "simpliest" one it's working pretty good, even boosting performance and showing where we should try to optimize.

Anyway, that app is in a server with 4 HDD on RAID and it's an 8-core machine. We also have another app that will be hosted in the cloud, with SSD storage.

I know the formula given by the PostgreSQL team addresses the maximum size pool, but according to Hikari's documentation, the behaviour with SSDs hasn't been analized yet. That 'yet' made me go and look for an answer, but since my Googling hasn't been much effective (I might be using wrong keywords) I come here.

Does anyone know how the formula scales with SSD? A quick guess is that if I can't actually take effective_spindle_count into consideration given how different SSDs and HDDs are, then I could scale the number based of read/write speed or something, but I doubt is that simple.

Good day!

Jetto Martínez
  • 917
  • 7
  • 17

1 Answers1

0

From the same link I quoted back when I asked the question, which was a quote from the article, new information was added about SSDs with pooling.

tl;dr is "Since there is less/no seek time, fewer connections in the pool would be better", with them giving an example that a single connection per CPU core would be ideal because of less overhead as it's not changing contexts. They do not provide a definitive answer, as "More threads only perform better when blocking creates opportunities for executing.", which I think is fair.

At that point, I'm leaning to believe that a pool size equal to the number of cores in the system is ideal, because of the low to no overhead while having, at the same time, probably more threads than needed in case any blocking operation kicks in.

I lack the expertise to give a definitive and well-backed-up answer (I'm absolutely ok with being proven wrong, as long as we can have an answer), but from what I've read and understood, I think is safe to say that:

If the application's data sources read from an HDD: Stick to the formula.

(max) connections = ((core_count * 2) + effective_spindle_count)

If the application's data sources read from an SSD: The pool size should be equal to the core count of the machine where the application is running.

(max) connections = core_count

Of course, and quoting the article once more: Pool sizing is ultimately very specific to deployments.

Jetto Martínez
  • 917
  • 7
  • 17