Author |
Topic |
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 20 November 2004 : 20:05:13
|
not closing a couple of recordsets that may be used once or twice a month, or less is not a problem, since they are AUTOMATICALLY closed by IIS anyway, when you have lots of objects on a page then of course it is good practice to close them as soon as you are done with them, but in the case of the items you have highlighted they are going to get dumped within seconds or less anyway, it's not like a thousand people are opening them at once, they are isolated objects created by one user 99.9% of the time as well. |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 20 November 2004 : 22:41:45
|
Closing objects by code is good programming practice, but not an absolute necessity. As HuwR has said over and over, IIS destroys all objects and variables automatically as soon as your asp page falls out of scope. However, if the server resources are "stretched thin" the small extra time the resource is held open may cause some problems, but imho that's more a sign of overloading than a coding problem.
This is a useful page
http://support.microsoft.com/kb/258939/EN-US/
$000000000000.02
|
====== Doug G ====== Computer history and help at www.dougscode.com |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 20 November 2004 : 22:47:50
|
And again, it's not a server overload problem.
So 95+% of objects are closed in the basecode, but the other don't have to be closed.
quote: Closing objects by code is good programming practice, but not an absolute necessity.
And that's an oxymoron |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 21 November 2004 : 01:44:28
|
If you removed every set = nothing from the base code I'll bet everyone would be jumping up and down becuase of poor performance, I personally don't think theres any excuse not to use good practice all the time every time whether you think it's neccesary or not.
You can't just rely on IIS getting it right, it's been documented by many a site over the years that IIS's internal garbage routines are not as good as they should be. |
Kiwihosting.Net - The Forum Hosting Specialists
|
|
|
Da_Stimulator
DEV Team Forum Moderator
USA
3373 Posts |
Posted - 21 November 2004 : 02:10:55
|
I'm getting a feeling of de-ja-vu (or however you spell that)...
I seem to remember this topic being brought up over and over again, ending up with the same result over and over again. |
-Stim |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 21 November 2004 : 05:39:15
|
quote: However, if the server resources are "stretched thin" the small extra time the resource is held open may cause some problems, but imho that's more a sign of overloading than a coding problem.
Let me just state this again this server isn't overloaded, we have less than a dozen active sites on here, 2 of them are unmodified Snitz forums runing on SQL Server that get close to 4 times as many hits as Lasers and have NEVER once managed to kill ASP to the point where I've had to manually recycle the application pool.
Access is most likely the main culprit in lasers case I believe, but I see no harm at all in first ensuring the code used on his site is first following best practices before taking on the task of converting the databases over to SQL Server. |
Kiwihosting.Net - The Forum Hosting Specialists
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 21 November 2004 : 06:26:09
|
quote: Originally posted by Gremlin
If you removed every set = nothing from the base code I'll bet everyone would be jumping up and down becuase of poor performance,
Yes I agree 100%, but the open objects laser is finding are not objects that are used regularly, they are either in rarely used admin or setup functions and would get used once or twice a month.
I also don't deny that many of the fully or heavily modded forums can cause problems, but how is this a fault with Snitz, you yourself have stated that you have many pure Snitz which are much busier and have no problems, kind of prooves my point. |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 21 November 2004 : 07:02:02
|
Don't take what I've said the wrong way Huw, I'm not personaly saying nor do I even think I've inferred in this post that those particular objects Chris has found in core code are actually likely to cause much of a problem. I do still stand by what I've said about good coding practice though, theres a difference between intentionally not destroying an object and just forgetting to, by doing it all the time people get into the habit of doing it, which I think overall is a good thing. Memory manangement isn't just the realm of the server OS, Programmers should take it into consideration as well when developing their applications.
I did ask him to report any he found though becuase I thought you'd actually be interested in them regardless, I didn't actually know what he'd found myself until reading this thread.
lasers forum isn't a stock standard forum and I believe he has found some of the mods on some of the more critical pages like default.asp etc have had problems destroying objects. Time will tell he's made a bunch of changes and I'm already seeing his forum use quite a considerable chunk less memory than it was before (though it's not all that busy right now either so that may not be related to the changes he's made).
One thing I do know is that Chris and I will get to the bottom of it no matter how much effort it takes, and we'll report our findings back here for anyone interested. |
Kiwihosting.Net - The Forum Hosting Specialists
|
Edited by - Gremlin on 21 November 2004 07:12:20 |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 21 November 2004 : 17:29:41
|
This page popped up in google and appears helpful. It reminded me that with connection pooling and database objects the time the object remains active is quite long.
http://www.oekosoft.ch/services/asp-ado.html
|
====== Doug G ====== Computer history and help at www.dougscode.com |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
|
sr_erick
Senior Member
USA
1318 Posts |
Posted - 22 November 2004 : 01:38:31
|
I've attempted to use IIS Crash / Hang. I couldn't figure it out. When I uninstalled it though, it seemed like everything speeded up quite a bit. If you figure out how to use it Gremlin, I'd sure be happy. |
Erick Snowmobile Fanatics
|
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 22 November 2004 : 04:22:31
|
my experience of it was that it actually crashed more often with the crash/hang agent installed.
Before you do anything I would get the site running in SQL instead of Access, until you do that it isn't going to make the slightest bit of difference what you do, as Access is almost certainly the largest part of your problem |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 22 November 2004 : 05:27:49
|
Thanks for the heads up about IIS Crash / Hang.
So far the sites been humming along happily with just the general code tidy up that laser implemented yesterday. |
Kiwihosting.Net - The Forum Hosting Specialists
|
|
|
Topic |
|