1

I'm working to optimize APCu configuration on a set of busy servers. Last week we encountered a problem with APC, with these errors in our PHP logs

apc_add(): GC cache entry '....:' was on gc-list for 3601 seconds' of severity 2 in /.../index.php on line 55

I found this related SO thread, which has me considering setting our gc_ttl = 0. Currently the value is gc_ttl = 3600.

My guess is we have keys in the cache that are stale, but not getting entirely removed and thus available for reallocation by apc_store calls. I'm unsure how to determine if this assumption is true though, any ideas? Will setting gc_ttl = 0 help to free slots for reallocation?

I find the graph of our memory usage interesting.

APCu Memory Usage

Below the pie graph it reads

Free: 264.9 MBytes (66.2%)

However the green section of the pie chart indicates only 161.4 MBytes is available.

Our current apcu configuration

; Enable apcu extension module

extension=apcu.so
apc.enable_cli=1
apc.enabled=1
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.shm_size=400M
apc.ttl=7200
apc.entries_hint=28000
Community
  • 1
  • 1
quickshiftin
  • 66,362
  • 10
  • 68
  • 89

1 Answers1

2

It means that outdated value is still referenced and this message was changed from warning to debug long time ago https://github.com/krakjoe/apcu/pull/45/files with this PR https://github.com/krakjoe/apcu/pull/45.

Which means you must be on old APC version and it is better to upgrade. Anyway, it seems you can just ignore these warnings.

Ihor Burlachenko
  • 4,689
  • 1
  • 26
  • 25
  • Thanks, this is helpful. Any idea where the discrepancy between the reported free memory and the free memory in the pie chart might be coming from? Seems like the gc feature is nice to have (my guess is our code depends on it). It feels like old values aren't actually becoming available for reallocation, but I have no idea how to determine if this is the case. – quickshiftin Jan 11 '16 at 16:11
  • I double checked APC documentation and deleted last part of my comment because it can't be the case. TTL counts only for idle entries. So it is better to ask APC developers how it is possible. Hard to say about diff numbers in the APC admin, try to lower gc_ttl and see what happens. I suspect the admin wasn't updated to support new changes in APC. – Ihor Burlachenko Jan 11 '16 at 16:29
  • Thanks, upvote from me. I've asked on pecl-dev where the discrepancy in the admin report might be coming from. – quickshiftin Jan 11 '16 at 18:05
  • Great, let me know what they say. – Ihor Burlachenko Jan 11 '16 at 18:30