locked
What IIS application pool recycling does except clearing cache? RRS feed

  • Question

  • User1555919309 posted

    When we update a value on the database, we want to update it in the cache. Normally the application pool recycles in every 29 hours. What if I manually recycle the application pool for the application? Is it going to affect user experience? Any side effects?

    Or other than application pool recycle, is there better way to clear cache?

    Thank you in advance!

    Thursday, February 18, 2021 4:48 PM

All replies

  • User753101303 posted

    Hi,

    Depends how the app is written and configured. It's basically a restart and so you could for example lose session variables etc...

    Rather than depending on that you could use a lifetime or https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/detecting-changes-with-sqldependency to refrresh cached data without  having to "restart" the application.

    Thursday, February 18, 2021 5:10 PM
  • User1555919309 posted

    Hi PatriceSc,

    I think yours is a good solution for frequently changing data. In my case, we only change the value couple times a year. If I add dependency to all the sql command everytime, it might cause performance issue. After reading the article you mentioned above, it seems to be checking database all the time and it is good for systems with frequently changing data.

    What I want is to safely clear an application cache manually or automatically. I want the safest way and one that is best practice. Thank you for your answer. 

    Thursday, February 18, 2021 8:58 PM
  • User475983607 posted

    TimJin

    In my case, we only change the value couple times a year.

    How is this a problem?  Your cache lasts over a year?

    TimJin

    What if I manually recycle the application pool for the application? Is it going to affect user experience?

    Depends on how your application is designed.  You are the only one that know how a restart affects your application.  Application memory is cleared so anything that depends on memory will be lost. Any information that cannot be reloaded can be a problem.  

    Since you already recycle every 29 hours then the likely hood cache is stale is very very low.  There are 5780 hours in a year.   Also, every cache API has an expiration.  Make the expiration a fraction of the recycle period; 29/2 or 29/4 or 29/8. 

    Lastly, whatever process updates the database can send an HTTP request to the app to the reload cache.  

    Thursday, February 18, 2021 9:30 PM