Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does PHP APC as local object store have any limits besides storage size?

Tags:

php

apc

I'm using PHP APC on production servers of a web service with 10M's hits/day successfuly for a long time.

I'm considering offloading much more data to the APC local cache.

Theoretically it looks to me that since APC call is mainly a local memory access. It should not become an issue to call it 10,000s of times/sec. As far as I can tell its limits can be in the memory size but as long as the server has free CPU it should not have performance or corruption issues at high rates.

Is there any limit I'm not aware of that might prevent me from using APC's local object cache in very high rate on app server (ubuntu).

Update: Apparently according to the answers below my question wasn't clear. I'm not looking for alternaive caching options (memcache,redis etc..). My question is whether there is any concern or limit in using local APC in very high rates and read concurrency.

like image 221
Nir Avatar asked Oct 09 '22 00:10

Nir


1 Answers

I'm personally a big fan of using memcached for this kind of storage. It has several advantages:

  • It's a program that focuses entirely on the storage, and development of memcached will always focus on that. APC is primarily a cache for code, which just happens to offer some access to user storage.
  • When you reload or restart Apache (or whatever webserver you use), APC's cache gets emptied. When you use a standalone solution such as memcached, you can control when the cache gets emptied. This is really something that was very important in my case, as I sometimes have to make changes to Apache's configuration and really don't want to clear the cache when I do, as it creates a large CPU spike (loading data into the cache again).
  • It has the possibility to create a distributed cache, making it more scalable. When you have to add a second server because your website becomes large, you don't want two caches which cache the same stuff. memcached scales well, while APC's cache doesn't.

There are many other advantages of using memcached over APC's user cache, but for me these were the primary three reasons to not use APC's user cache. I do use APC, of course, just not the user cache.

like image 123
Tom van der Woerdt Avatar answered Oct 12 '22 10:10

Tom van der Woerdt