Help with Appdomain unloading..

Mar 5, 2007 at 11:01 AM

I have an HTTPModule that is receiving requests that does some processing against a cache to be able to respond quickly. On a cache miss, it does a lazy fetch to an app server that (for ease) responds to all web servers via a multicast. The HTTPModule creates a thread to receive incoming cache update from the app servers.

I've noticed my HTTPModule unloading (while testing) from time to time due to inactivity of incoming requests (currently I maintain a static ref to my cache object). I understand this is standard behavior (are there ways to keep it permanently resident?) However, I need to have the following happen:

1) Keep the cache persistent at all times (the cache is fairly large so rebuilding it each time the AppDomain unloads/reloads will be expensive). Fortunately I am using Entlib 2.0, so I could use an Isolated/Database store if necessary. Is this the best way to achieve what I need here?

2) Keep a thread listening to the app server updates alive at all times. Because of the multicast design from app server to web server, a thread needs to be resident to update the cache else the response will be lost.

Ancillary question: We expect, eventually, to be handling a very very large number of requests a day. Are HTTPModules/HttpHandlers the most efficient, both in speed and resource requirements, way to approach this problem through IIS (5.x/6.x)?