Installed APC ...how do I know if it's working?

daviden

Active member
I added this to my config.php:

PHP:
## Caching
#  http://xenforo.com/community/threads/speed-up-your-board-caching.5699/
#  http://xenforo.com/community/threads/tip-use-apc.6456/
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
                                        'caching'                      => true,
                                        'automatic_serialization'      => true,
                                        'lifetime'                      => 10800,
                                        'cache_id_prefix' => 'xf'
);
$config['cache']['backend'] = 'Apc';

I can access the test apc.php that I uploaded, and I see this:
Skärmavbild 2013-04-18 kl. 00.11.46.webp

Short question ...is my APC working?
 
Try sticking an option in your config to cache the sessions. That will store them in APC and you'll see them in User Cache Entries

PHP:
$config['cache']['cacheSessions'] = true;
 
Try sticking an option in your config to cache the sessions. That will store them in APC and you'll see them in User Cache Entries

PHP:
$config['cache']['cacheSessions'] = true;
Looks like this now:
PHP:
## Caching
#  http://xenforo.com/community/threads/speed-up-your-board-caching.5699/
#  http://xenforo.com/community/threads/tip-use-apc.6456/
$config['cache']['frontend'] = 'Core';
$config['cache']['cacheSessions'] = true;
$config['cache']['frontendOptions'] = array(
                                        'caching'                      => true,
                                        'automatic_serialization'      => true,
                                        'lifetime'                      => 10800,
                                        'cache_id_prefix' => 'xf_'
);
$config['cache']['backend'] = 'Apc';

No data yet though...
There's 80 members active right now, so it should generate something if it'd worked, right?
 
Yeah, it would work instantly.

Here is from my dev site with only me on there
View attachment 44706
Is it because I'm running an older version? Installing with Pecl failed when it tried to compile...
Code:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
compilation terminated.
make: *** [apc.lo] Error 1
ERROR: `make' failed
 
Depends if you want to store the sessions in APC as well. You can adjust a few settings in APC to prevent fragmentation which is caused by having the sessions stored in there.
 
Depends if you want to store the sessions in APC as well. You can adjust a few settings in APC to prevent fragmentation which is caused by having the sessions stored in there.
What do you recommend? And how do I configure what you recommend? :P I'm totally new at this...
 
lol :)

In your APC settings, you need to increase the apc.user_ttl setting. When I ran APC, I had it set to 86400

Code:
apc.ttl = 86400
apc.user_ttl = 86400
 
Should I remove that again maybe?

Yes. (y)

Clearing the cache clears all your members login sessions, requiring them to log back in again - which is no fun for your regulars (and if you're using Apache this will be every day when it rotates the logs [unless you've set-up piped logging] ... :eek: ).

You're also unlikely to see any noticable speed difference by caching sessions in APC.
 
Ok... Managed to update APC to latest version now too.
Added apc.so to php.ini ...and visited my page - BLANK!

...forgot to restart apache, working now. Phew...

So... I should just be happy about caching the stuff I'm caching now?
 
It will be caching the compiled PHP scripts by default, which is where most of the speed improvement will come from.
 
It will be caching the compiled PHP scripts by default, which is where most of the speed improvement will come from.
Ok.
I did not change anything in APC settings ...do I have to do that?
I'm happy with the caching of php scripts.
 
What are your current APC settings? There might be a few things you can tweak to make it more stable in the long run (such as the apc.shm_size )
 
You could, if you don't have it already, install an object cache like memcached/Libmemcached - you can use this for sessions and other non-compiled content as it's a persistant object cache (APC is an opcode [compiled code] cache).
 
What are your current APC settings? There might be a few things you can tweak to make it more stable in the long run (such as the apc.shm_size )
I haven't changed anything ...I just installed it. To be honest, I don't even know where to change the settings.

You could, if you don't have it already, install an object cache like memcached/Libmemcached - you can use this for sessions and other non-compiled content as it's a persistant object cache (APC is an opcode [compiled code] cache).
Do you think it's a good idea? Is it hard to setup...? Remember, I'm a total newbie on this stuff. Not stupid, but newbie. :)

It's late here (in Sweden) and I'm going to bed, work tomorrow ...but I'll be back tomorrow and read the tip you'll (hopefully) give me.
BIG thanks so far. :)
 
Back
Top Bottom