Performance Problems with ImageMagick-6.2.6 and PHP

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
M3g4Star

Performance Problems with ImageMagick-6.2.6 and PHP

Post by M3g4Star »

Hey Guys.

I've got several questions to make my script more faster and stable.
I recognized that out Server got some load times over 1 so our CPU is very strained.

So I made some tests with my Script and I got some very difficult Problems.
I Startet my script which for example looks like that:

Code: Select all

 if(!file_exists($output_brief)){
  // Bild erstellen (Schule 2006)
    exec('convert '.$input.' -resize 25% '.$output_brief);
    exec('convert -size 100x137 xc:skyblue  '.$output_brief.' -geometry  +65+1 -composite '.$output_brief);
    exec('composite '.$over_brief.' '.$output_brief.' '.$output_brief);
    exec('montage '.$output_brief.' -shadow  -geometry +3+3 -resize 90 '.$output_brief);
    }
It's just one example cause there are some other Pictures which are generated.
Is this Code Correct ? Is there anything I could make better ?

Because if I run my PHP Script and I check via my CPU stats my CPU ist strained with about 50% ??? Is that normal ?

My Server is a Managed Server with Opteron 148 and 2 GB RAM.
Is there any possibility that ImageMagick caused a Server crash ? For Example if there are more People on my website ?

best regards Max
M3g4Star

Post by M3g4Star »

Hey Eddi .. Sorry for my late answer but I didn't recognize that the Server is moved to discourse-server :D
Eddie wrote:
Because if I run my PHP Script and I check via my CPU stats my CPU ist strained with about 50% ???

How do you do that? Is this a program you can call via SSH? Or is this possible with PHP?


if u for example login via SSH and putty u can type on a Linux System the command "top" so u can see some informations about your Server.

Ok .. I think i never would make such enormous transformations on my Web-Server. My Pics are about KB.
Perhaps is it better not to work with ImageMagick cause of those extraordinary charges. I thought I could personalize my Shop with ImageMagick but if ImageMagick cuases ServerCrashes I will set it off.

The Problem is that my System never calm down.
Sometime there are about 150 apache processes.

So far Max
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

We moved the URL of the discussion server because we were getting too many Bots spam-advertising on the site. So far the move has been effective. Chances are we will move it again in the future, but you can always find it by clicking on the Discourse Server link at the footer of http://www.imagemagick.org.
Post Reply