Apogeum wrote:
Hashtables:
I am using strings as keys. the values are structs.
The plan was to store the structs within the cache but I had problems with that:
in the production environment it lost values (for no apparent reason).
since there wasn't enought time to investigate I switched to the hashtable.
I would prefer cache tough.
WOW... missed that before....
BIG TIME ISSUE SHOWN HERE!
PLEASE READ the docs about how ASP.NET works!
Cache is like a memory pool, the way it is designed is to hold data for a limited time.
Cache will get flushed when:
a) the item "times out"
b) the system needs RAM to process other tasks
c) you clear the item
d) the system re-cylces the IIS/ASP.Net Process
from all that has been posted b and or d are happening to your app.
how many users/requests? how much ram does the server have?
how much ram is each request using?
I bet your app is grabiing a ton of ram and / or the cpu % is to high wich will cause IIS to re-start / cycle your app.
are users losing pages? getting errors? timeouts?
thats one of the side efects of a re-start ....
aside from other things you might want to look at re-designing the app to not be so bound to asp.net.
for example: build a seperate windows service that gets a "request" from a database record, processes the request and then saves the results.
then have the web app store the new request and give the user a way to check back and get the results of the processing.
that way you can stack up as many requests as you want and not have users sitting with a session open waiting for output.
and your app will leave iis / aps.net at a much nicer level of use.
then you can do the other work in the background of the web server or if you need to you can setup 1 or more servers to just crunch the data as fast as you need it.
also a single pass may not be the "optimal" way to process the data.
you might save a huge amount of ram by just doing the job in more than one pass...
do not assume that the only tool is a Hammer, not all problems are Nails....
more than one way to solve a problem.
web servers are *NOT* the best way to do long complex jobs.