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

Xenforo and OpCache

Discussion in 'Server Configuration and Hosting' started by Rodrigo Farcas, Sep 2, 2013.

  1. Rodrigo Farcas

    Rodrigo Farcas Active Member

    Does Xenforo play well with OpCache?
  2. Sheratan

    Sheratan Well-Known Member

    What opcache you want to use?

    A lot of people here use APC, Zend Optimizer, and xcache without any problem.
  3. AWS

    AWS Well-Known Member

    Yes it does. I use it on my sites.
  4. lazy llama

    lazy llama Well-Known Member

    Yes, it seems to work fine with the Zend opcache included in PHP 5.5, so far as I've seen.
    Upgraded our system to XF 1.2.1 and PHP 5.5.3 (with-opcache) at the weekend and it's been fine.
    Was previously using APC which XF was fine with, but which seemed to cause problems with a WordPress plugin that we ran on the same host.
  5. Gene Steinberg

    Gene Steinberg Well-Known Member

    PHP 5.4.x and xCache 3.0.3. Seems OK, though WordPress is a tad flaky.
  6. Rodrigo Farcas

    Rodrigo Farcas Active Member

    and XCache v/s OpCache? Any comparisons available?
  7. digitalpoint

    digitalpoint Well-Known Member

    smartpixels and Adam Howard like this.
  8. jacko

    jacko Active Member

    I just enabled it on my site and it is caching nicely and fast :)
    Adam Howard likes this.
  9. LandNetwork

    LandNetwork Member

    How do I verify it is working?
  10. Sim

    Sim Well-Known Member

    There are a number of GUIs for Zend Opcache around which will show you cache status (Google: Zend Opcache GUI)

    I've used an older version of this simple script on my servers for a while now - https://github.com/rlerdorf/opcache-status ... haven't kept up on what other scripts can do, so there might be something better out here, but this one is very easy to set up.
  11. LandNetwork

    LandNetwork Member

    Oh, nice. Got a decent GUI and can see my files are being cached.
    Should this reduce the number of database calls? Because debugging shows that there is the same number of calls now as there was before I put the caching in place.

    For a post on my board:
    0.1777 seconds to compile page
    16 database queries
    5.328 MB of RAM

    0.1052 seconds to compile page
    16 database queries
    5.328 MB of RAM

  12. Sim

    Sim Well-Known Member

    No, opcache only pre-compiles the scripts into opcode for the PHP engine to execute and keeps them in memory ... it only saves the time taken to read the PHP scripts from disk and compile them.

    If your web server runs on SSDs, the benefit from the opcache isn't as dramatic as it might be from a slower HDD based system, but every little bit helps.

    If you want to minimise database calls, you'll need to implement an APC or Memcache cache as described here: https://xenforo.com/help/cache/ ... this will allow the registry data to be read from memory rather than from the database - thus saving on queries and speeding the entire site up.
    Alfa1 likes this.
  13. LandNetwork

    LandNetwork Member

    Hmm.. I've already configured a Memcache, but that does not seem to be affecting the database call count whatsoever.
    Do you know why that would be the case? Little concerned things aren't working as they should be o_O
  14. Anton_Bodryachkom

    Anton_Bodryachkom Active Member

    Nginx,opcache, memcache = speed . We use it with no problem
  15. Sim

    Sim Well-Known Member

    Is your Memcache working? Is there some type of GUI you can use to see items being cached?

    Does the site feel faster with Memcache enabled?
  16. Anton_Bodryachkom

    Anton_Bodryachkom Active Member

    faster yes , here is my gui
    [​IMG] [​IMG]
  17. Sim

    Sim Well-Known Member

    can you see a list of the actual cache keys being stored?

    I use APC and in my GUI, I can see dozens of entries for my XenForo boards - they all start with the prefix defined in
    $config['cache']['frontendOptions']['cache_id_prefix'] ... so I have:
    • userTitleLadder
    • userModerationCounts
    • userFieldsInfo
    • userBanners
    • threadPrefixes
    • styles
    • smilies
    • ... etc
    EDIT: my questions were for @LandNetwork
  18. Moshe1010

    Moshe1010 Well-Known Member

    I assume you meant Memcached:
  19. Sim

    Sim Well-Known Member

    Yeah, whatever is supported by XenForo as specified in the link I posted earlier - which is that one.
  20. vkams

    vkams Active Member

    My hoster provides Opcahe, I turned it on.
    config.php contains only the folloing cache options:
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array(
        'caching'                   => true,
        'automatic_serialization'   => true,
        'lifetime'                  => 10800,
        'cache_id_prefix'           => 'xf_'
    Should I specify additional info in config.php?
    Is it enough or should I ask provider to install Memcahed?

Share This Page