Caching in a web farm

Last post 05-18-2007 8:49 PM by jimmy q. 6 replies.

Sort Posts:

  • Caching in a web farm

    05-17-2007, 9:31 PM
    • All-Star
      44,830 point All-Star
    • jimmy q
    • Member since 11-02-2006, 5:01 AM
    • Australia
    • Posts 3,110
    • Moderator
      TrustedFriends-MVPs

    I understand that to maintain sessions across a web farm i need to either implement an ASP.NET state server service or a SQL Server State database.

    However, does either of the 2 solutions for managing state across a web farm also synchronise cached objects? 

  • Re: Caching in a web farm

    05-18-2007, 3:18 AM
    • Participant
      996 point Participant
    • antonpious
    • Member since 04-21-2007, 8:20 AM
    • Posts 144

    Hi Jimmy,

    I am afraid you have to handle the caching strategy differently.

    While session is common to a user the cache is common to all users and behaves very much like an application variable and stored in memory for the appDomain.

    You have to handle Caching seperately.

    Have a look at MemCache which uses an external process where others can store and retrieve cached information.

    Happy Programming,
    Anton

  • Re: Caching in a web farm

    05-18-2007, 3:40 AM
    • All-Star
      44,830 point All-Star
    • jimmy q
    • Member since 11-02-2006, 5:01 AM
    • Australia
    • Posts 3,110
    • Moderator
      TrustedFriends-MVPs

    Thanks for your reply Anton.

     

    I am not sure whether you understood my question.

    I have a web application that i need to deploy onto a web farm, therefore i need out of process session management and i have chosen to use the ASP.NET session server service to manage my sessions across multiple web servers.

    In this web application, i also make sure of the Cache object to minimise requests to external resources etc. Would the ASP.NET session server service enable the Cache data collection to be synchronised across all the web servers? Or will the cache collection data be specific to each individual web server's appdomain/asp.net worker process?

     

    Would the ASP.NET State server service also synchronise the Application collection variable?

     

    So in short i understand the ASP state service is an out of process modal that can synchronise Session data across multiple webservers, the answer i need to know is

    Does the ASP.NET state service or the SQL Server state server

    1/. synchronise Application variables

    2/. synchronise Cache variables

     

    If i have misunderstood your reply anton, i apologise.

     

    Thanks

    Jimmy
     

  • Re: Caching in a web farm

    05-18-2007, 5:17 AM
    Answer

    Hi,  jimmy:

    I suppose no:

    The Cache object lives inside the current AppDomain (ie. ASP.NET Application Scope) and it stores its entries in a Hashtable.

    More Details:

    http://west-wind.com/weblog/posts/1214.aspx

    I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance

    Best Regards,
    __________________________________________________
    Sincerely,
    Rex Lin
    Microsoft Online Community Support

    If there is any question or the issue is not resolved, please feel free to mark the thread as not resolved
  • Re: Caching in a web farm

    05-18-2007, 9:45 AM
    • All-Star
      44,830 point All-Star
    • jimmy q
    • Member since 11-02-2006, 5:01 AM
    • Australia
    • Posts 3,110
    • Moderator
      TrustedFriends-MVPs

     Ah bugger.

     

    I was hoping that cache data can be shared across in a web farm. It now looks like i have to weigh up whether caching is a good thing versus implementing my own synchronisation code with the extra complexity and overhead.

     

  • Re: Caching in a web farm

    05-18-2007, 7:21 PM
    • Member
      92 point Member
    • freakshow
    • Member since 07-21-2006, 8:50 PM
    • Posts 29
    You might have a look at the Caching Application Block, using a database as a backing store.
  • Re: Caching in a web farm

    05-18-2007, 8:49 PM
    • All-Star
      44,830 point All-Star
    • jimmy q
    • Member since 11-02-2006, 5:01 AM
    • Australia
    • Posts 3,110
    • Moderator
      TrustedFriends-MVPs

    freakshow:
    You might have a look at the Caching Application Block, using a database as a backing store.
     

     

    Hi freakshow,

     

    I have never used the Application Blocks but on the top of my head wouldnt using a database as the cache store defeat the purpose of caching as i will need to hit the db to get the cached items? 

Page 1 of 1 (7 items)