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

Setting up caching

Discussion in 'Server Configuration and Hosting' started by gavpeds, Nov 26, 2015.

  1. gavpeds

    gavpeds Active Member

    Hi all so i am not to clued up on this but i would like to setup caching to hopefully improve the performance of our site. It's not terrible by any means but if i can squeeze a bit more out why not!
    I am on a VPS with this setup:
    • Intel Xeon CPU
    • Guaranteed 0.750 CPU Cores
    • Burst Up to 2.250 CPU Cores
    • Guaranteed 400 Sustained IOPS
    • Burst Up to 1000 IOPS
    • Centos 7.x 64 bit
    PHP 5.6
    DSO with mod_ruid2

    As i understand it php 5.6 has OPcache already with it??? Do i need to do anything on xenforo end to configure this??

    So my question is what would be a good cache to use? I see many talk about memcache but as mentioned i am not sure what is best or the best setup to have. Any suggestions would be great.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Both frontend and backend are required.
    The frontend enables the cache, the backend defines the type.

    The config.php cache entries are for caching data.
    Opcache is for caching PHP's opcodes.

    Effectively, one holds data that is explicitly given to it (a (data) cache) and the other holds compiled PHP code (opcode cache). They're wholly independent of each other. Example opcode caches would be APC and the built-in (in PHP 5.6) opcache.

    Of the caching methods, I would recommend Memcached. You should specifically opt-in to session caching as well:
    $config['cache']['cacheSessions'] = true;
    With Memcached, cached data will be expunged when it expires (after lack of use) or when the memory is full (in a least-recently-used fashion).

    CSS minification requires caching to be enabled, but putting the templates in files doesn't. Putting the templates in files is mostly just useful if you have an opcode cache.
    maszd likes this.
  3. gavpeds

    gavpeds Active Member

    Thank you thats useful @Brogan So i will go get our host to get memcached installed is there any recommendation for configuration server side?
    Last edited: Nov 26, 2015
  4. gavpeds

    gavpeds Active Member

    So my host has installed it and given this.
    root@vps [~]# systemctl status memcached.service
    memcached.service - Memcached
    Loaded: loaded (/usr/lib/systemd/system/memcached.service; disabled)
    Active: active (running) since Thu 2015-11-26 14:02:22 GMT; 7s ago
    Main PID: 27207 (memcached)
    CGroup: /system.slice/memcached.service
    ▒▒27207 /usr/bin/memcached -u memcached -p 11211 -m 64 -c 1024

    root@vps [~]#

    I am presuming that is installed correctly? Do i just need to add the bits to config.php now
  5. Moscato

    Moscato Active Member

    Opcache is included in 5.6 by default, but that doesn't mean that it's *enabled*
    Marcus and gavpeds like this.
  6. gavpeds

    gavpeds Active Member

    I've enabled it but not sure about this memcached stuff. It's been installed that's all I know. I am not sure at this point if all I need to do now is add the codes to config.php or if I need to do more.
  7. RoldanLT

    RoldanLT Well-Known Member

    Yes you need to add this: https://xenforo.com/help/cache/
  8. gavpeds

    gavpeds Active Member

    Thanks i have added it, however i am not really sure if it is working or not the site does not seem any different in performance.
  9. Tracy Perry

    Tracy Perry Well-Known Member

    You'll notice more of a reduced load on the server than speed-up of the forum.
    gavpeds likes this.
  10. gavpeds

    gavpeds Active Member

    Ah ok thanks i had noticed a bit of a reduced load.

Share This Page