Forums / Developer / ezimage.tpl takes atleast 8 seconds to load making site slow

ezimage.tpl takes atleast 8 seconds to load making site slow

Author Message

Romeo Antony

Saturday 06 August 2011 7:50:54 am

Hi,

        Any help will be really appreciable in finding out the following issues with my ezp 4.4 installation. attribute view gui template of image datatype, (design/standard/templates/content/datatype/view/ezimage.tpl)takes at least 8 seconds to load. A webpage with 10 images at least take 1 minute to load. THis what the showing in timing points and in output time accumulators within the debug.

I am using ez 4.4

File permissions are correct to var dir. I can't figure it out why this is happening. timing point take 10 seconds to load datatype/view/ezimage.tpl. All other template codes loads as usuall without any time delay as expected.

 

I am using shared hosting plan. Even in default ezpulish installation did by my hosting provider also having the issue. Is this is related with less memmmory available for my ez installtion from hosting provider?

Thanks in advance.

Romeo Antony

Saturday 06 August 2011 11:14:58 am

Reply from my hosting provider as follows

 

"issue is caused by the conversion module of the application. Once you try to load an image the following scripts are executing on the server :
 
 749613 alnahdha 21 0 208m 7952 1716 R 100.0 0.0 0:02.90 /usr/bin/convert var/ezflow_site/storage/images/events/ez-awa
 749606 alnahdha 16 0 258m 34m 9104 S 0.0 0.1 0:00.19 lsphp5:/home/alnahdha/public_html/index.php
 
 Note that the convert process is using 100 % of the CPU on the server. I would kindly advice you to check with the developers of the script for the issue as they might be able to give you a solution. Another solution that we may offer you is to upgrade your account to one of our dedicated servers or VPS so you will be able to use all of the server resources just for your site."

 

I will be thankfull for any help

Daniel A. Øien

Sunday 07 August 2011 9:52:48 am

On many hosted and some multiprocessor VPS systems there is a problem with ImageMagick's OpenMP implementation, and eZ Publish by default uses ImageMagick for image processing.

The solution is usually to install ImageMagick from source with the --disable-openmp directive, but you probably won't be able to do this in a shared hosting environment.

Throwing more hardware resources at the problem will not help. In your case I think the simplest solution is to switch to GD for image processing.

In your image.ini.append.php configuration file (either in override or in the relevant siteaccesses), set

[GD]
IsEnabled=true

[ImageMagick]
IsEnabled=false

and clear caches.

Daniel A. Øien
Open Concept SA, Norway
Web: http://openconcept.no/
In English: http://openconcept.no/eng

Greg McAvoy-Jensen

Sunday 07 August 2011 10:57:14 pm

Romeo,

You might check your template code for endless loops/endless template calls. I've seen a case where an endless loop involving ImageMagick ruined a server's day.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Romeo Antony

Monday 08 August 2011 1:38:39 am

Thanks Greg, Daniel for the help.

I have changed to GD from imagemagic as Daniel suggested (Bez of sharedhosting with some multiprocessor VPS systems there is a problem with ImageMagick's OpenMP implementation).

But this issue remains same.

And I double checked there is no endless loops and not even I have not customized any sample data from Installation .

From digging into further , my shared hosting plan not using following extensions with php

 

I have found that following php extensions is missing

1 Curl
2. Iconv
3. MBstring
4. reflection
5. spl

6. simplexml


http://ez.no/eZPublish/Requirements/eZ-Publish-4.4-Platform-requirements

 

Will this make sense? Missing this could have caused this issue. 

Steven E. Bailey

Monday 08 August 2011 1:58:14 am

Imagemagick going to 100% CPU can be caused by a variety of factors:

Is the machine underpowered for your site - does it have multiple CPUs allocated?

Do you have enough memory for your site?

Are the uploaded files huge?  like 2000x1000 and 10MB each?  Imagemagick takes a long time if the images are big.

Are your aliases really complicated, are there a lot of aliases, are they optimized - i.e. - do you scale them down and then use the scaled image as the reference before doing something else like adding rounded corners?

Is your caching right? Or, are you clearing your caches right?   Your image aliases should only be generated when an object is created or updated and someone visits a page that needs that image alias.  Meaning, if you have 100s of converts running at once then I think something went wrong with the caching.   Even ezcache.php --clear-all shouldn't clear your image aliases.  Actually, let me guess... you only clear the cache from the backend and then you clear all.

If that is the case then maybe you want to comment this section of kernel/classes/ezcache.php out on your production machine:

 /* Hack ARE IMAGE ALIASES CAUSING SLOWDOWN AFTER CLEAR ALL
                                array( 'name' => ezpI18n::tr( 'kernel/cache', 'Image alias' ),
                                       'id' => 'imagealias',
                                       'tag' => array( 'image' ),
                                       'path' => false,
                                       'enabled' => true,
                                       'function' => array( 'eZCache', 'clearImageAlias' ),
                                       'is-clustered' => true ),
*/

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Romeo Antony

Monday 08 August 2011 2:40:13 am

Every php extensions needed installed but image magic version is of ImageMagick 6.2.8

 

Might be this causing issues ?

Romeo Antony

Monday 08 August 2011 3:02:10 am

"Is the machine underpowered for your site - does it have multiple CPUs allocated"

 

There are  ezpublish sites already hosted in this server. And working perfect . That is what support teams says.   No idea about multiple CPU used or not

 

Are the uploaded files huge?  like 2000x1000 and 10MB each? Are the uploaded files huge?  like 2000x1000 and 10MB each?

I am only testing with sample data of ezflow package. No content objects created with image datatype.

 

.Caching everything perfect.

 

Usually  I test image loading time,  by clear the cache from the backend and then you clear all.

"If that is the case then maybe you want to comment this section of kernel/classes/ezcache.php out on your production machine: "

 <span style="color: #808080; font-style: italic;">/* Hack ARE IMAGE ALIASES CAUSING SLOWDOWN AFTER CLEAR ALL
                                array( 'name' => ezpI18n::tr( 'kernel/cache', 'Image alias' ),
                                       'id' => 'imagealias',
                                       'tag' => array( 'image' ),
                                       'path' => false,
                                       'enabled' => true,
                                       'function' => array( 'eZCache', 'clearImageAlias' ),
                                       'is-clustered' => true ),
*/</span>

by commenting out above array values, I can save uption 25% time in loading pages after clear all caches from admin.

That is what the results shows Steven.

But still some issues in image loading time . image magic version should be 6.4.x

shared hsoting using 6.2.8  .Will this be the issue?

Steven E. Bailey

Monday 08 August 2011 3:24:08 am

"

But still some issues in image loading time . image magic version should be 6.4.x

shared hsoting using 6.2.8  .Will this be the issue?

"

6.2.8 is ancient, but I think that will only matter when it comes to what parameters are available to you and not really the load.

Since the site is also slow with GD, I'm guessing it has little, if anything, to do with imagemagick.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Romeo Antony

Monday 08 August 2011 3:38:01 am

I am only using

Filters[]=geometry/scalewidth
Filters[]=geometry/crop

from image magic.  No advanced features.

So I think this will not be a matter whatver version of image magic .

 

Anyway thanks a lot for the help Steven

Daniel A. Øien

Monday 08 August 2011 4:28:52 am

Since both ImageMagick and GD choke, another possibility is a corrupt image file somewhere, or a permissions error.

Try installing a clean version of the latest eZ Publish, with the "plain site" option, and upload and display a few images to see if the same problem occurs. Set permissions for everything to 777. If there is no problem now, there might be something wrong with your image files or permissions.

Daniel A. Øien
Open Concept SA, Norway
Web: http://openconcept.no/
In English: http://openconcept.no/eng

Romeo Antony

Sunday 14 August 2011 4:07:42 am

Solved.  I was using imagemagic 6.2.8 , changed it into 6.4.x and the issues sorted

 

Regards

Romeo