Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Timeouts


Timeouts

Author
Message
paul.corujo
paul.corujo
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 301
Hi All,

There is a developer who claims he is seeing timeouts in the error logs that are being caused by the database. The procedures in question are optimized and run in milliseconds. The catch is that when the procs are called they are called several thousand times in a very short period of time (seconds). When this is happening I am running sp_who2 active and do not see any blocking.

Can somebody please advise me how i can track these procedures to see whether or not they are causing blocking which is in turn causing these time outs? I would like to generate some metrics to go back to them with so we can work to troubleshoot these timeouts.

Thanks so much in advance....
Paul
Todd Engen
Todd Engen
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1083 Visits: 6336
Hi Paul,

The server doesn't timeout when running a query (linked servers aside). It's the client that tells the server to cancel a query based on its command timeout value.

You should be able to see when the client sends a request to cancel by capturing Attention Events in a SQL Profiler trace .
paul.corujo
paul.corujo
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 301
Thank you for your response. Our app times out after 30 seconds and inserts an error in the log file. The sp in question run in SSMS in under 1 second. How would I determine why it is taking more than 30 when called via the application. Again its being called a ton in a very short period of time, but how would i go about putting metrics to that so we can go back and analyze?
paul.knibbs
paul.knibbs
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1992 Visits: 6214
Isn't it strange how problems like this are always the fault of the database and not the developer? Crazy

Anyway, I'd be inclined to set up a trace on the server so you can see exactly what SQL commands are being executed and how long they're taking. It'll add a bit of extra load, obviously, but if anything that should make the problem happen sooner and thus be easier to trace!
Bhuvnesh
Bhuvnesh
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2930 Visits: 4076
paul.corujo (6/2/2010)
The sp in question run in SSMS in under 1 second. How would I determine why it is taking more than 30 when called via the application.
if its running fine then thats not DBA's call it should be kept in Developers plate. but one concern is there that is "tons of call"

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
chrisfradenburg
chrisfradenburg
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1732 Visits: 2057
If you're looking to track how long each query is taking you can have profiler log to a table or a file and then do averages on the duration. If you're logging to file you can use fn_trace_gettable to access the information in a query window.

Don't forget to take the network into account when considering the cause of problems like this. Do either the client or the server have any errors in Event Viewer when this is happening?
Eric M Russell
Eric M Russell
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4655 Visits: 9579
paul.corujo (5/26/2010)
... When this is happening I am running sp_who2 active and do not see any blocking. Can somebody please advise me how i can track these procedures to see whether or not they are causing blocking which is in turn causing these time outs? ...

When a stored procedure that normally runs in under a second sporatically takes 30 seconds or longer to execute, then it's typically the result of some type of blocking.
You can turn on trace flag 1222 or use SQL Profiler to log deadlocks, a special blocking scenario where one process is aborted to allow the other to finish. The following article describes steps for tracing deadlocks and resolving excessive blocking, if that turns out to be the issue.
http://blogs.msdn.com/b/bartd/archive/2006/09/09/deadlock-troubleshooting_2c00_-part-1.aspx
Even highly optimized T-SQL and indexes will take you so far. You may even want to redesign your application workflow so that this stored procedure, which you said gets occasionally gets executed thousands of times a second, is instead executed in small sequential batches.


"The universe is complicated and for the most part beyond your control, but your life is only as complicated as you choose it to be."
paul.corujo
paul.corujo
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 301
That is perfect, thank you all for your help.
paul.corujo
paul.corujo
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 301
I am going to try this in dev first but should I expect a big performance issue if I enable flag 1222?
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47412 Visits: 44399
No.

Are you seeing deadlocks? Are you having queries failing with the error "Transaction X was deadlocked and was chosen as the deadlock victim"? Deadlocks and blocking are two different (though related) things. If you're just having blocking, the deadlock trace may not show anything up at all.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search