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

Defining A Cache - What's The Point?

DRE

Well-known member
#1
Is my forum large enough to warrant defining a cache? http://xenforo.com/help/cache/

Question I asked my host just now.

Q: Hi with this Dedicated Server does caching features come with it? I would like to define a cache to help enhance the site's performance and loading time.

A: You are located on a semi-dedicated hosting plan which is not a dedicated server. That said, you should be able to configure XenForo to use a file cache as described on that help document. The APC and Memcached options are not supported.

^^^So according to him, all I should use via the help document is this part?

Cache Front-End

Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
File Back-End

Code:
 $config['cache']['backend'] = 'File';
^^^That's all I need right?
 

Jake Bunce

XenForo moderator
Staff member
#3
At the very least I recommend installing APC in your PHP configuration. APC speeds up execution without requiring any special configuration in XenForo. Just install APC on your server and that's it.

Beyond that you can also setup a memory cache which requires more effort and configuration. See my post here:

http://xenforo.com/community/threads/xenforo-plus-apc-plus-memcache.34985/#post-397405

And Naatan's post is a good one regarding setting up a memory cache:

To be clear, this is far more trouble than it's worth unless you are running a very active site. Especially if you don't know much about memcache, APC or caching in general.
In short, just install APC. Don't bother with a memory cache.
 

ibaker

Well-known member
#4
I have a dedicated server that is managed by an outside server management company...how can I check if APC is installed and working?
 

ibaker

Well-known member
#6
Thanks Jake
I have lodged a support ticket with my server mgmt to install APC...the monitoring page you have provided a link for is for Drupal or does that not matter...I would guess that I would be able to call the page up from my WHM panel?
 

ibaker

Well-known member
#8
Thanks Jake, I have just been informed by my server mgmt that APC is now installed.

So can I please confirm what I need to do now...I add:
Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
// $config['cache']['cacheSessions'] = true;
to the config file

But what do I do about the backend?
 

Jake Bunce

XenForo moderator
Staff member
#9
Thanks Jake, I have just been informed by my server mgmt that APC is now installed.

So can I please confirm what I need to do now...I add:
Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
// $config['cache']['cacheSessions'] = true;
to the config file

But what do I do about the backend?
APC is normally used as an opcode cache which doesn't require any configuration in XenForo. It just automatically works by storing the compiled versions of PHP files. An opcode cache yields significant performance benefit without any special configuration in XenForo. xenforo.com uses APC.

Configuration is only required for a memory cache (to store the data registry and session records in shared memory). A memory cache can shave off a couple of queries on each page which can be significant on busy forums, but it also requires more effort to setup.
 

ibaker

Well-known member
#11
I had my server mgmt people install APC and now my error log file in my XF root directory is being bombarded with errors saying:
[26-Sep-2012 04:43:07 UTC] PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0
 

Jake Bunce

XenForo moderator
Staff member
#12
I had my server mgmt people install APC and now my error log file in my XF root directory is being bombarded with errors saying:
[26-Sep-2012 04:43:07 UTC] PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0
http://syslint.com/syslint/php-warn...ses-mg-suffixes-please-update-your-ini-files/

You may see this error after the installation of APC . To fix this please the following changes in apc.ini .
change it from:

apc.shm_size=512

To:

apc.shm_size=512M

You may need to specify “M” for MB or “G” for GB to solve this issue.