Very Slow processing on 1and1 managed server 16 core

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
aaroncalvo
Posts: 3
Joined: 2013-03-20T11:35:16-07:00
Authentication code: 6789

Very Slow processing on 1and1 managed server 16 core

Post by aaroncalvo »

Hi all, and thank you in advance for all your help / imput

I used to blame my server but after upgrading to a pretty decent setup I am at a loss as to why this script would take so long.

A breif understanding of the process.
this link http://www.arttoframes.com/products/let ... /large.jpg produces a frame with 6 openings. on its own it takes 2-3 seconds to process.
this link http://www.arttoframes.com/product_imag ... _filter=bw takes an image from a db and adds a logo on top of it
adding in numbers where the dashes are on the first link will add in images from the second link http://www.arttoframes.com/products/let ... /large.jpg
The issue is that as you can see it takes quite a long time to create this image.

---- ----- ------ -------- -----------

The basic code creating this is
$photo = $file;
$size = getimagesize($photo);
$size = ( $size[0] * 0.9 );
$logo="logo.png";
$cmd = "convert ".$logo." -scale ".$size ." -fill Gray50 -colorize 90 miff:- |\
composite -compose bumpmap -gravity center \
- ".$photo." ".$color_main_image." JPG:-";

---- ----- ------ -------- -----------

This is what came pre-installed on the server
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
(uiserver):xxxxxxx:~ > convert -version
Version: ImageMagick 6.6.0-4 2012-05-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

---- ----- ------ -------- -----------

Processor AMD Opteron™ 4274 Speed 2 x 8 Cores x 2.5 GHz
(3.5 Turbo Core) RAM 32 GB DDR3 ECC Hard-disk space 3,000 GB
(3 x 1,500 SATA) RAID Hardware RAID 5
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Very Slow processing on 1and1 managed server 16 core

Post by magick »

Add '-limit thread 1' to your convert command line, right after 'convert'. If that improves the speed, increase the value to 2 then 4 then 8. See which has the best performance.
aaroncalvo
Posts: 3
Joined: 2013-03-20T11:35:16-07:00
Authentication code: 6789

Re: Very Slow processing on 1and1 managed server 16 core

Post by aaroncalvo »

Thanks for the quick reply.. testing now.

----

my new code looks like this
$cmd = "convert -limit thread 8 ".$logo." -scale ".$size ." -fill Gray50 -colorize 90 miff:- |\
composite -compose bumpmap -gravity center \

the processing time accross the board is 17 - 18 sec. really no difference.

any other ideas.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Very Slow processing on 1and1 managed server 16 core

Post by fmw42 »

You have a very old version of IM. It would not hurt and may help speed things up to upgrade IM if you can.
$cmd = "convert ".$logo." -scale ".$size ." -fill Gray50 -colorize 90 miff:- |\
composite -compose bumpmap -gravity center \
- ".$photo." ".$color_main_image." JPG:-";

This can be made into one line using convert to do the composite as well, if you use parenthesis processing

See
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/basics/#parenthesis
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Very Slow processing on 1and1 managed server 16 core

Post by anthony »

Also avoiding the use of a 'colorname' can improve performance as it then does not need to 'look it up' from config files.


The load of configs is done once but on demand.

See more speed improvements in IM Examples..
Making IM Faster (in general)
http://www.imagemagick.org/Usage/api/#speed
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply