OpenCraft
Follow OC!
  • Home
  • About
  • Solutions
  • Portfolio
  • Clients
  • Blog
  • Contact

Drupal performance optimization part 1

Mon, 2009-07-13 12:04
Tags:
  • debian
  • drupal
  • linux
  • php
By: 
Islam Amer

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

  • iamer's blog

Comments

by sivaji (not verified) | Mon, 2009-07-13 15:36

eaccelerator

what about eaccelerator[1] ? Most of the drupal performance optimization tutorials seems to be missing this.

http://eaccelerator.net/

by dalin (not verified) | Mon, 2009-07-13 20:48

eaccelerator == APC YMMV, but

eaccelerator == APC

YMMV, but they are functionally equivalent and offer comparable performance gains.

by iamer | Mon, 2009-07-13 21:42

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

by eMPee584 (not verified) | Thu, 2009-08-06 13:28

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 = off
might fix it but then i decided to try this APC bug workaround and it indeed did fix the problem so cheers ;)

by iamer | Wed, 2009-08-19 10:54

great!

glad I could help :)

Our work

African Network for Localisation

Building a community driven drupal site to support the African...

PricewaterhouseCoopers

PricewaterhouseCoopers needed a dynamic Web portal to manage the...

View our complete portfolio

Related posts

  • Nagios SMS notifications
  • Beware PHP $_REQUEST!
  • Diwan launches its website and online bookstore
  • AdHack: People-Powered DIY Advertising Marketplace and Community
  • Reverse-translating a string back into English in Drupal

More posts by this author

  • Nagios SMS notifications

OpenCraft

  • About
  • Team
  • Process
  • Community
  • Media Kit
  • Portfolio
  • Clients
  • Industries
    • Social economic development
    • Multimedia culture
  • Services
    • Drupal development
    • Information architecture
    • Open source software development
    • Social network engineering
  • Request quote
  • Contact
  • Search
Blog

Our profiles at:

Drupal Google
rss

Creative Commons License
search