Recently, we have a need for optimizing the performance of our drupal deployments, beyond the conventional mysql and apache optimization.
The first and easiest thing is to install a PHP Opcode Cache, and after some investigation I decided to try APC. Installing the version in PECL worked well on the staging environment.
pecl install apc
echo "extension = apc.so" > /etc/php5/apache2/conf.d/apc.ini
/etc/init.d/apache2 reload
On the live server it died with an out of memory error, although memory limits were set higher than the staging environment. To fix this I installed the version in apt and enabled a workaround in the suhosin patch configuration.
pecl uninstall apc
apt-get install php-apc
echo "suhosin.apc_bug_workaround = on" >> /etc/php5/apache2/conf.d/suhosin.ini
/etc/init.d/apache2 reload



Comments
eaccelerator
what about eaccelerator[1] ? Most of the drupal performance optimization tutorials seems to be missing this.
http://eaccelerator.net/
eaccelerator == APC YMMV, but
eaccelerator == APC
YMMV, but they are functionally equivalent and offer comparable performance gains.
stability
After researching, it seems that eaccelerator and xcache are considered less stable than APC. There are reports that they cause segfaults and crashes in apache, thus you need to run a logwatcher to restart apache.
APC is the most actively developed of them , and is maintained by the core PHP developers.
Sources : 2bits.com
this is the fix-!
i was getting improper behaviour (empty/incomplete pages) from phpmyadmin since a while (since php 5.2.10-1? since activation of APC?) and just looked at the logs:
[Thu Aug 06 12:56:56 2009] [notice] child pid 17561 exit signal Segmentation fault (11)
[Thu Aug 06 12:56:59 2009] [notice] child pid 19430 exit signal Segmentation fault (11)
[Thu Aug 06 12:56:59 2009] [notice] child pid 19449 exit signal Segmentation fault (11)
[Thu Aug 06 12:57:01 2009] [error] [client 137.226.149.42] ALERT - canary mismatch on efree() - heap overflow detected (attacker '137.226.149.42', file '/usr/share/phpmyadmin/libraries/session.inc.php', line 82), referer: https://hfopi.org/phpmyadmin/navigation.php?token=0209c61529a420d5c0e76c...
[Thu Aug 06 12:57:03 2009] [notice] child pid 19464 exit signal Segmentation fault (11)
[Thu Aug 06 12:57:03 2009] [notice] child pid 19465 exit signal Segmentation fault (11)
[Thu Aug 06 13:06:36 2009] [error] [client 137.226.149.42] ALERT - canary mismatch on efree() - heap overflow detected (attacker '137.226.149.42', file '/var/www/drupal-hfopi/includes/bootstrap.inc', line 1050)
and more of silly stuff like this.. first i thought
suhosin.session.encrypt = offmight fix it but then i decided to try this APC bug workaround and it indeed did fix the problem so cheers ;)
great!
glad I could help :)