APC (Alternative PHP Cache) fragmentation. How much is too much?
I've installed APC with 64MB of memory. These are my current memory stats:
Free memory: 18.4 MBytes (28.7%)
Used memory: 45.6 MBytes (71.3%)
And fragmentation is:
Fragmentation: 8.49% (1.6 MBytes out of 18.4 MBytes in 134 fragments)
Is the fragmentation and free/used memory ratio good, bad, normal?
Surprisingly, I haven't been able to find any documentation or recommendations regarding any of the stats to give an idea of what constitutes good, bad, or average performance.
Also, for APC users, is there a recommendation about the need to reset the cache? Right now, the TTL (time to live) for old, cached files is 2 hours. Afterwards, old cached files are purged. This helps slightly with fragmentation and memory release, but perhaps it needs to be set to 1 hour?
Perhaps I need to flush the entire cache nightly by restarting the web server?
This is on RAM correct? Fragmentation is not a problem in RAM. It does not function like a mechanical HDD. So that issue you really don't need to worry about. There is no need to restart the server nightly. You need to configure the TTL for how long the data needs to remain, how long you need it to stay there and no longer. This setting is depended on your application needs.
BTW, are you experiencing performance issues, is that the reason for the inquiry?
Logic without the fatal effects.
All code snippets are licensed under WTFPL.
Correct, memory/RAM fragmentation. I'm wondering if 8.49% fragmentation is too high which would result in less optimal cache performance.
It's less optimal, but not seriously so. You're unlikely to notice any deterioration of performance at all in reading data... but fragmentation can be problematic if you're trying to store several large blocks of data in APC because you need contiguous blocks for storing.