locked
WinCache User Caches Expire Prematurely RRS feed

  • Question

  • User398711845 posted

    I posted on the FastCGI forum last week, but I did not get any pertinent feedback.  Luckily, I found this forum for WinCache, so I figured I'd give it another go.  I am trying to resolve user caches expiring prematurely.

    In a 2009 article on iis.net, "Use the Windows Cache Extension for PHP" discussed only three types of WinCache caches for this IIS extension.  The WinCache user cache functionality was not addressed.  I wonder if perhaps that is because the user caching is not relialbe?

    It is my understanding that user cache ttl is independent of the ttl setting for WinCache in php.ini, and that somehow fastcgi is terminating idle threads, thus prematurely wiping out user cache regardless of the ttl set for user cache in PHP.  Is there a workaround for this?  I tried extending the IdleTimeout setting in fastcgi in the iis console, but this has not been successful.  Any help would be greatly appreciated.

    Win 2008 R2,

    IIS 7,

    WinCache 1.3.4.0 ,

    PHP ver 5.3 VC9 NTS,

    Tuesday, August 27, 2013 10:57 AM

All replies

  • User-2048372337 posted

    We have the same setup as you, except we are using PHP 5.5.2 and WinCache 1.3.5 (now, we have been throught the same versions you are using) and our Ucache has worked 100% reliably for over 2 years.

     

    There is a post somewhere on this forum about a similar issue though, but I don't know if that person ever found a solution.

    Tuesday, August 27, 2013 12:32 PM
  • User398711845 posted

    If the cache is read frequently, it will persist.  However, if there is no request for about 10 minutes, the cache will be dropped.  This is why I thought perhaps the idle thread setting in FastCGI could resolve...

    How long are your caches set to live?  Are they accessed frequently?

    Tuesday, August 27, 2013 4:59 PM
  • User-2048372337 posted

    How long are your caches set to live? 

    They vary, from 30 seconds to 24 hours.

     Are they accessed frequently?

    Normally, yes, but I'm fairly certain that they go more than 10 minutes at times without being accessed (like overnight) and that the cache persists (we have a huge problem when I cached some date processing indefinitely and the date changed.)

    Tuesday, August 27, 2013 5:04 PM
  • User398711845 posted

    Thank you for the feedback.  I am at least hopeful now that it can work.  I may use file caching as a fallback until I can resolve.  These caches are not numerous enough that the file caches will cause performance problems, but ideally memory caches are what we want.

    Tuesday, August 27, 2013 5:10 PM
  • User1808474029 posted

    If your hosted solution is not getting traffic every 10 minutes or so, there are two key components where you will need to update the default configuration.

    App Recycling:

    By default, the application pools in IIS will have an idle timeout set to 20 minutes. So, if no one hits the server for 20 minutes, the app pool will be terminated with the user cache and then recreated on the next visitor. Additionally, there is a default recycle every 29 hours that will also clear the user cache. To resolve, set the idle timeout to 0, and set a specific time for the app pool to recycle, which will effectively act as a daily (or whatever frequency) process to intentionally clear the user cache. Here is an article with screenshots:

    http://weblogs.asp.net/owscott/why-is-the-iis-default-app-pool-recycle-set-to-1740-minutes

    PHP FastCGI idleTimeout:

    You'll also need to change the global FastCGI Settings for your php-cgi.  IIS Manager->Server->FastCGI Settings.  Edit the php-cgi that you are using and set the idle timeout (I set mine to 24 hours or 86400s).

    Thursday, May 29, 2014 2:06 PM
  • User398711845 posted

    Thanks so much VanLee!  I had almost given up hope...

    Works like a charm now, and even though it doesn't happen on our production server very often, we have mysteriously lost caches.  This was always a worry in the back of my mind!

    Wednesday, September 10, 2014 10:19 AM