opening a #database connection is an expensive operation, especially if the database is remote. You have to open up network sessions, authenticate, have authorisation checked, and so on. Pooling keeps the connections active so that, when a connection is later requested, one of the active ones is used in preference to having to create another one.
You need to balance the resource usage of having unused threads (A) against the resource usage of not having enough threads to do the work (B).
(A) is generally memory usage (stacks and so on) since a thread doing no work will not be using much of the CPU. (B) will generally be a delay in the processing of requests as they arrive as you need to wait for a thread to become available.
#darabase #linux
https://stackoverflow.com/questions/481970/how-many-threads-is-too-many/481979#481979