Apache and APC, whats good configuration with Drupal?

Events happening in the community are now at Drupal community events on www.drupal.org.
Strutsagget's picture

Hi!

I'm interested in how you guys set up your Drupal servers?
We are up till now been using Apache Worker with fast CGI and adding APC. But we think we have found out that fast CGI uses different APC memory for every user, and that kind of removes some of the benefits with cacheing same data for multiple users.

What do you people use to get good performance of your Drupal sites with dynamic data (geoblocking, mobile device checking and so on) when stuff like varnish cant be used?

Comments

If you use PHP-FPM (instead

davidseth's picture

If you use PHP-FPM (instead of Fast CGI) only one instance of APC is required. This means way more memory for your server.

Cheers,

David

thx

Strutsagget's picture

Hi, thx alot, will start looking into FPM on our servers.

//
Niklas Nilsson, PiJa Media & Management AB
Apputvecklare, iPhone, Android och HTML5 - PiJa din apputvecklare!

APC is a great idea

adammalone's picture

APC is a great idea regardless of CGI or FPM (although FPM is indeed more economical with memory). APC is a very passive addition to a webserver and shouldn't require a whole deal of attention subsequent to first set up, ie do not bother with APC module. I should also clarify that CGI uses a different cache per proc rather than per user so you'll still see benefit.

My tips for APC are:
- Grab a copy of apc.php (usually in /lib/share/docs somewhere [find /lib -name apc.php* should do the trick]) and place it in your docroot.
- Ensure you're not running out of APC memory or it'll be LESS efficient than not using it at all (due to cache dumps)
- Try to keep fragmentation low (spare memory helps lower fragmentation)
- If you're running out of server memory, turn down the ttl as this will save memory. If you have a lot of memory available, turn it up to increase cache times.

PROTIPS
Here's an excerpt from my server's apc.ini
apc.enabled=1
apc.shm_size=128M
apc.mmap_file_mask=/apc.shm.XXXXXX
apc.max_file_size=8M
apc.ttl=604800
apc.stat=1

Alter apc.stat to 0 if you want even fast APC responses, although since it WILL NOT check any files before executing, any changes you make in the code WILL NOT show on the site as the compiled code is stored in APC and effectively executed from there.
A manual flush is required to clear objects in APC if apc.stat is 0

Thx

Strutsagget's picture

Hi, again thx for your feedback. So you don't recommend adding bootstrap and drupal cache tables to APC instead (like the APC module does)?

Regarding FPM what Im a little intresserad in is if i add a html table with lots of information(string) into APC memory will it be possible for different users of my site to share this memory with FPM or will it be like with CGI different for every person and no real benefit if i have to construct/parse it for every user anyway?

//
Niklas Nilsson, PiJa Media & Management AB
Apputvecklare, iPhone, Android och HTML5 - PiJa din apputvecklare!