Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP with SQL queries keeps crashing

Posted on 2011-09-14
10
Medium Priority
?
270 Views
Last Modified: 2012-05-12
Hi all, I have an ASP site with a lot of different pages that make calls to a SQL 2005 Enterprise database. The database has approx 21,000 records. There are about 50 users who work on the site all day long (its an internal site). It seems that lately the site is crashing 10x a day, to fix it I need to do an IISRESET (yes, I tried rebooting), then everyone logs in & uses it normally for a while then it crashes again. I believe that my selects are all closed properly & now I have no idea what to look for. There are too many users to figure out what specifically is causing the crash. Can anyone help me figure out what I should be looking at?
PS - The server is Dual Xeon 3ghz HT with 16GB of Ram running Windows 2003 Enterprise Server, fully patched.

Thanks in advance.
Jon
0
Comment
Question by:Jon DeVito
  • 5
  • 4
10 Comments
 
LVL 61

Expert Comment

by:HainKurt
ID: 36539018
probably you have a loop somewhere which never ends... ask users what was the last page they visited and what they did/clicked and they got no response... maybe you can find the crashing page... or create a table

sitelog(id, pagename, userid, starttime, endtime)

and insert a record on page load, and update it on page unload (using the same id which you get on first insert)
this way, you will have a nice visit log later and also can find the problematic pages (probably crashing page which endtime is null)
0
 
LVL 61

Accepted Solution

by:
HainKurt earned 1000 total points
ID: 36539036
better

pages(pageid, pagename, description, url, minservetime, maxservetime, avgservetime,.....)
sitelog(id, pageid, userid, starttime, endtime)

insert page definitions into pages table, and on each page insert into sitelog using the id of that page...
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 36539082
Thanks for the response. If I do it that way, when the crash happens all 50 users will be on a page that never posted back on unload so I still wont be able to see which page crashed it.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 3

Author Comment

by:Jon DeVito
ID: 36539123
I am almost positive it is because of the amount of records being retrieved from the database. I installed a new test server where I am having problems when I query the database for thousands of records.
0
 
LVL 61

Expert Comment

by:HainKurt
ID: 36539457
"If I do it that way, when the crash happens all 50 users will be on a page that never posted back on unload so I still wont be able to see which page crashed it."

I guess I could not explain :) when a user request a page, on page_init you insert a record into table, and get id,
then on page_unload, you update that record... at the end, if server crashes you will end up one record (hopefully) which is not updated, which crashes the server...

page_init : insert log, get id of inserted log
all other events: your page logic here...
page_unload : update log

this cycle happens all the time whenever a page is served... wort to try if it is not too much work for you...
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 36540509
Aaaaaah, now I understand. I thought you meant when they navigated away from the page. Thanks for explaining, I'm going to give that a shot. I'm almost positive its because the database is sending way too many records to the browser but this will be a good way to tell. I'll let you know what happens. Thanks again!

Jon
0
 
LVL 9

Assisted Solution

by:djpazza
djpazza earned 1000 total points
ID: 36542835
How about checking the webserver logs for the last few users / pages that were accessed before you did a iisreset / restart.

This might narrow down the problem page.  With regards to the amount of data being display is it not being filtered ? You don't display 21000 records on a single page do you?
0
 
LVL 3

Author Comment

by:Jon DeVito
ID: 36546862
Thanks, I checked the logs & found that I was getting a lot of errors which Microsoft had a patch for. Not sure how much help it will be yet but I have my fingers crossed. Yes the page is being filtered but even filtered some date ranges have a lot of records (1000 or more) so I'm trying to get the filters a bit narrower so they dont return that many records. I'll let everyone know after work tomorrow if the site goes down 50 times. If it does I will take both of your advice in narrowing it down, checking deeper into the logs as well as creating a log on the SQL server to try to narrow down at least who's causing the crash so I can investigate exactly what they're typing.

Thanks again!
Jon
0
 
LVL 61

Expert Comment

by:HainKurt
ID: 36547117
1000 record is approximately 1 MB of data (1KB each) and it should not cause any issue unless you use session to store them... even with sessions, 1MB x 100 user = 100MB of memory... should not create any issue for the server... maybe you use viewstate a lot, which increases data coming/going to server is too much... anyway, first you should find the page, then check the code... I am assuming there is an infinite loop somewhere which eats up all memory and crashes the server...
0
 
LVL 3

Author Closing Comment

by:Jon DeVito
ID: 36560923
Thank you both. I would up moving it to a better, more updated server & the problem seems to have gone away...for now. Since I think you were both correct with the troubleshooting steps I'll split the points. Thank you both so much for all of the help!

Jon
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question