Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Timeouts Expand / Collapse
Author
Message
Posted Wednesday, May 26, 2010 4:36 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, August 12, 2013 9:14 AM
Points: 67, Visits: 299
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
Post #928662
Posted Wednesday, May 26, 2010 6:28 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 12, 2013 8:44 AM
Points: 1,073, Visits: 6,334
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 .

Post #928685
Posted Wednesday, June 2, 2010 12:00 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, August 12, 2013 9:14 AM
Points: 67, Visits: 299
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?
Post #931569
Posted Thursday, June 3, 2010 2:56 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 9:13 AM
Points: 1,629, Visits: 5,573
Isn't it strange how problems like this are always the fault of the database and not the developer?

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!
Post #931921
Posted Thursday, June 3, 2010 4:32 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 12:26 AM
Points: 2,840, Visits: 3,963
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
Post #931976
Posted Thursday, June 3, 2010 6:29 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, August 4, 2014 8:10 AM
Points: 1,635, Visits: 1,972
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?
Post #932067
Posted Friday, June 4, 2010 8:09 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 1:46 PM
Points: 1,649, Visits: 4,697
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.
Post #932834
Posted Friday, June 4, 2010 8:22 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, August 12, 2013 9:14 AM
Points: 67, Visits: 299
That is perfect, thank you all for your help.
Post #932846
Posted Tuesday, June 8, 2010 6:06 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, August 12, 2013 9:14 AM
Points: 67, Visits: 299
I am going to try this in dev first but should I expect a big performance issue if I enable flag 1222?
Post #934327
Posted Wednesday, June 9, 2010 12:01 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:00 AM
Points: 42,774, Visits: 35,871
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 2008, MVP
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

Post #934404
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse