Website Optimization
I’m getting ready to release this really cool, feature packed KZION website with all kinds of bells and whistles. I decided to take a cruise over to the Website Optimization site and use their Web Page Speed Report to see how long the redesigned KZION website takes to load and see if there are any other problems that I may not be catching.
When I got the Speed Report back I was pretty disillusioned. I knew that the pages were heavy but I work on a very fast DSL connection and I don’t notice load times. Here’s what the Speed Report gave me:
Total Size: 40226 bytes // meaning the page size
HTML: 23208
Images: 12405
JavaScript: 2726
CSS: 1887
Download Time
14.4K – 31.38 seconds
28.8K – 15.79 seconds
33.6K – 13.56 seconds
56K – 8.22 seconds
ISDN 128K - 2.66 seconds
T1 1.44Mbps – 0.41 seconds
Eight seconds on a 56K modem is just not good enough. It’s too slow and the majority of web surfers use 56K modems. I needed to find a way to reduce the size of the page without trimming any code or removing any features. I was already using gzip compression in my CSS file to compress the file prior to delivering it to the browser which reduced the load time of my CSS file. I remembered seeing something about using gzip compression for PHP files too.
Sure enough there is a way to gzip the page before the browser receives it which obviously makes the page smaller. Here’s what I did.
I added the following code to the top of my header include. This line has to go at the top of the page or things will break, that’s tech talk for things will go bad.
<?php ob_start("ob_gzhandler"); ?>
What this does is start an output buffer which takes the content of the page and compresses it before delivering it to the visitor. It also checks the browser to be sure it can accept compressed content, if so it zips up the buffer and away it goes. Now the moment of truth. I ran the redesigned KZION through the Speed Test and here are the results.
Total Size: 22406 bytes
That’s right! Half the size. Before: Total Size: 40226 bytes and after: Total Size: 22406 bytes
HTML: 5388
Images: 12405
JavaScript: 2726
CSS: 1887
Of course no difference in images as zipping images has no reduction value.
Connection Rate
14.4K – 17.57 seconds
28.8K – 8.88 seconds
33.6K – 7.64 seconds
56K – 4.67 seconds
ISDN 128K - 1.57 seconds
T1 1.44Mbps – 0.32 seconds
I can live with 4.67 seconds on a 56K modem.
While doing some research on PHP and gzip I also learned that there is an Apache module called mod_zip which works transparently on the server zipping any and all files that it can. I admin my own server and could certainly put this into place but with the redesign being released sometime today the last thing I need is a messed up server that I have to spend all day trying to fix.