1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 Is XenForo compatible with xcache.stat = Off?

Discussion in 'XenForo Questions and Support' started by Vladislav Rastrusny, Aug 13, 2014.

  1. Vladislav Rastrusny

    Vladislav Rastrusny Active Member


    Could you please advice, if XenForo caching system is compatible with xCache with xcache.stat = Off (do not ever test if a file is changed on disk, always use cached version).

    In this case after every rebuild operation (addon installation, style change etc.) I will need to invalidate xcache cache manually. But may be there are some other file caches, which are rebuild in the background by XenForo?
  2. Mike

    Mike XenForo Developer Staff Member

    That should be fine, though I don't know if you'll get a significant benefit as there are still going to be stat calls happening (checking whether an autoload file exists, for example).
    Vladislav Rastrusny likes this.
  3. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    Ok, thanks.

    The reason I'm going to turn stat off is to make server upgrades non-interrupting. Currently, when I deploy some PHP file from PHPStorm on server via SFTP, there is a short moment when file contents is incorrect to be executed because some user requested it while it was being updated in the file system.

    Also this situation can lead to short time of library files inconsistencies. For example, the class I am uploading now has a newer interface, than that one on the server. And there will be a short time while a class with a changed interface is interacting with other classes, which expect older version etc.

    I wanted to utilize xCache for this to make xCache keep compiled version even if I update it in a filesystem. When I'm finished uploading I just clear PHP cache and allow it to be filled by fresh files version.

    Of course this can be solved by bringing application down, but our server is very busy and we try to keep it on zero downtimes.

    Is there a better solution? How it is done here on XenForo.com? Did you actually close the forum upgrading it to 1.4?
  4. Mike

    Mike XenForo Developer Staff Member

    No. The window is considered sufficiently small to be acceptable. If you deploy from the server (rather than uploading files individually), you basically eliminate the upload window.
    Vladislav Rastrusny likes this.
  5. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    Ok, thanks a lot, Mike.
  6. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    Well, we encountered the following problem: with XCache stat=Off and storing templates in the file system there is an obvious problem - templates are not really updated when XenForo updates them. After any template modification, new page creation or anything else that is based on updating a template, you have to manually invalidate XCache PHP cache.

    I've solved the problem by writting an addon which extends XenForo_DataWriter_Template and invalidates xCache php cache on _postSave. This incurs some excessive cache invalidations on addon installation/update where mass template rebuilds are in process, but under our load it currently works ok.
  7. Xon

    Xon Well-Known Member

  8. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    Thanks, I will look into it. Though, I must handle mass template rebuilds as well as single ones.

Share This Page