'Page onload time is very high

I am trying to investigate the cause of slowness on my website.

Here I attach firebug screenshot:

enter image description here

As you can see, all of content is loaded in just 2.92s, but javascript onload event is fired up AFTER 17.67s.

In case you want to see the website itself: http://maylashop.com . I have tried to use YSlow, I get A grade and it doesn't help.

If anyone have fix or know what caused this, please kindly let me know.



Solution 1:[1]

why http://cf.addthis.com ? http://platform.twitter.com, plusone.google.com .... I dont see you use them any where ? if you are using , add them when they are desired

follow the guide lines Yslow , get some matrix and the check what is the bottleneck

You will be happy to follow these rules

Solution 2:[2]

This is not a JavaScript problem. Your PHP script is taking that long to execute (see screenshot). All the other resources that page is loading (JS, CSS, images, etc.) are taking less than a second to load. I'm 95% sure this is caused by zlib.output_compression. Try adding the following code to the top of your script to see if disabling it does anything useful:

ini_set('zlib.output_compression', 0);

If that fixes it, then you could consider not using zlib.out_compression or figure out what specific thing in your code is causing problems with it (usually output buffering).

enter image description here

Solution 3:[3]

Pretty sure this is not related to javascript. Just to request your main page took about 2 seconds. Ran this on a linux machine:

date ; lynx -source http://maylashop.com/ > /dev/null ; date
Fri Apr 13 22:38:19 CEST 2012
Fri Apr 13 22:38:21 CEST 2012

This is an independent confirmation that the host is either generating the index page too slowly, or there is a network transfer issue.

Doing the same thing with /index.php or /index.html or even a 404 page I created on the fly results with same ~2 second delay.

Edit: checked image download speed, and that one is <1 second. Close to 0.

Something in your PHP code might be creating the problem (inducing a delay.) One of those things could be delay in connecting to a MySQL server (or whatever you're using.) Is the database server on the same exact machine, or remote? Are you connecting to it on each call, or do you have a caching system in place?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sakhunzai
Solution 2 jnrbsn
Solution 3