Performance problems

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
bigeagle
Posts: 3
Joined: 2011-11-09T03:38:40-07:00
Authentication code: 8675308

Performance problems

Post by bigeagle »

Last week I've introduced Imagemagic in our CMS to reduce the images. Works pretty good and the images have a higher quality then reducing images with PHP GD and the're small too!

But one problem is the performance of ImageMagic. When I reduce for example 10 images after each other with ImageMagic (users have the possibilty to upload multiple images at once ) the load of my server is growning fast and I see 4 a 5 convert processes in linux TOP. Sometimes the load is growing to 8 and thats very high for a quad core machine, With PHP GD I had not that problem.

Some info:
Version: ImageMagick 6.7.3-2 2011-10-25 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

OS is CentOS and I use ImageMagic with PHP.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Performance problems

Post by magick »

Locate the policy.xml configuration file and set your thread limit to 2 (or 1):
  • <policy domain="resource" name="thread" value="2"/>
You can also reduce the memory, for example, set it to say 60MiB.
bigeagle
Posts: 3
Joined: 2011-11-09T03:38:40-07:00
Authentication code: 8675308

Re: Performance problems

Post by bigeagle »

Oké, thanks I will try that and monitor it.
bigeagle
Posts: 3
Joined: 2011-11-09T03:38:40-07:00
Authentication code: 8675308

Re: Performance problems

Post by bigeagle »

Oké, I've uncomment that line:

<policymap>
<!-- <policy domain="system" name="precision" value="6"/> -->
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<!-- <policy domain="resource" name="memory" value="2GiB"/> -->
<!-- <policy domain="resource" name="map" value="4GiB"/> -->
<!-- <policy domain="resource" name="area" value="1gb"/> -->
<!-- <policy domain="resource" name="disk" value="16eb"/> -->
<!-- <policy domain="resource" name="file" value="768"/> -->
<policy domain="resource" name="thread" value="1"/>
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
</policymap>

Must I reconfigure something or is it correct now?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Performance problems

Post by magick »

Verify with
  • convert -list resource
It should show threads as '1'.
Post Reply