Firebird News

Monday, October 03, 2011

Php Image Slow SMP Magick on #Ubuntu / #Debian

There is a known bug with Image Magick : it can be very slow when used with openmp enabled (by default in debian/ubuntu) on multicore systems (almost on all servers these days) It is eating a lot of cpu (50-100% for each core) instead of idling at 1-2% (for simple image manipulations) It was strange for me that one single core server was faster than a quad core in the same specs with the rest of the config (os ubuntu 10.04 lts, kernel latest, ioscheduler : deadline) Eliminating the problems on what could slow down the server (php version , image magick version , kernel version ) the only thing left was cpu Solution is very simple configure imagemagick without openmp
apt-get buil-dep imagemagick
apt-get source imagemagick
cd imagemagick-6.5.7.8/
sudo vi debian/rules
add ~ line 39 --disable-openmp (dont' forget to add \ to the privious line)
it should look like
       --x-libraries=/usr/lib/X11 \
        --disable-openmp
Rebuild the package and reinstall
dpkg-buildpackage -b
sudo apt-get remove --purge libmagickcore2
cd ..
dpkg -i libmagickcore2* libmagickwand2*
apt-get install php5-imagick
/etc/init.d/apache2 restart

No comments: