Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

How to specify an optimal number for the max size of Pool #77

Open
phongyu opened this issue Sep 15, 2017 · 1 comment
Open

How to specify an optimal number for the max size of Pool #77

phongyu opened this issue Sep 15, 2017 · 1 comment
Labels

Comments

@phongyu
Copy link

phongyu commented Sep 15, 2017

Hi Brianc,
I have just a concern about how to specify the max size (min size) of Pool, mean an optimal number.
I know it depends on the server configuration, but can you give me some hints.

Thanks

@phongyu phongyu changed the title How can specify an optimal number for the max size of Pool How to specify an optimal number for the max size of Pool Sep 15, 2017
@matonga
Copy link

matonga commented Oct 10, 2018

Hi, this is more difficult than it seems, so I would like to contribute a simple formula to get a very rought approximation:

Suppose you have 50 requests per second, and each request lasts for 0.2 seconds (200 milliseconds). If you set max size of pool to 1, after 1 second you would handle just 5 requests, leaving the other 45 requests still unhandled. Instead you can do something like this:

50 requests per second * 0.2 seconds per request = 10 connections needed in parallel to handle the load (i.e. set max size of pool to this value, 10 in this example)

Some caveats:

  • Your requests may be too short (under 1 millisecond), or maybe you have less than one request per second. It's ok to set max pool size to 1 or 2 for those.
  • Your requests may be too short (under 1 millisecond) and you have thousands of requests per second, and they mostly retrieve the same value again and again: add some sort of memory cache to your application (I actually do this for an IoT server handling thousands of inserts per second, most of them duplicate inserts because of m2m packet loss).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants