'How to estimate the max value of a connection pool for a dockerized backend REST API?

I have a stateless Rest API, that is currently deployed manually on several backend servers for scalability and redundancy. This service is talking to a central database by using a connection from its application pool of connection.

The settings of this application pool are carefully computed and configured by hand depending on the capacity of the database ( ie: RAM, CPU, Disk, and max connections allowed: that we adjust also manually from month to month ).

In the future we plan to make the deployment less painless, more frequent, and also have dynamic scalability for this API. So for instance under heavy load, we will have a lot of new dockers running in parallel.

So I am wondering what will be the way to configure the connection pool to the database, so we would not consume more than the database can handle for example? But also at the same time have the rest API that could handle the load during a spike of calls for example with a reasonable minimum and maximum connection in its pool?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source