XCache and/or APC: what's the best free to used memory ratio

I’ve used xcache and APC. This question isn’t about which is better.

I’m wondering if there’s an optimum ratio of free to used memory. For instance, let’s say I set the total memory available to 160MB, but XCache ends up using 155MB with 5MB free. Is this good, bad or neither? Should I make available enough memory so there will always be a healthy buffer of free memory? And if so, is there a free to used ratio I should hit, or an absolute number of free MB I should always try to make sure is available?

Thanks.

I would say that if the cache is constantly around 99% saturated you could do with increasing it, if it’s constantly below say 70% you could do with decreasing it. Otherwise just leave it as is. Having more free space doesn’t make cache faster, it just means it’s hogging RAM for no reason whatsoever. RAM that could possibly be better spent on other processes.

Hi ScallioXTX,

Thanks for your advice. I was at 160MB, and the available memory stayed around 15MB for weeks, then it steadily crept towards 4MB available memory in the past few days. I’ve never actually zeroed out wit OOM (out of memory) errors, but it’s gotten awfully close. I was curious if there’s a threshold where xcache becomes less effective the closer it is towards running out of memory.

It only becomes less effective when it’s completely ran out of memory, because then you might get the situation where every new entry causes and old entry to be removed, and if there are enough new entries inserted and never re-requested the cache is only getting MISSes, no HITs.
Sounds to me though like your 160MB is fine, I wouldn’t touch that setting. Not for now at least.

Thanks ScallioXTX. That really clears things up.