Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

any limit of SQL Server connection count?

I am using SQL Server 2008 Enterprise + C# + ADO.Net + .Net 3.5. I am using sp_who2 or sys.dm_exec_connections to find active connections numbers (let me know if my method to find active connection numbers are wrong). For some heavy database consumer application, I can find even active connection count > 1000.

I am wondering whether there are any upper bound limitations of active connection numbers of SQL Server?

thanks in advance, George

like image 578
George2 Avatar asked Sep 30 '09 18:09

George2


People also ask

How many connections are allowed in SQL Server?

SQL Server allows a maximum of 32,767 user connections.

Does SQL Server have a limit?

SQL Server Standard Edition has an upper limit of 524 Petabytes, but it is not free. If your database reaches the limit of your SQL Server Express version, you will begin to experience errors due to the inability of the database tables to accept new data.

How do you limit the maximum number of connections?

To set a limit on the number of users simultaneously accessing the instance, we can use "Maximum number of concurrent connections" property in SQL Server. The value for this property can be set via SQL Server Management Studio as well as via a T-SQL statement.


2 Answers

It is a per-instance, not per database, configuration. You can check the current value in sys.configurations and change it with sp_configure. The relevant option is user connections:

Use the user connections option to specify the maximum number of simultaneous user connections allowed on Microsoft SQL Server. The actual number of user connections allowed also depends on the version of SQL Server you are using and the limits of your application or applications and hardware. SQL Server allows a maximum of 32,767 user connections.

1000 of connections is not an exceedingly high number. On high end systems the server can listen on multiple ports affinitized to NUMA nodes and have hundreds and thousands of clients connected to each node.

Note that the number of connections is different from the number of requests, ie. connections actively executing something, sys.dm_exec_requests. Each Request requires one or more workers and the number of workers is configured with the max worker threads option.

like image 111
Remus Rusanu Avatar answered Sep 21 '22 03:09

Remus Rusanu


http://msdn.microsoft.com/en-us/library/ms143432.aspx

32,767 is the max limit per database.

I would do it as follows:

SELECT      COUNT(*) FROM      master.dbo.syslockinfo WHERE       DB_NAME(rsc_dbid) = 'your_database_name' 
like image 22
Keith Adler Avatar answered Sep 20 '22 03:09

Keith Adler