Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection pooling/limit for SQL Server and Linq-to-SQL

I found this article regarding Linq-to-SQL and SQL Server connection pooling: MSDN Blog

From what I assume from the article, is that Linq-to-SQL using the same Max Pool Size setting just as if it was an ADO object.

I have an C# app that is hitting the database pretty hard. Is there a way to tell if I am hitting my connection limit? How can I tell if my connections are being queued?

like image 624
Mike_G Avatar asked Jan 17 '26 01:01

Mike_G


2 Answers

Use performance counters. You should be interested in following counters:

  • NumberOfPooledConnections - how many connections your pool mantain
  • NumberOfActiveConnections - how many connections are in use
  • NumberOfFreeConnections - how many connections are not in use

Last two counters require some modification in your application configuration.

Another article about working with these counters.

like image 132
Ladislav Mrnka Avatar answered Jan 19 '26 13:01

Ladislav Mrnka


you could open a connection and execute this stored procedure; assuming you use sql server.

EXEC SP_WHO 

you could compare all connections to the dbname with status != sleeping.

like image 36
NickD Avatar answered Jan 19 '26 13:01

NickD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!