How fast does Joomla render?

How fast does Joomla render?

Joomla is a fast CMS and if used with a caching extension like JotCache the performance is improved significantly.

But for big websites it can be slow with caching and other performance improvements like google pagespeed apache module.

The speed of a web page depends on may things, like the actual php code run to render the page, the mysql queries, the number of resources needed to display the page like css files, javascript files etc.

So how to actually see how much time it takes the server to provide the web page content to our users browser.

We all know that modern browsers have in built or installable extensions for developers, like FireFox FireBug or Chromes developer tools etc.

We can use these tools to see a bunch of information, like time waiting for the server to respond, time spent on connecting etc.

To see how much time the server takes to render a webpage we will alter the Joomla index.php file adding this at the start of the script:

//time log
$starttime = microtime(true);

Add the above code just after the php script start tag "<?php" on a new line.

At the end of the index.php file add

//time log
$endtime=microtime(true);
$time_elapsed_secs = round(($endtime - $starttime),2);

$myFile = JPATH_BASE."/time_log.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $time_elapsed_secs."s - ".date("d/m/Y H:i:s")." -> ".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']." - ".$_SERVER['REMOTE_ADDR']."\n";
fwrite($fh, $stringData);
fclose($fh);

This little edit will create a log file called "time_log.txt" in which it will record the time of rendering, the date and time, the url for which the recording took place and the user ip address.

Now having this little log and using the browsers developer tools we can compare the time waiting for the server response with the actual rendering time, the difference would be the actual time of the transfer from the server to our browser.

If the time for rendering in the "time_log.txt" is big, in example 2 seconds we need to look into the code, bad code is one of the most common problems, mysql queries can slow the website down too etc.

Another factor are all those resources we use to display the webpage, like css and js, the apache server has its limits too (set in configuration), like max connections, in example if we have a webpage using 100 css js image files the server will be slowed if the max_connections setting is lower than 100, this part might seam a bit confusing, each resource (js,css,images) go through apache server which will delay the serving if the max number of simultaneous connections is exceeded, we need to make sure that the apache configuration is correct (the nr of requests made by a page doesn't exceed the max connections settings).

Also the apache child servers may be increased to server more connections, the default is 10, this value can be increased for a better performance of the apeche server, this setting tells apache how many apache servers can be run (at startup, a max of processes).

The above might be tricky for most of us, but if your server has installed WHM, it's pretty easy to play with these settings.

Now that we know a little about how a page is rendered and how to check the time it takes to do so, we can start on improving :) good luck!

Great article Claudiu Maftei. Nice to read andhve bookmarked :)

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore content categories