what exactly does a database connection mean in connection pool

227 views Asked by At

Let say I have a db connection pool of 3 connection.

Does it means that

  1. There are three active TCP connection with db ?
  2. only 3 query can be run in parallel, one query per connection ?
1

There are 1 answers

0
xQbert On BEST ANSWER

Depends on min max of pool in the configuration of the pool.

If by default you've set the min pool size is 3, then the pool will always have 3 connections to hand out at any time. If all 3 are in use then it will wait to hand out another until one comes in UNLESS pool max size is higher than 3. Then the pool can GROW in size. It's just the overhead of setting up and establishing the connection will be incurred until that max size limit is reached. Once the pool connections has been idle for some period of time, the pool will cut back on connections until the min 3 is again reached.

So to answer your questions directly: DB connection pool of 3 (Assuming this is the MIN value)

  1. Yes there are 3 active connections the pool is managing and will not allow to fall below 3 at any time.
  2. No more than 3 can run depending on max pool size. if 3 is both the min and max pool size then yes you would be limiting what can truly run in parallel.