APC and caching

Also remember that fragmentation isn't bad if you've got the memory to cover it, it only becomes an issue when you're tight for available space.
 
Previously before I was caching the variables there was none at all

This is since I enabled it in the config file.

Screen Shot 2012-04-21 at 21.31.25.webp
 
I wouldn't blink twice at that mate, leave it running and check back in a day. You've got ample room to accommodate what little fragmentation there is and it won't really get any worse. :)
 
I wasn't sure if we'd suffer any performance issues from the fragmentation?

The hit rate is down to the file cache which is working great, it's just the variabe cache causing the fragmentation.
 
yeah ignore fragmentation, it's all about cache hit/s :D
 

Attachments

  • zstats_220412_01.webp
    zstats_220412_01.webp
    99.5 KB · Views: 64
I must say, moving to my new server with an abundance of specs, I hadn't installed caching until today... though once again, with APC running and XF getting use of the file template cache... instant performance improvement for a 400k post board.
 
Previously before I was caching the variables there was none at all

This is since I enabled it in the config file.

View attachment 28655
Based on my experience, running APC and caching the XenForo sessions will result into guaranteed fragmentation, your graph shows perfectly what I mean. That translates to slower performance overall.
Personally, I use Memcached + Libmemcached for XenForo cache and APC for the regular php files cache.
Here are my stats:

IMG_22072012_233802.webp

Libmemcached library (combined with php-pecl-memcached) is HUGELY superior, compared to Memcache one.
 
Personally, I use Memcached + Libmemcached for XenForo cache and APC for the regular php files cache.

Libmemcached library (combined with php-pecl-memcached) is HUGELY superior, compared to Memcache one.

Floren, could you expand a bit on how you would go about setting this up as I'm considering removing memcached + eAccelerator (been setup like this for quite some time) and replacing them both with APC?

Also what an example XF config.php file looks like for the setup you describe?

Many thanks,
Shaun :D
 
Hmmm ... after some fiddling around last night I've changed my setup and managed to lower my server load and get my sites running faster too.

I removed eAccelerator, removed Ioncube loader (previously used for my IP Board Nexus shopping add-on [pre-XF]), removed Zend Optimizer (didn't need it), and upgraded my older install of APC to the latest stable (3.1.9) with a number of additional settings (quoted below) and left Memcached running as it was.

Server load has come down quite dramatically and is now less than 1 on all three counters; my periodic load highs of 4+ have disappeared; my random site lock-ups or longer than expect response times to simple queries (such as hovering over the alerts list) have gone too; and as I write this there are over 700 online at my various sites and the load averages are: 0.65 - 0.79 - 0.75

extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=256M
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.ttl=7200
apc.use_request_time=1
apc.user_ttl=7200
apc.gc_ttl=3600
apc.cache_by_default=1
apc.filters
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.file_update_protection=2
apc.enable_cli=0
apc.max_file_size=2M

I'm still intrigued about the Libmemcached library (combined with php-pecl-memcached) - is this something you could give me some more info on?

Also what about running PHP as FastCGI - is there any advantage to doing this?

Thanks,
Shaun :D
 
I have APC installed and setup as it should be in config.php, however my apc.php stats show no usage of the APC at all. Any ideas?
 
I have APC installed and setup as it should be in config.php, however my apc.php stats show no usage of the APC at all. Any ideas?

You don't need to add APC to your XF config at all. Can you post a copy of your config (minus the database details at the top).

Cheers,
Shaun :D
 
This is all of the cache related information:

Code:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
'caching'                  => true,
'automatic_serialization'  => true,
'lifetime'                  => 1800,
'cache_id_prefix'          => 'xf_'
);
$config['cache']['backend'] = 'Apc';
$config['cache']['backend'] = 'Memcached';
$config['cache']['backendOptions'] = array(
'compression' => false,
'servers' => array(
array(
// your memcached server IP /address
'host' => 'localhost',
 
// memcached port
'port' => 11211,
)
)
);

memcached is working fine.
 
Remove this line - it's not needed:

Code:
$config['cache']['backend'] = 'Apc';

APC will cache PHP without any explicit settings in the XF config file and you can leave Memcached set as your backend data cache (as you already have it in your config file).

Do you have the file apc.php installed on your site so you can see what APC is doing? If not download the one I've attached and upload it to the root of your site (call it in your browser e.g. http://yoursite.com/apc.php) - what do you get?

Cheers,
Shaun :D
 

Attachments

Floren, could you expand a bit on how you would go about setting this up?
Really easy if you run Redhat:
# yum --enablerepo=axivo install php-pecl-memcached
This will require my PHP rpm's which are designed for Nginx only, which is designed for OpenSSL 1.0.1c, etc.
Obviously, if performance is your goal, you can start from scratch and use everything from Axivo. My rpm's are used on sites with over 50,000 online users and are specifically tuned for Intel processors.

On the other hand, if you want to stick with Apache & Co., might as well not bother with Libmemcached and other fancy things... but then you would miss on things like running a file-less server, ehh? :)
https://www.axivo.com/community/library/config.php

So far, nobody offers the libmemcached rpm's for Redhat... if you want to venture, go to http://rpm.axivo.com/.
The config is explained into Zend documentation, which XenForo uses. You should read it so you understand what it does, I'll get you started:
Code:
$config['cache']['enabled'] = true;
$config['cache']['cacheSessions'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
        'caching'                       => true,
        'cache_id_prefix'               => 'xf_',
        'automatic_serialization'       => true,
        'lifetime'                      => 0
);
$config['cache']['backend'] = 'Libmemcached';
$config['cache']['backendOptions'] = array(
        'servers'       => array(
                array(
                        'host'          => '127.0.0.1',
                        'port'          => 11211,
                        'weight'        => 1
                )
        )
);
 
This is all of the cache related information:

Rich (BB code):
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
'caching'                  => true,
'automatic_serialization'  => true,
'lifetime'                  => 1800,
'cache_id_prefix'          => 'xf_'
);
$config['cache']['backend'] = 'Apc';
$config['cache']['backend'] = 'Memcached';
$config['cache']['backendOptions'] = array(
'compression' => false,
'servers' => array(
array(
// your memcached server IP /address
'host' => 'localhost',
 
// memcached port
'port' => 11211,
)
)
);

memcached is working fine.

Nice. o_O Just for clarification, that is not proper.
 
Top Bottom