C# – What happens when Npgsql connection pool reaches Max


Both the name of the connection string parameter and this blog post – http://fxjr.blogspot.co.uk/2010/04/npgsql-connection-pool-explained.html – lead me to believe that Npgsql wont exceed the MaxPoolSize value set in the connection string. However the docs (http://npgsql.projects.postgresql.org/docs/manual/UserManual.html) say "Max size of connection pool. Pooled connections will be disposed of when returned to the pool if the pool contains more than this number of connections. Default: 20"

This suggests that the pool can actually grow larger than MaxPoolSize and it is in fact just a level at which Npgsql starts to aggressively remove connections from the pool as soon as they are returned.

I've been searching to try and find an answer but I can find out exactly what happens when you reach MaxPoolSize. Anyone else know?

edit: I should add we are using Npgsql due to another dependency being supported only up to that version.

Best Solution

I think this may be a copy paste issue regarding the minpoolsize. Npgsql doesn't create more than maxpoolsize connections. When this value is reached, new connection requests are queued until there is a free one.

Which issue are you depending on which only works on 2.0.6?