1

I have a single VPS running a number of independent Drupal sites. What considerations do I need to make (if any) when installing APC?

3
  • What are you using APC for? Some usages have no impact, others can have very large ones. Feb 16, 2012 at 6:12
  • i have just read that apc can increase drupal performance. and at the hit that drupal takes on a server, anything can be good at this point. Feb 16, 2012 at 7:02
  • i know this is a pretty general statement, but I am not a sysadmin and need to remedy the sluggishness of my drupal sites. Feb 16, 2012 at 7:09

3 Answers 3

2

One thing to keep in mind is that APC will require quite a bit of memory if you have multiple sites because each file will be kept in memory, even if it is in fact exactly the same file, just with a different path.

So you need to watch and tune the amount of memory that apc uses/can use. By default, it's 32MB, that's often too less for even a single Drupal site if you have many contrib modules. The problem is that if APC has not enough memory, it will always have to delete files from the cache. If it has much to less (e.g. not even enough for all files in a single page request), it will make your site slower than if you hadn't used APC at all.

VPS often don't have a lot of memory, make sure that you have enough for your sites. You could consider merging them into multi-sites to save memory.

0
1

The implications are a much faster website! Check out this article, and others, by 2bits.com

http://2bits.com/articles/benchmarking-apc-vs-eaccelerator-using-drupal.html

Here is another that talks specifically about tuning APC for drupal sites

http://2bits.com/articles/high-php-execution-times-drupal-and-tuning-apc-includeonce-performance.html

My company runs several sites on a single VPS with APC configured as suggested in the above articles. That, with memcache, significanly speeds up our sites.

We have not witnessed any server issues or conflicts or had any security concerns, if that's more what you are asking.

4
  • any suggestions on configuring drupal and apc to run in a multiple site environment (i.e. non multisite environment)? or is it just enable and go?!!! Feb 16, 2012 at 7:06
  • Just enable and go! APC is simply a caching mechanism to speed things up a bit. If APC finds that a script has already been executed, it will used the cached version. This happens at the Apache layer. It does not matter where the PHP originated (what site I mean), so you should not have conflicts, regardless of the number of sites you may have. Use that 2nd article as a guide - You should not have any problems. ahem. try this on a testing server first, make backups, etc. Also remember to enable the PHP extension and restart apache.
    – blue928
    Feb 16, 2012 at 8:07
  • Enable and go? The second article you link to describes some serious tweaking of APC before they found the sweet spot. The default performance was actually worse than without APC. Apr 4, 2013 at 4:45
  • You can start with apc.shm_size and apc_stat. You can read up on those here. php.net/manual/en/apc.configuration.php For most of our sites on a shared ubuntu vps, those are really the only 2 we have to worry about. I have found that shm_size really needs to be set to about 300M for a drupal 7 site. After installing, pear will unpack 'apc.php.' You can copy that file into your root directory and monitor performance. This will help you find that sweet spot. Ex: goniseko.com/apc.php
    – blue928
    Apr 4, 2013 at 7:01
1

APC as a general opcode cache is entirely safe, and will greatly help the performance of your sites. However, there is one potential problem. You can't use Drupal modules like http://drupal.org/project/apc in most shared server APC environments as it's a big security risk. The APC cache is generally shared between all sites running on the server without a lot of thought going into separating them. If you are not a sysadmin, I would steer well clear of these modules.

That said, just installing APC for the opcode cache will generally increase the performance of your sites by quite a bit, so it's definitely worth using. Just be aware of some of the issues with the other functionality provided by APC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.