Solved

ASP with SQL queries keeps crashing

Posted on 2011-09-14
10
258 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 51

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 51

Accepted Solution

by:
HainKurt earned 250 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
 
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 51

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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 250 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 51

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now