开发者

how to use asp.net web application to manipulate memory?

Things to achieve:

  • multiple groups of users interacts using browser.

  • in each group, users will interact with some data(objects).

  • the data(objects) are loaded from database. during the interaction, users needs quick and synchronized view of the same data(object), so they must be save in the memory.
  • data(objects) will change during the interaction, but only the final result of this interaction 开发者_如何学Pythonneed to be saved back into DB.

My Current Solution

load data(object) into global.asax the manipulate. but for this solution, i got few questions.

  • how can i make sure the web application have ONLY ONE instance?(configure in iis-->application pool?)
  • because web application would restart by itself, as a result, all data in the application state will lose. how can i avoid application restart by it self rather than managed?
  • in the iis application pool setting, i can set the recycle time, is it guaranteed that no application restart will happen during this time?
  • or is there and event that might trigger something(before application restart) so i can save the current application status and load them back again?

  • or there's simply another way to achieve what i need to achieve?

thanks


I think you should not try to trick the IIS application pool etc. Just let it be and enjoy the fact that scaling the application could be a bit easier that way.

Instead, you should think of setting up some kind of shared memory on a separate server (process). If you use something like Memcached to store those data objects, that should basically be the same as if it was stored in a variable in the web application, except that it will stay there longer than the web application lifetime.

You should probably not need to fear that that is not synchronized enough unless you have a lot of input/output on one object or actually need real-time communication or the object's events ...


There is the Application_End event. But I heard it's not always called. Worth a try I guess.

Then, you can setup the App Pool to recycle according to your specs:

http://remy.supertext.ch/2010/08/iis7-worker-process-reached-its-allowed-processing-time-limit/

If there is no usage on your app in the night, that is an easy solution.

Something like Memcache is obviously more professional. I think MS has something similar for IIS7.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜