Out of memory problem for ASP.NET/IIS6.... How to evaluate how much memory is available to web instance?

Hi,

I have an ASP.NET application on a shared IIS6 server with 4GB RAM. There are quite a lot of other sites on this server, at least 20. There is no memory capping setup for any site, it is all default IIS6 setup. I am getting "out of memory exception" errors. We have setup Application Pool Recycling every 24hours. Now I realise that any potential memory leak should be plugged. However I am concerned that the amount of memory available to this application could decrease to problematic levels due to high activity of other sites. Therefore I want to put in some code that extracts the value of memory that is available to my Web site when it crashes, or memory available to my application pool.

So it may be 1GB is free and available off the server to my app pool however this might go down to say 200mb which would make "out of memory" errors more likely.

Thoughts???

Thanks,

Sam
SamJollyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alfred A.Commented:
Hi,

Have you tried creating multiple application pools and dividing your websites to an application pool?  As I recall, there is a 1GB limit within a w3wp.exe (application pool) in a Win2003 Server.  If you combine all 20 web sites into just one application pool, you might really hit the limit and get an "out of memory" error.

Also, unhandled error exception can also cause the size of the w3wp.exe to grow based on my experience.  





0
corneliu_newsCommented:
You can try with this first
http://support.microsoft.com/kb/911716

To monitor the app memory usage you can use Ants profiler - is best one I know.
0
SamJollyAuthor Commented:
Hi Folks.

Thanks for this.

So there is no way for the asp.net code to access some memory variable value?? One has to rely on 3rd party tools such as ANTS profiler which I have and investigating to sort out the memory leak in the code?

Sam
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

SamJollyAuthor Commented:
Alfred,

I have a specific App Pool for my application/ IIS web instance

Sam
0
Alfred A.Commented:
Hi Sam,

Ok.  My suggestion then is to start with handling exceptions that can happen in your application.  Even with a simple thrown error can use up quite a resource in memory.  What you can do is to check the event viewer for any unhandled exceptions in the Application Event Log in the Server (assuming you have access to the server).

I got burned with this when I implemented a WSE 3.0 web service that handles 600KB size data and concurrently hitting it around 12 per sec.  One simple error caused a massive leak in memory and caused an out-of-memory error during load testing.

A simple try-catch scenario in typical areas should be a good start.

I hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
corneliu_newsCommented:
I don't think you can call profiling API's from managed code, you can only attach a profiler to a running managed process.
0
corneliu_newsCommented:
0
SamJollyAuthor Commented:
Folks,

Thanks for the comments and tips. However I still do not know how to get the available memory value for the host web iis instance. If I can get this then I might find that it is not my code, but the share hosting environment which is not providing enough RAM. I really could do with getting this figure.

I am encountering quite a number of errors in production use, particularly "Invalid Viewstate" although the users are not complaining. Some of them may be behind the scences since we log all raised exceptions.

Thanks again,

Sam
0
SamJollyAuthor Commented:
Sorry about leaving this. No I do want to allocate points since I appreciate the help.

Sam
0
SamJollyAuthor Commented:
How do I shre the allocation? Cannot see the button?

Sam
0
Alfred A.Commented:
@cs97jjm3,

Please read Sam's comments ID 32269964 and 32270136.  Thanks.

Regards,

Alfred1
0
SamJollyAuthor Commented:
thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.