views:

56

answers:

1

We have an application that uses NHibernate to connect to our database on SQL Server.We use connection pooling and session per request approach to execute our queries over SQL Server. We used SQL Server Activity Monitor to monitor connections count and noticed there was 25-30 connections involved whenever a user logged in to system. So here's my question to ask : can large number of connections to SQL Server leads to performance issues?

+1  A: 

Each connection to SQL Server requires the allocation of certain amount of memory and so there is a performance consideration in this regard.

In the scheme of things however, 20-30 connections is a very small number.

Have you validated that all connections belong to your application? The reason I ask is because SQL Server itself will establish and maintain a certain number of connections/sessions as part of the servers overall operation.

Some usefull DMV's for you to monitor:

select * from sys.dm_exec_connections
select * from sys.dm_exec_sessions

Session ID's above 51 are from outside of SQL Server so to speak, i.e. user sessions.

Further to comments:

SQL Server 2005 can support up to 32,767 connections. To check your capacity execute:

select @@MAX_CONNECTIONS

If connection pooling is being used then connections will remain open and in a sleep state until required for processing requests. Alternatively, perhaps the application is not closing connections when requests have finished processing.

I can only comment from a SQL Server perspective as I am not familiar with the mechanics of NHibernate.

John Sansom
thank you for your reply.I'm positively sure that those are our application connections and it is 20-30 connection per user and since we have nearly 100 users working with our application an average of 400-500 connections are involved (after logging in to application a user has 3 connections).One thing I can't understand though is that many of them are in Sleep mode.
Beatles1692