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

Setting up caching

gavpeds

Active member
#1
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
Running:
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.
 

Brogan

XenForo moderator
Staff member
#2
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:
PHP:
$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.
 

gavpeds

Active member
#3
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:

gavpeds

Active member
#4
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
 

gavpeds

Active member
#6
Opcache is included in 5.6 by default, but that doesn't mean that it's *enabled*
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.