Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Coping with slow SQL Servers in ASP.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Microsoft Newsserver - 01 Feb 2008 10:10 GMT
Hi,

We have situations occasionally where the SQL server is extremely slow to
respond. The problm is that the user is left with loading page and has no
idea what in heaven is going on.

Does anyone have any ideas how the DAL can be confiured to timeout and throw
an exception if the response is not quick enough ?

Cheers
Alexey Smirnov - 01 Feb 2008 10:41 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Cheers

Add "Connect Timeout=<seconds>;" to your connection string and use a
try-catch to handle the sql exception.

You can also try to execute that slow task using an asynchronous call.
If it's a buk copying process, look at the SqlBulkCopy Class
(System.Data.SqlClient)
Michael Nemtsev [MVP] - 01 Feb 2008 10:46 GMT
Hello Microsoft,

You need to use Performance counters or profiler to understand system bottlenecks
first

---
WBR,
Michael  Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour 

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

MN> Hi,
MN>
MN> We have situations occasionally where the SQL server is extremely
MN> slow to respond. The problm is that the user is left with loading
MN> page and has no idea what in heaven is going on.
MN>
MN> Does anyone have any ideas how the DAL can be confiured to timeout
MN> and throw an exception if the response is not quick enough ?
MN>
MN> Cheers
MN>
Mark Rae [MVP] - 01 Feb 2008 11:25 GMT
> We have situations occasionally where the SQL server is extremely slow to
> respond. The problm is that the user is left with loading page and has no
> idea what in heaven is going on.
>
> Does anyone have any ideas how the DAL can be confiured to timeout and
> throw an exception if the response is not quick enough ?

You're trying to fix the wrong problem!

You should be looking at why the database query is so slow and fixing
that...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Cowboy (Gregory A. Beamer) - 01 Feb 2008 16:52 GMT
You can time out the query, but I would find out why you are having the
problem first.

Step 1 is to run performance counters and see what is happening

Then, you will likely find out which queries are your problem child and fix
them. Followed by possibly adding or correcting indexes. Or moving to a
stronger box, as you have outgrown the box you are running SQL on.

Throwing in the connection timeout will let you tell the user the server is
too busy, but it will not solve the problem.

Signature

Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************

| Think outside the box!

*************************************************
> Hi,
>
[quoted text clipped - 6 lines]
>
> Cheers

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.