I got handed an issue to look at where a sites pages were loading exceptionally slowly - we're talking 13 to 20 seconds. The site is obviously customised with various addons. I did some digging into it and did the normal debug enable and checked the profile which showed some slowness in various areas but none of which totalled the full page load time. In fact some page scan tools - Google amongst them - didn't properly recognise the slowness just claiming the page loaded in about 4 seconds or so (same as the profile).
Slightly stumped I dug into it further and then found the problem using telnet. Here is an example of what I got.
Firstly, I used a completely basic GET request, ie:
GET / HTTP/1.1
Host: www.slowsite.somewhere
Here's the output example:
HTTP/1.1 200 OK
Date: Mon, 03 Nov 2014 09:22:13 GMT
Server: Apache/2.4.9 (Unix)
X-Powered-By: PHP/5.3.28
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Cache-Control: no-cache
Pragma: no-cache
Set-Cookie: f3c945355423e6c96228179d74322888=tbh278qicf0cle0j8nc5pf0fu3; path=/; HttpOnly
Vary: Accept-Encoding,User-Agent
Cache-Control: max-age=2592000
Expires: Wed, 03 Dec 2014 09:22:13 GMT
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
702a
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr"><head><base href="http://XXXXXXXXXXXX/" /><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="generator" content="Joomla! - Open Source Content Management" /><title>Home</title><link href="http://XXXXXXXXXXX/?view=featured" rel="canonical" /><link href="/?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" /><link href="/?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" /><link href="/templates/XXXXXXXXX/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" /><link rel="stylesheet" href="/components/com_rsform/assets/calendar/calendar.css" type="text/css" /><link rel="stylesheet" href="/components/com_rsform/assets/css/front.css" type="text/css" /><link rel="stylesheet" type="text/css" href="/plugins/system/jch_optimize/assets2/jscss.php?f=953dd117283665c8de4b1dbc99fa7ebc&type=css&gz=gz&d=30&i=0"/><link rel="stylesheet" href="/modules/mod_slideshowck/themes/default/css/camera.css"
then down at the end...
<div class="footer3">© 2014 XXXXXXXXXXX. All rights reserved</div><div class="clear"> </div><div class="footer-bottom">Company Name: XXXXXXXXXX. Company Registration No/Place of Registration: XXXXXXXXX Cardiff Registered Office Address: XXXXXXX</div></div></div></div></div></body></html>
0
As you can see, there is some text outside the HTML. It looks like some sort of debugging hex word output. The first one changes all the time (eg 7139
, 6fc3
) but the last one at the end is 0 all the time.
I'm hoping this rings a bell with somebody who's seen this before?
If not I'll have to go dig into this - never used Joomla and PHP very rusty since I last programmed with it many years ago.
Interesting aside is that if you view page source in a browser (Chrome, Explorer etc) they don't show this extra data at all. Totally invisible. It's only if you telnet to the site that you see it.
Then also interesting is that probably the trailing <newline>0<newline>
after the </html>
seems to make the browser think there is more data coming, and it doesn't try to render the page until the default HTTP 1.1 keepalive times out and it drops the connection. It is only then that the browser requests the CSS, Javascript, Images etc. This visible from the timeline/waterfall graph such as eg tools.pingdom.com and gtmetrix.com.
For reference but probably irrelevant the site is hosted with http://www.heartinternet.co.uk/ who we've used for the last 7 years and found quite reliable and with good performance, though never had a Joomla site on it (this was developed somewhere else)