[TYPO3-dev] cache framework - exception in apc backend when no space is left
Christian Kuhn
lolli at schwarzbu.ch
Thu Nov 4 21:43:20 CET 2010
Hey.
On 11/02/2010 01:23 PM, Steffen Gebert wrote:
> On 02.11.10 13:06, Dominique Feyer wrote:
>> I think using opcode cache to cache user data is not a good idea, switch
>> to memcache or an other dedicated caching system for user data.
>
> Isn't it a feature of APC, being not *only* an opcode cache, but also a
> persistent store (persistent between requests)?
>
> I wonder why this code doesn't throw an exception:
>> $success = apc_store($this->identifierPrefix . $entryIdentifier,
>> $data, $expiration);
>> if ($success === TRUE) {
>> $this->removeIdentifierFromAllTags($entryIdentifier);
>> $this->addIdentifierToTags($entryIdentifier, $tags);
>> } else {
>> throw new t3lib_cache_Exception(
>> 'Could not set value.',
>> 1232986877
>> );
>> }
> Isn't this the piece of code, which you described?
> Christan "the cache" Kuhn, what do you think? Reading the code, I really
> wonder why no exception is thrown.
I didn't take a deep look to the apc backend yet (it's code is pretty
much identical to the memcache implementation) and didn't stumble upon
this exception issue.
Main apc characteristics I've observed:
- It's very fast (completely memory driven, no network overhead)
- Not suitable for big data and tons of entries (maybe some megs, but
not much more) -> unusable for cache_pages and friends.
- I have seen major memory leaks in apc even with tiny test cases on
debian lenny (using enetcacheanalytics). I'm unsure if this is solved in
newer versions. After this experience I dropped the idea to use it in
production.
BTW: I know we are still lacking real documentation for the caching
framework (it will come, I promise). For a quick start, I've once posted
a longer article here in the dev list to compare the different backends.
To make it short: For real life usage the db backend is usually the best
choice in most cases, together with the compress option in 4.5 it's
suitable even for "bigger" cache data. Use the new garbage collection
task in 4.5 (or its 4.3 / 4.4 version from ext: enetcache) when using
the db backend. Remember that the memcache implementation has a problem
when it does evictions, or if a cluster member fails.
Regards
Christian
More information about the TYPO3-dev
mailing list