Application State Unload

G

Guest

I have written an ASP.Net web application in C#.
On Appplication_Start the code loads some data
from the database into memory. It stores the data
in Application State variables.
The data is read only. So far so good.

If no one uses the Application for a certain period of time
IIS unloads it from memory. If someone then access the
application the code reloads all the data again into Application
State variables.

This takes about 3 minutes to do. Where is the setting
in IIS or machine.config or app.config or web.config
that determines the time period of inactivity before
IIS unloads an application from memory?

Thanks
Charlie
 
M

Mark Fitzpatrick

Did you try playing with the Session timeout? Usually when the last session
closes down is when the application unloads.

Something else, you may want to instead take a look at the Cache instead of
the Application variables. I've found the cache to be much nicer. Also, for
frequently accessed data, you could write a function that accesses that will
first test to see if the item is in cache if it is, return it, else fetch
the data and put it into the cache.

How much data are you storing? Three minutes is a very long time. Have you
optimized the database for performance? Do you really need to load
everything at once? One of my concerns is, if it takes three minutes to load
you may be trying to load way too much data into memory which would lead you
to other problems down the line. If you have this much data stored in
application variables you may run into long-term performance issues as the
system could run out of assigned resources the longer it runs, forcing the
application pool to restart more often even when users are still connected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top