recycling application pool programmatically across different web servers

Last post 07-13-2009 5:06 PM by SanjayU. 3 replies.

Sort Posts:

  • recycling application pool programmatically across different web servers

    07-13-2009, 10:35 AM
    • Member
      2 point Member
    • jcwc1
    • Member since 07-06-2007, 3:52 PM
    • Posts 5

    Hi,

    I don't know whether this is possible but i am trying to recycling my applications pools from code. I have two web servers sitting on separate machines, so when a user submits, i want the code to recycle both web sites application pools for each machine so the caching of each website is the same.

    Or alternatively, is it possible for 2 web servers on different machines to use only 1 application pool? As you can tell i am not a IIS expert and i'm not sure of the limitations.


    johnny


  • Re: recycling application pool programmatically across different web servers

    07-13-2009, 1:36 PM
    • Member
      88 point Member
    • SanjayU
    • Member since 01-05-2009, 6:27 PM
    • Posts 19

    I'm not 100% I understand your requirement, but are you just trying to make sure each web server has identical cache?  If so there are probably much better ways around this.  You will need to approach your problem slightly differently though.  Basically, you need a way to invalidate/refresh cache once a user "does something" - is that correct?

    http://geekswithblogs.net/SanjayU
  • Re: recycling application pool programmatically across different web servers

    07-13-2009, 3:56 PM
    • Member
      2 point Member
    • jcwc1
    • Member since 07-06-2007, 3:52 PM
    • Posts 5

    Yes, in a way that is what i need because we have two identical web applications being run on two separate web servers on different machines and we have a load balancer that will distribute the requests. The issue i have is to do with with synchronisation, i.e when a user adds an item, it gets cached to one web server, but not the other web server, so the user sees a difference when you keep refreshing the same page and the load balancer switches between the "new" and the "old" cached version.


    Does that make it any clearer?

  • Re: recycling application pool programmatically across different web servers

    07-13-2009, 5:06 PM
    • Member
      88 point Member
    • SanjayU
    • Member since 01-05-2009, 6:27 PM
    • Posts 19

    Yes - it does make sense.  That said I have no clue if you can programmatically recycle app domains, regardless it is IMO not the correct technical solution.  The real problem you're trying to solve here is one of distributed caching.  Basically, you should be caching on a machine that is logically or physically disparate from your web-servers.  This way each web server grabs the latest cache from a different machine and cache gets updated in one place.  There is a Microsoft product, Velocity, specifically for this.  Unfortunately, it is not out yet (for production).  It sounds like you're working on a production system, so you probably shouldn't rely on this. 

    There are other options available, though, including Memcache (http://jehiah.cz/projects/memcached-win32/) or you can just google "distributed caching .net".  I've also read posts mentioning that you can solve the problem is distributed caching using SQL notification services, though I can't say I've seen an implementation.

    Personally, though, unless you're working on a very large/high-traffic system...the added complexity of doing this likely will nnot be worth it.  You problem is probably better solved by modifying settings on your proxy server.  Most proxy servers have a setting called something like "Session Stickiness".  Basically, the proxy server will make sure that User A is pushed to the same node within a certain timespan (say, 20 minutes).  This means that if user-specific information is inserted into cache, the proxy will guide that user to the same machine.  You can set the time-limit to the same duration as your session-timeout.  If you are inserting non-user specific data into cache - it shouldn't matter since you'll want to have that cached on however many machines you've got running.

    Hope this explanation makes sense.

    Sanjay

    http://geekswithblogs.net/SanjayU
Page 1 of 1 (4 items)