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

Xenforo and OpCache

lazy llama

Well-known member
#4
Does Xenforo play well with OpCache?
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.
 
#11
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.
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:
Pre-cache:
0.1777 seconds to compile page
16 database queries
5.328 MB of RAM

Post-cache:
0.1052 seconds to compile page
16 database queries
5.328 MB of RAM

Thanks.
 

Sim

Well-known member
#12
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.
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.
 
#13
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.
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
 

Sim

Well-known member
#15
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
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?
 

Sim

Well-known member
#17
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
 

vkams

Active member
#20
My hoster provides Opcahe, I turned it on.
config.php contains only the folloing cache options:
Code:
$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?