Web Site Response Time
Anyway, I used one of the Solaris zones and compiled Tcl with tDOM, and httperf. These are the steps that I used:
- Download the home page html using Tcl with http package
- Parse the html and convert that to a DOM tree with tDOM
- Retrieve all the dependencies (image, flash, javascript, css, ...)
- Write a temporary file of the html + dependencies, this will be used as the httperf's session workload input file (see -wsesslog option)
- Execute httperf with 2 concurrent connections (that's normally configured in web browsers)
- Append the data in RRD update format
- RRD update format will be cut and paste to my auto graph generator S.T.A.R.
The home page consists of 17 thumbnail photos (in jpg format) and other stuff. However, these jpeg files are of size of 225x141 and they are all forced to display in 125x71. If we were to convert these thumbnail photos to the correct size (125x71), we could have saved 364,107 bytes. According to my calculation, the response time of the home page will be reduced by a maximum of 0.93 seconds on a 1.5Mbps internet connection.
The above was put forward to the developer, but I was told the 225x141 size photos were being used in another location. Instead of creating another set of thumbnails for the home page, the thumbnails were forced to display smaller (125x71). Of course it works by wasting a lot of bandwidth and making the home page load slower.
The developer may not know that this can be easily done in Solaris. FYI, ImageMagick is now a built-in utility in Solaris. It is located under the /usr/sfw directory and the package name is SUNWimagick. A script like this can create another set of thumbnails of size 125x71.
PATH=/usr/sfw/bin:$PATH; export PATH LD_LIBRARY_PATH=/usr/sfw/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH for i in *jpg do new="`basename $i .jpg`_s.jpg" convert $i -resize 125x71 $new doneIt took 5 seconds on my X4500 to create another set of thumbnails for the home page. With a one time effort of 5 seconds CPU time, you are likely to reduce the home page response time by almost 1 second. The choice is yours. From the above graph, you can see the response time reduced by almost a seconds after 22 March. FYI, the above was proposed to the developer on the 15 March.
Labels: ImageMagick, RRDtool, shell script, Solaris, Tcl, tDOM
0 Comments:
Post a Comment
<< Home