0

I am in reference to this excellent article regarding sizing a database connection pool by brettwooldridge author of HikariCP.

Amongst other, the article provide a formula for determining the size of one's database connection pool:

connections = ((core_count * 2) + effective_spindle_count)

To quote brettwooldridge:

Guess what that means? Your little 4-Core i7 server with one hard disk should be running a connection pool of: 9 = ((4 * 2) + 1)

The formula gives a size of 9 for the connection pool.

Now back to my question: I plan to use Cloudfoundry-Pivotal/HikariCP/ClearDB in order to deploy a webapp in the cloud.

How and where do I get the values to feed into the formula?

balteo
  • 23,602
  • 63
  • 219
  • 412
  • 1
    ~10 connections is always a good place to start. In spite of the formula, if you have a 1 core box, a pool of 3 connections is not likely to be of much use. CloudFoundry allows you to choose your instance sizes, so if you go with very large instances you can of course start applying that formula. – brettw Jul 01 '14 at 15:00
  • Thanks a lot for your comment. Can you please explain though why the principles of your article do not hold in case of a 1-core box? Why do you say: "if you have a 1 core box, a pool of 3 connections is not likely to be of much use"? – balteo Jul 01 '14 at 15:14
  • 1
    Sometimes a single web request thread may need to acquire multiple connections in the course of satisfying the requests. Frameworks like ORM are notorious for acquiring multiple connections. If the pool only has 3 connections, it may not be sufficient for even a single request, causing the request to block forever waiting for a 4th connection. However, 10 connections should be more than sufficient, even if sub-optimal performance-wise. If you are directly in control of how many connections are used for a single request, by all means use a smaller pool when you can. – brettw Jul 02 '14 at 02:48
  • 1
    Also be aware that ClearDb puts limits on the number of connections that you can make to a database. Their "free" tier on PWS is limited at 4, so unless you're purchasing a premium plan you don't really have a lot of choice. – Daniel Mikusa Jul 23 '14 at 13:39

1 Answers1

-3

Using a PaaS assumes abstracting from physical infrastructure. Try to find other approach to get optimal values and write your own article about it!