473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

SLEEPING/AWAITING COMMAND question

I am using SQL Server 2000. In Enterprise Mgr, under Management/Current
Activity, I see a list SPIDs.

I have a multi-tiered .NET web app that uses ADO.NET to connect to the
database. Each time a Stored Proc is called, a new connection is opened, the
data retreieved, and the connection closed and set to Nothing (in VB.NET).

Yet, I see several (15 or so) SPIDs for the user ID that the web app uses to
connect to the database.

The database is local and private, so I know all connections are from me.

What does Status=SLEEPING Command=Waiting Command mean?

What will happen when we get 1000's users on the web app?

Is SQL doing some kind of connection pooling?
Dec 2 '05 #1
1 29433
Chad (ch**************@unisys.com) writes:
I am using SQL Server 2000. In Enterprise Mgr, under Management/Current
Activity, I see a list SPIDs.

I have a multi-tiered .NET web app that uses ADO.NET to connect to the
database. Each time a Stored Proc is called, a new connection is opened,
the data retreieved, and the connection closed and set to Nothing (in
VB.NET).

Yet, I see several (15 or so) SPIDs for the user ID that the web app
uses to connect to the database.

The database is local and private, so I know all connections are from me.

What does Status=SLEEPING Command=Waiting Command mean?

What will happen when we get 1000's users on the web app?

Is SQL doing some kind of connection pooling?


No, SQL Server is not doing any connection pooling. ADO .Net is. And it
appears that you are not handling it well.

What should happen is that you open a connection in the VB .Net code, and
the first time SqlClient opens a connection to SQL Server. When you close
that connection from the program, SqlClient does not actually close the
connection to the database, but lingers to it for some time, default is
60 seconds. If you don't reconnect within that time, SqlClient will
close the connection for real. But if you reconnect, SqlClient will
reuse that connection. The condition then is that you use the same
connection properties.

But there are ways to make this break down. For instance if you fail to
retrieve all rows and result sets when you use ExecuteReader, and on
top of that do not close the reader, may cause this problem. (I'm a
little foggy here, as ADO .Net is something I only do left-handedly.)

One way to investigate, is to run the SQL Server Profiler with the default
template. If you see an Audit Login event, then there is a new connection.
If you see the even RPC:Completed with the text "sp_reset_connection",
this means that a connection was reused from the pool. If you never see
any sp_reset_connection, then you know you have a problem.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 3 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shenron | last post by:
Hello, I've seen lots of queries which are sleeping with SHOW PROCESSLIST. Why are they sleeping? How can I prevent this sleeping queries? Because I can't running lots threads at the same...
1
by: COMfused | last post by:
I have a thread that has a delegate function which will be called when another process exits. This thread went to sleep, the process exits and is supposed to call the delegate, but it did not...
6
by: ujjc001 | last post by:
Hello all. I have many connections that are sleeping. I can right click, kill, up to 2 at a time. It takes about 20 seconds to kill it. Is that normal? I tried to make a stored procedure to...
1
by: Dave | last post by:
I was trying to find the bottle neck on our server while we were running a couple very large updates. I ran the following query and noticed there were a couple sleeping spid's that were really...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
16
by: Alvin Bruney | last post by:
I'm observing that a sleeping thread changes to stopped after a while. Is that accepted framework behavior for web applications? My thread basically does some work, and sleeps for 60 minutes...
4
by: cmay | last post by:
Can someone give me some guidance on this? I am implementing a system where if a user fails the login, I am doing a thread.sleep(random number). If I returned the page right away, you could...
17
by: Benny Raymond | last post by:
I have a thread that sleeps for 5 minutes once it's finished running a method and then it repeats itself if it's supposed to (bool = true). Prior to 2.0 I was able to resume the thread after...
1
by: NiponW | last post by:
Hi, Database Server running slow. I used SP_WHO2 ACTIVE and the result has many of XXXX SA RUNNABLE MASTER AWAITING COMMAND.......... (XXXX is spid) and they stay for couples seconds.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.