Another developer here was testing the latest revision of our software and he had 5 different threads that were all trying to open connections to the database. There was no error, but the 5 threads were all waiting for the Connection.Open() call to return. Which lead us to wonder if we've run out of connections in our connection pool.
The code uses Entity Framework 4 and I believe that uses its own internal connection pooling. Does anybody know how to control what the number of connections in the EF connection pool?
Connection pooling to the database is controlled by the ADO.NET Provider itself, not by EF.
To control the availability/size of the connection pool in the ADO.NET provider, see the 'Pooling'/'Max Pool Size'/'Min Pool Size' options on the connection string:
The default maximum size of the pool is '100'.
I think we'll need some more details about your test in order to comment on why the connection threads might be 'hung'. Can you post a sample of the code you're using?
answered 06 Nov '13, 12:07
The multiprogramming level (-gn) in SQLA can become a limitation if set to low, if no worker thread is available no new connection will be served. Anyway I don't think that this is your problem here, check if the threads are blocking each other then using a common resource e.g. the connection object in .net.
answered 07 Nov '13, 02:48