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

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

daviden

Active member
#1
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.png

Short question ...is my APC working?
 

MattW

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

daviden

Active member
#5
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?
 

daviden

Active member
#8
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
 

MattW

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

daviden

Active member
#10
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...
 

MattW

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

CTXMedia

Formerly CyclingTribe
#12
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.
 

daviden

Active member
#13
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?
 

MattW

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

CTXMedia

Formerly CyclingTribe
#17
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).
 

daviden

Active member
#18
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. :)