ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Very Very Slow Page Loading

March 20, 2011 5:26am

Subscribe [4]
  • #1 / Mar 20, 2011 5:26am

    vicos

    22 posts

    EE v2.1.3
    New Install on a Fast, low load server
    Headlines Theme from WooThemes

    Right Now I am timing the front page at at least 8 seconds, secondary pages at 4 seconds—which makes it pretty unusable.

    I have a vBulletin site running on this server and it is lightning fast.

    I am using all kinds of browsers.  Disabled Javascript in Chrome and it loaded a little faster, but not much.

    Any ideas what the problem may be?

  • #2 / Mar 21, 2011 9:18am

    Sue Crocker

    26054 posts

    Hi, vicos.

    It loaded fairly fast for me.. but I did notice you’re pulling in code from Flickr, which may be part of what’s bogging you down.

    Can you create a template without the flickr code in it? Does that speed things up?

    In your exp:channel:entries loops, are you taking advantage of the disable parameter?

  • #3 / Mar 21, 2011 6:11pm

    vicos

    22 posts

    “It loaded fairly fast for me.”

    Hmmm,  I just timed the main page at 11 seconds and pingdom says 16 seconds.

    I’ll disable Flickr—was going to get rid of it anyway.

  • #4 / Mar 21, 2011 6:29pm

    vicos

    22 posts

    Removing Flickr had no visible positive effect.  When I reload the page, it takes 8-10 seconds for the page just to clear—which tells me the problem is in the EE engine on the server.

    This problems seem to have started Sunday when i added more articles and renamed the “blog” template group to “ezine” (now changed back).  I also cloned the comments template and called it articles and updated the URL in the “blog” Channel.

    What could have been affected in EE by these changes to cause this?

    BTW, I save the HTML to a local file and then loaded it one four diff browser.  It renders very fast, which tells me it is not a problem with the HTML or JS.

    Also, when I View Source using Google Chrome, there is a many second wait until the source appears, telling me the delay is at the server side.

  • #5 / Mar 21, 2011 8:25pm

    vicos

    22 posts

    Loading Time: Base Classes     0.0111
    Controller Execution Time ( Ee / Index )    8.3365
    Total Execution Time     8.3478

    I guess this proves the problem is in the engine? I assume that is 8.3478 seconds?

  • #6 / Mar 21, 2011 8:31pm

    Mark Huot

    587 posts

    Vicos, I took a look as well and the load time for me was under 2 seconds on repeated reloads. However, when looking at slow sites I typically investigate the database first. Can you enable the profiler again and check the SQL query log? Are any queries taking over a second?

  • #7 / Mar 21, 2011 8:44pm

    vicos

    22 posts

    I’ve had several people try it and it is slow for all.  With the “EE Total Execution Time = 8.3478”, not sure why your experience is different.  pingdom is still reporting 18 seconds.  The actual articles are running about half the time as the main page.

    The SQL execution times are all very low (ALL 0.000x).  I have repaired and optimized all tables.

    I am seeing quite a few occurrences of the following in the log files (Level=3)

    DEBUG - 2011-03-21 19:36:33—> Api_channel_fields class already loaded. Second attempt ignored.
    DEBUG - 2011-03-21 19:36:33—> Api class already loaded. Second attempt ignored.

    Also, remember that this problem appeared rather all-of-a-sudddenish.

  • #8 / Mar 21, 2011 9:44pm

    vicos

    22 posts

    Looks like most of the time is being consumed with this kind of stuff:

    (6.771885)    Calling Class/Method: Teemthumb/size
    (6.771998)    -> Class Called: Teemthumb
    (6.772015)    -> Method Called: size
    (6.978538)    -> Data Returned

    It appears many times in the debug and you can see how much time is executed with just one instance.

  • #9 / Mar 21, 2011 9:49pm

    Cheif

    626 posts

    Try using a plain template (ie. by pass the theme) TeemThumb is listed as an issue on Woothemes support (no login to view issue)
    May or may not be an issue but worth investigating.

  • #10 / Mar 21, 2011 9:53pm

    Mark Huot

    587 posts

    My quick guess is that teem thumb isn’t caching the resized images properly. Can you check that there is a cache directory being created with your resized images in it? If PHP has to resize every image on each load that will certainly slow things down. It doesn’t appear that teem thumb is using the EE cache folder (inside system/), so also check for a cache directory next to your index.php file.

  • #11 / Mar 21, 2011 10:15pm

    vicos

    22 posts

    Yes the cache directory is /cache. I had to create it when I install the WooThemes.

    That is exactly what is happening, it is creating a new thumbnail image for each image on the page every time the page loads.  I can see the new time stamps on the files.

    Aye carumba, no wonder it was so slow.

    TeemThumb by Bjorn Borresen. Based on TimThumb script created by Tim McDaniels and Darren Hoyt with tweaks by Ben Gillbanks (http://code.google.com/p/timthumb/).

    Now I wonder of that Bjorn is the same Bjorn who is the developer in the WooThemes forums.  There is a thread over there and the guy has the same problem.  that Bjorn says:

    “Teemthumb should only do it’s work the first time, so it shouldn’t really be slow (it will just use the cache if it exists on the next calls).

    “You can have a look at the various caching capabilities of EE here: http://bit.ly/baO8Ay

    “I would most likely use cache on the header embed .. so it doesn’t have to go through that each time.”

    BUT, I don’t see how EE caching would effect teemThumb caching.  Looks like I need to dig thru the teem thumb PHP code.  This is why I really do not like to buy third-party addons.

    I believe the reason this started Sunday was because I had uploaded many very large JPG files.  Since they are larger, it is likely talking longer to create thumbnails that it did before.

  • #12 / Mar 21, 2011 11:34pm

    Mark Huot

    587 posts

    Looks like you figured it out. I’d also recommend looking at image resizing alternatives:

    * http://devot-ee.com/search/results/search&keywords=Image resize&channel=addons/

    Of those, I’ve had good luck with ce image and imagesizer.

  • #13 / Mar 22, 2011 12:16am

    vicos

    22 posts

    I looked at the PHP code and it makes no attempt to see if a cache file exists before creating a new one.  I am rewriting the code now.  If I can’t make the cache work properly, I’ll look at your alternative suggestions.  this is my first EE task, so I don’t know my way around very well. thanks for the help everyone 😊

  • #14 / Mar 22, 2011 1:24pm

    Lisa Wess

    20502 posts

    Awesome troubleshooting guys, Mark thank you so much for stepping in and helping!

    vicos - I highly recommend reporting this to the WooThemes team; I’m sure that they’d love to know so they can fix this up as well.

    I’m going to move this down to the CodeShare corner for now as well.

    Thanks again all!

  • #15 / Mar 22, 2011 1:55pm

    vicos

    22 posts

    Apparently teemThumb is an adaption of TimThumb for EE (He stuck a wrapper around it so it would function as an EE plugin.)

    Here’s how to fix the code.

    pi.teemthumb.php in your system/expressionengine/third_party/teemthumb/

    Search for the following line (before line 100):

    $this->_check_cache( $cache_dir, $mime_type );

    comment that line out and add these new lines:

    // check to see if this image is in the cache already
    // $this->_check_cache( $cache_dir, $mime_type );
    // DSN: Let's just put the code right here since it is only called once.
    
    $cache_file_name = $cache_dir . '/' . $this->_get_cache_file($src, $new_width, $new_height, $quality);
    
    if ( file_exists($cache_file_name) )
    {
        // The cache file exists, so just return some data to EE and exit
        $tagdata        = $this->EE->TMPL->tagdata;            
        $cache_file_url = $this->EE->config->item('site_url').str_replace("./", "", $cache_file_name);
        $tagdata        = $this->EE->TMPL->swap_var_single('sized', $cache_file_url, $tagdata);
        $tagdata        = $this->EE->TMPL->swap_var_single('w', $new_width, $tagdata);
        $tagdata        = $this->EE->TMPL->swap_var_single('h', $new_height, $tagdata);
    
        // Hopefully this will exit right here and return to EE w/o doing anymore
        return $tagdata;
    }

    All function _check_cache does is see if the cache directory exists, and if not, creates it and sets it to 777.  This probably won’t work on a lot of systems anyway if PHP runs as nobody.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases