0

I have just installed APC on a Centos 6 server - PHP 5.3.3 First time for me working with APC.

Fetch and Store works as it seems it is supposed to.

 if (!apc_exists('companies')){
 echo 'Creating apc';     
 $companies = 'data';
 apc_store('companies', $companies,180);
 }
 else
 {
 echo 'Got apc';
 $companies = (apc_fetch('companies'));
 apc_store('companies', $companies,180);
 }

1st page load.. works great.. creating apc

2nd page load (+2 seconds from previous).. works great.. got apc

3rd page load (+5 seconds from previous).. works great.. got apc

4th page load (+20 seconds from previous).. restarting to -> creating apc

This is the APC config

 APC Support    enabled
 Version    3.1.13
 APC Debugging  Disabled
 MMAP Support   Enabled
 MMAP File Mask     no value
 Locking type   pthread read/write Locks
 Serialization Support  php
 Revision   $Revision: 327136 $
 Build Date     Feb 11 2014 20:05:11

 Directive  Local Value Master Value
 apc.cache_by_default   On  On
 apc.canonicalize   On  On
 apc.coredump_unmap Off Off
 apc.enable_cli Off Off
 apc.enabled    On  On
 apc.file_md5   Off Off
 apc.file_update_protection 2   2
 apc.filters    no value    no value
 apc.gc_ttl 3600    3600
 apc.include_once_override  Off Off
 apc.lazy_classes   Off Off
 apc.lazy_functions Off Off
 apc.max_file_size  1M  1M
 apc.mmap_file_mask no value    no value
 apc.num_files_hint 1000    1000
 apc.preload_path   no value    no value
 apc.report_autofilter  Off Off
 apc.rfc1867    Off Off
 apc.rfc1867_freq   0   0
 apc.rfc1867_name   APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
 apc.rfc1867_prefix upload_ upload_
 apc.rfc1867_ttl    3600    3600
 apc.serializer default default
 apc.shm_segments   1   1
 apc.shm_size   32M 32M
 apc.slam_defense   On  On
 apc.stat   On  On
 apc.stat_ctime Off Off
 apc.ttl    300 300
 apc.use_request_time   On  On
 apc.user_entries_hint  4096    4096
 apc.user_ttl   300 300
 apc.write_lock On  On
Niels
  • 635
  • 3
  • 9
  • 23
  • Do you monitor your cache? Is it perhaps full & pruning the oldest ones? `32M` is not a whole lot. – Wrikken Feb 11 '14 at 23:46
  • Nevermind, user_ttl=300 I see now. How are you running php in apache: as a module, as fastcgi, or perhaps fpm? – Wrikken Feb 11 '14 at 23:54
  • I don't. How do i view this ? – Niels Feb 11 '14 at 23:54
  • Plesk Panel Settings says "as fastcgi" – Niels Feb 11 '14 at 23:55
  • [That explains it](http://stackoverflow.com/questions/598444/how-to-share-apc-cache-between-several-php-processes-when-running-under-fastcgi) – Wrikken Feb 11 '14 at 23:56
  • It seems you know a great deal about this.. What if I just changed for module or fpm ? – Niels Feb 12 '14 at 00:02
  • `fpm` can pretty much do it, but has a few obscure bugs (you're unlikely to hit them), if you run it as a module, you just have shared memory, _but_: running as a proper user can become a problem on shared hosting. If that's not an issue, going for the module seems fine. – Wrikken Feb 12 '14 at 08:12

0 Answers0