Brideau
Brideau

Reputation: 4771

Diagnosing Slow Initial Load

How do you go about diagnosing a website that initially loads slowly? That is, it is unresponsive for up to 10 seconds, and then loads quickly after that.

You can see the loading chart here: http://www.webpagetest.org/result/130128_XV_GVN/3/details/

I know that "something" is slowing it down, but I can't tell what. Is there any way of knowing what is causing the delay?

EDIT: Here are the values from Joomla's debug mode:

Application 0.013 seconds (+0.013); 1.33 MB (+1.327) - afterLoad
Application 0.783 seconds (+0.770); 9.53 MB (+8.199) - afterInitialise
Application 0.952 seconds (+0.169); 11.00 MB (+1.473) - afterRoute
Application 1.164 seconds (+0.212); 12.76 MB (+1.758) - afterDispatch
Application 2.453 seconds (+1.289); 19.04 MB (+6.287) - beforeRenderModule mod_roknavmenu ()
Application 2.858 seconds (+0.405); 20.91 MB (+1.865) - afterRenderModule mod_roknavmenu ()
Application 2.977 seconds (+0.119); 20.98 MB (+0.075) - beforeRenderModule mod_login (Member Access)
Application 3.012 seconds (+0.035); 21.09 MB (+0.102) - afterRenderModule mod_login (Member Access)
Application 3.019 seconds (+0.008); 21.09 MB (-0.000) - beforeRenderModule mod_hot_joomla_carousel (Front Page Carousel)
Application 3.033 seconds (+0.014); 21.13 MB (+0.040) - afterRenderModule mod_hot_joomla_carousel (Front Page Carousel)
Application 3.057 seconds (+0.024); 21.12 MB (-0.010) - beforeRenderModule mod_rokgallery (FP RokGallery)
Application 3.793 seconds (+0.736); 29.68 MB (+8.570) - afterRenderModule mod_rokgallery (FP RokGallery)
Application 3.847 seconds (+0.053); 29.64 MB (-0.048) - afterRender

Upvotes: 0

Views: 8891

Answers (4)

dbspecialist
dbspecialist

Reputation: 13

Your issue sounds like a TTFB(time to First Byte) issue and is possibly directly related to heavy DB queries, slow host performance, heavy page rendering, that all lead to long response time from the server.

I agree to the comments above, first check the performance on a locally installed server (i use here WAMP server). You can also hack a bit into the joomla framework and enhance the functionality of the debugging by adding additional info from component and plugin rendering.

For debugging components, you need to edit the file libraries/joomla/application/component/helper.php and replace

$contents = self::executeComponent($path);

with

if (constant('JDEBUG')) {
JProfiler::getInstance('Application')->mark('beforeExecuteComponent ' . $option.' ('.$task.')');
}
$contents = self::executeComponent($path);
if (constant('JDEBUG')) {
JProfiler::getInstance('Application')->mark('afterExecuteComponent ' . $option.' ('.$task.')');
}

For plugins edit libraries/joomla/event/dispacher.php and replace

if (is_object($this->_observers[$key]))
{
$args['event'] = $event;
$value = $this->_observers[$key]->update($args);
}
// Fire the event for a function based observer.
elseif (is_array($this->_observers[$key]))
{
$value = call_user_func_array($this->_observers[$key]['handler'], $args);
}

with this:

if (constant('JDEBUG'))
{
$pluginName = '';
if (is_object($this->_observers[$key])) {
$pluginName = get_class($this->_observers[$key]);
}
JProfiler::getInstance('Application')->mark('Execute Plugin ' . $pluginName.'::'.$event.' - START');
}
// Fire the event for an object based observer.
if (is_object($this->_observers[$key]))
{
$args['event'] = $event;
$value = $this->_observers[$key]->update($args);
}
// Fire the event for a function based observer.
elseif (is_array($this->_observers[$key]))
{
$value = call_user_func_array($this->_observers[$key]['handler'], $args);
}
if (constant('JDEBUG'))
{
JProfiler::getInstance('Application')->mark('Execute Plugin ' . $pluginName.'::'.$event.' - END');
}

Now you can examine, in which order the plugins, modules are loaded and how long each load takes.

Upvotes: -1

Pawel Panek
Pawel Panek

Reputation: 21

Try to disable Rok modules and plugins. Check if that changes anything. If you're using memcached caching try to disable it or eventually change to Files. Even you have slow disk Files caching can improve the site. Memcached sometimes give opposite results to what is expected.

Also try to find out if your issues are related to CloudFlare service you're using. Just crate a subdomain going directly to your back end hosting and see if response time is different.

If nothing helps and you don't see issues in Joomla debug output then it's time for server side debug. I assume you're using linux hosting. Find out if dns resolving works good on your server. Just use ping, dig or host to query any domain name for IP address. If you see a pause for name resolution then fix your resolver first.

If you're running php with CGI then you can try stracing php proces and find out if it makes pauses on something eg. waiting for connection to db maybe? Other way is to employ xdebug php module and do function tracing. You can use xdebug either you run php as CGI or server module.

Upvotes: 2

Riccardo Zorn
Riccardo Zorn

Reputation: 5615

I agree with the above comments any template based on a framework is usually slow, to see if this is the issue simply assign the beez menu to the homepage and see how much of a difference it makes.

Usually a time so high means you have your cache not properly configured, and / or many modules on the homepage which aren't optimized, and / or a massive number of articles. There are solutions to all of these, but please do a few tests so we can nail down the main issues.

It's best if you work on a non-live copy so you can play with it without disrupting the current site.

  1. put the site in debug mode (from the global configuration) and reload the homepage. You should see a table below the page with loading times. Save them.
  2. assign another template, create the right module positions so it will load the same content as your current home. Save the time it took to load
  3. verify that your cache plugin is enabled and that your cache is enabled in the configuration with an appropriate timing*. Clear the cache then do a timed page load (save the times) and then immediately reload the page. By comparing the two times we'll hopefully learn which is the offending extension or issue.

This is just some basic diagnostics, once you post back we could go a bit further.

  • appropriate cache timing: if you get 2 hits / hour, and your cache is set to the default 15 minutes, you're not using the cache at all!!! If you're getting 400 hits/ hour then only 4 will be used to generate the cache i.e. 1% of requests will be slower. The lower your hits, the higher the cache time should be to make it effective.

Upvotes: 0

Lodder
Lodder

Reputation: 19743

I would put it down to the host and/or the heavy template + additional extensions you're running. I have always found Rockettheme templates and their framework extremely heavy due to the number and size of JavaScript and CSS files.

What you could do is, take a backup of the website and run it on a localhost such as WampServer, to see if there is any difference in the load speed.

If you see the site running much faster, you might want to consider a different host. If there is not much difference then I think a different template might be needed.

Hope this helps

Upvotes: 0

Related Questions