May 17, 2006 at 3:34 pm
I keep getting an error messages from C# .NET web application when i am going from one page to another one. Here is the error message:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
According to my abservations It happends when the SQL server pritty busy or when i am running a complicated query from SQL analyzer. Is there a way to improve perfomance of the SQL server?
Thank you in advence
May 18, 2006 at 2:54 am
Many ways, but it depends greatly on what the root problem is.
Have a look in the performance forum, iirc there are a few posts on getting started with monitoring and tuning.
It could be hardware bottleneck, poor indexes, excessive blocking, inefficient queries
Another thing you can do is increase the timeout setting of the SQL command in the C# app.
SQL Server itself has no concept of timeout, it's purely a client-side error
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
May 18, 2006 at 9:14 am
I have tryied to increase the the timeout settings in the config file and it does not help. It is interesting when we are not running any complex batches on the server site it works almost always good. Once i am running a complex batch it starts giving me this type of errors. Also tell me please what do you mean by saying hardware bottleneck. Where should i go and check if my indexing is good. My query is good because the they no taking a long time to run about 2 or 5 seconds. Also tell me please where should i chek about blocking. As far as i know in my code there is no limitation in blocking so the query will be executed with out any blocking.
Thank you very much in advence.
Greg
May 18, 2006 at 9:42 am
Not the timeout in the config. Is something like cmd.Timeout in the code, after you create the command, but before you execute it. Not a C# expert.
For blocking, run sp_who2 and check to see if any have a entry in the blocked column.
For indexes, is very complex. Start by finding the slow running queries.
SQL Profiler can help with that. Once you've found the sow running onces, you can run them in query analyser with the execution plan option on.
Look for table scans and index scans.
You can also run the database tuning adviser and see what it suggests. It's a good place to start though it's not perfect.
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
May 18, 2006 at 10:00 am
In my code i have time out setting:
m_cds.c.CommandTimeout = 216000;
Do you know what is the maximum number i can put there?
Thanks a lot.
Greg
May 18, 2006 at 10:08 am
No idea. The .net docs should tell you.
That's already a pretty high value. how long does that query take in QA?
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
May 18, 2006 at 10:40 am
In QA it takes between 35 and 50 seconds to run and another query about 5 sec to run
Thanks
Greg
May 18, 2006 at 10:55 am
Weird. That's a little slow, but not close to causing a timeout. Even the default value is 5 min.
How long does it take from the web page?
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
May 18, 2006 at 11:28 am
If it is not getting a time out error between 35-45 sec. If it is getting an error it takes 45-50 sec until the error message appears.
Greg
May 18, 2006 at 2:26 pm
Thnak you very much it was very helpfull. I fixed it by improving my query. I cleaned up table therfore speed up the query it self.
THANK YOU
May 19, 2006 at 12:13 am
My pleasure. I'm glad it's fixed.
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
Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply