Page 1 of 1

Very Slow processing on 1and1 managed server 16 core

Posted: 2013-03-20T17:41:01-07:00
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

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

Posted: 2013-03-20T18:29:57-07:00
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.

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

Posted: 2013-03-20T18:35:23-07:00
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.

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

Posted: 2013-03-20T18:46:07-07:00
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

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

Posted: 2013-03-20T18:49:05-07:00
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