Caching in a stateless server architecture RRS feed

  • Question

  • Hi Forum


    I need some advice on the best caching strategy/technology for my scenario. It is critical that I find a fast and reliable solution for this case.

    I have some meta-data that needs to be accessable from everywere in the server application. (Service, Business and Data Layers). The meta-data holds application rules etc. The meta-data does not change while the application is "running". The meta-data is located in a 1MB xml file and should ideally be deserialized into meta-data objects on application startup. I want to hold the meta-data objects in memory all the time. It must have a very little/almost no cost to access the meta-data objects in the application.


    This would be quite simple to achieve if I had objects around in memory for the entire application, but all the objects are hosted as "Per Call" (same as Single Call in Remoting). (one instance is created per call and then taken out of memory). The server application is hosted in a WCF service.


    I'm thinking that running a state server on the same server might be the fastest option (using Enterprise Library)? ..or could I maybe store it in the WCF host and access from the hosted objects?


    I hope that someone with experience can help me find a good solution.





    Wednesday, April 9, 2008 7:33 AM


All replies

  • Dear  Siteadm,


    You said that "The meta-data does not change while the application is "running"". Since the meta-data is not going to change then you can load the entire data at the application start-up and these objects can then be used throughout the application. Since the meta-data is not user specific, it makes no sense in having a seperate state server.


    Hope this helps you !

    Wednesday, April 9, 2008 7:45 AM

    Hi Sandeep


    Thank you for your reply.


    I would like to store the objects in "application state". But I don't know of a way to cache objects in a WCF host and access it from the hosted objects. Do you? I just posted to the WCF forum with a question on this. You might be right that caching using a state server might be overkill.



    Wednesday, April 9, 2008 7:55 AM
  • I think you can use HttpRuntime.Cache for WCF host. HttpContext.Cache is leveraging HttpRunTime.Cache internally.
    Wednesday, April 9, 2008 5:50 PM
  • Best bet would be to cache in the hosting application, whether IIS, Windows Service or WAS.  In the past I have used "Caching Application Block" from patterns and practices to cache static information...


    Hope that helps.

    Thursday, April 10, 2008 1:20 PM