• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[Tip] Use APC

  • Thread starter Thread starter Floris
  • Start date Start date
Not sure if this helps bit I did find this: http://www.imminentweb.com/technologies/tune-apc-improve-php-performance

Having installed APC for PHP does not automatically improve the performance. You have to adjust the parameters. At the very least, change these values:
apc.ttl="7200"
apc.user_ttl="7200"
apc.shm_segments="3"
apc.shm_size="90"
Setting apc.ttl and apc.user_ttl to none-zero can ensure that the cached php code gets refreshed at the given number of seconds without filling up the memory with stale entries.
The number assigned to apc.shm_size is the size of each shared memory segment in MB. To find the Linux kernel's maximum shared memory size, do
# cat /proc/sys/kernel/shmmax
If you already set the apc.shm_size to the maximum allowed size, then raising the value of apc.shm_segmentswould be the next thing to do.
Of course you can always raise the maximum size of a shared memory segment, using sysctl. Do this only when you know what you are doing. Run "man sysctl" for more information.

Note though one of the responses further down the page: http://www.imminentweb.com/technologies/tune-apc-improve-php-performance#comment-68

I don't know if this is valid information though so hopefully someone will confirm.
 
Thanks for this brogan... Hopefully someone will know what they should be set to for optimum performance
 
For what it's worth, while we have APC installed on this server, we have nothing in our config file to direct specific caches to it. XenForo.com itself makes use of the OpCode cache in APC alone at this point (which provides a massive performance boost over not having APC at all)
 
Doesn't:



From the first post cover that?
No, it shouldn't. Beta 2 explicitly sets $config->cache->enabled to false in Application.php and until this variable is true nothing about caching will be done, without checking other parameters.
However if you are unsure you can always look at the debug output and check if it includes files like library/Zend/Cache/Backend/Apc.php.
 
For what it's worth, while we have APC installed on this server, we have nothing in our config file to direct specific caches to it. XenForo.com itself makes use of the OpCode cache in APC alone at this point (which provides a massive performance boost over not having APC at all)
Would that change in the future? Would you give some configuration guideline on how to best take advantage of Xenforo with APC?
 
No, it shouldn't. Beta 2 explicitly sets $config->cache->enabled to false in Application.php and until this variable is true nothing about caching will be done, without checking other parameters.
However if you are unsure you can always look at the debug output and check if it includes files like library/Zend/Cache/Backend/Apc.php.
For reference, this ends up being a performance boost (when the cache is not in use/enabled), as well as fixing the reliance on /tmp and some problems people had with cache_dirs. You need the line in question as an alternative to caching = true (caching is on by default now).
 
For reference, this ends up being a performance boost (when the cache is not in use/enabled), as well as fixing the reliance on /tmp and some problems people had with cache_dirs. You need the line in question as an alternative to caching = true (caching is on by default now).

You've just confused me completely ..
 
I am taking it that we only need the settings that Floris had in his first post for this thread then if caching is enabled by default?

I just went through heck getting apc installed on the server, had all kinds of memory pool errors and database errors with my one vb4 site. Primarily why I wanted to get apc working was to help the vb slug and not so much xf because that was fast as it already was.
 
Mike/Kier,
I'm a bit confused by this...
I understand that the APC caching is automatically done on some level just by having APC installed on PHP.

Is there any other configuration options (such as the one Floris posted the tip about in the first post) we need to add to take full advantage of APC caching in xenforo?
 
To be clear, here on XenForo.com right now, APC is installed and running on the server, but we are not currently making use of it for anything except opcode caching, which is done simply by virtue of APC being present. We have not added any APC-specific instructions to our config file so far.
 
Ok, fair enough. Any particular reason why you're not adding anything additional to the config.php file? Don't feel the need, or because it's constantly being developed, or it adds no additional benefit?
 
Ok, fair enough. Any particular reason why you're not adding anything additional to the config.php file? Don't feel the need, or because it's constantly being developed, or it adds no additional benefit?
We've seen cache slam issues that we hope will be resolved in a future version of APC.
 
Memcached was not working for me.
I used instead

$config['cache'] = array(
'enabled' => true,
'frontend' => 'Core',
'frontendOptions' => array(
'caching' => true,
'automatic_serialization' => true,
'cache_id_prefix' => 'xf_',
'lifetime' => 1800
),
'backend' => 'Memcached',
'backendOptions' => array(
'servers' => array(
array( 'host' => '127.0.0.4', 'port' => 11211 )
),
'compression' => false
),
);

And it is working now
(please note the 127.0.0.4, most probably yours is 127.0.0.1
 
Memcached was not working for me.
...
And it is working now

Thanks for that, took a look inside Application.php myself and have also got it working. Makes a noticeable difference.

Also... I have it running fine on a setup of 5 front end web servers, and that works fine too. The key to that is using NFS to mount a shared directory from a single backend machine, and then setting up /data and /internal_data as symbolic links (ln -s). This allows all of the front-end web servers to basically share the state.

I wouldn't class this as ideal by any stretch, but I like that I could config it for my system pretty easily.

What I'd like to see:
1) MySQL Master/Slave setup.
2) I'd die for a Postgres option.
3) Config.php commented up to show the cache options and everything else it can do.
4) Sphinx search.
5) No shared data directory... or at least the use of /data and /internal_data being optional.

Basically that a shared nothing, horizontally scalable architecture is possible, and that using Postgres could be an option but at the very least that I can use MySQL read slaves.

I'm running Xenforo on a small private website until it matures ( http://www.blueveins.co.uk/ ), but when it does mature I'll replace a big board vBulletin instance with Xenforo ( http://www.lfgss.com/ ).
 
Top Bottom