Compressing web pages sent out from server. Is it worth it?
Web servers can compress .html and similar files before they send them out - a great way to keep traffic volume down where bandwidth is more of a consideration than processor power. But what proportion of
browsers can accept compressed data? That's a darned good question which I was asked on today's
Tomcat Deployment course.
Adding in a few lines on the end of a PHP script that encapsulates all our web pages, I kep a log file for a short while. And out of a sample of 1380 hits on our web site ...
1035 (75%) could accept gzip compression
822 (60%) could accept deflate compression
166 (12%) could accept x-gzip compression
Only 245 requests (18%) did not include any notice that they could receive compressed responses.
Here's the PHP code I used ...
$fho = fopen("$_SERVER[DOCUMENT_ROOT]/../compress.dat","a");
fputs($fho,"$_SERVER[HTTP_ACCEPT_ENCODING]\n");
fclose($fho);
Remember that images are already compressed (part of the format of a.jpg, for example), so there's little point in trying to have the server compress them ... but for a busy, bandwidth limited setup at server and/or browser, I conclude that compression IS worthwhile.
(written 2007-09-14 16:57:26)
Associated topics are indexed under
A211 - Web Application Design and Deployment [2072] Copyright, Portability and other nontechnical web site issues - (2009-03-09)
[1798] What does an browser understand? What does an HTML document contain? - (2008-09-15)
[1547] New bathing idea for hotels from Hotelympia - (2008-02-20)
[1545] Letting new visitors know we provide training courses - (2008-02-19)
[1256] What country are you in? How we find out on our web site - (2007-07-03)
[1198] From Web to Web 2 - (2007-05-21)
[767] Finding the language preference of a web site visitor - (2006-06-18)
[659] Web Application Components - (2006-03-28)
[443] Server side scripting of styles to suit the browser - (2005-09-12)
[356] Sudoku helper or sudoku cheat - (2005-06-23)
[23] Skills and responsibilities - (2004-08-22)
A603 - Web Application Deployment - Further httpd Configuration [2900] Redirecting a page - silent, temporary or permanent? - (2010-08-03)
[2478] How did I do THAT? - (2009-10-26)
[2272] Monitoring and loading tools for testing Apache Tomcat - (2009-07-07)
[2060] Database connection Pooling, SSL, and command line deployment - httpd and Tomcat - (2009-03-01)
[1974] Moving a directory on your web site - (2009-01-03)
[1955] How to avoid duplicating web page maintainance - (2008-12-20)
[1954] mod_rewrite for newcomers - (2008-12-20)
[1939] mod_proxy_ajp and mod_proxy_balancer examples - (2008-12-13)
[1778] Pointing all the web pages in a directory at a database - (2008-08-30)
[1767] mod_proxy and mod_proxy_ajp - httpd - (2008-08-22)
[1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
[1707] Configuring Apache httpd - (2008-07-12)
[1636] What to do if the Home Page is missing - (2008-05-08)
[1619] User and Group settings for Apache httpd web server - (2008-04-22)
[1566] Strange behaviour of web directory requests without a trailing slash - (2008-03-06)
[1564] Default file (MiMe types) for Apache httpd and Apache Tomcat - (2008-03-04)
[1554] Online hotel reservations - Melksham, Wiltshire (near Bath) - (2008-02-24)
[1551] Which modules are loaded in my Apache httpd - (2008-02-23)
[1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
[1377] Load Balancing with Apache mod_jk (httpd/Tomcat) - (2007-10-02)
[1355] .php or .html extension? Morally Static Pages - (2007-09-17)
[1207] Simple but effective use of mod_rewrite (Apache httpd) - (2007-05-27)
[1121] Sharing the load with Apache httpd and perhaps Tomcat - (2007-03-29)
[1080] httpd.conf or .htaccess? - (2007-02-14)
[1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
[934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
[853] To list a directory under httpd on a web server, or not? - (2006-09-02)
[755] Using different URLs to navigate around a single script - (2006-06-11)
[662] An unhelpful error message from Apache httpd - (2006-03-30)
[649] Denial of Service ''attack'' - (2006-03-17)
[631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
[550] 2006 - Making business a pleasure - (2006-01-01)
[526] Apache httpd - serving web documents from different directories - (2005-12-12)
[466] Separating 'per instance' data from binaries and web sites - (2005-10-16)
[345] Spotting a denial of service attack - (2005-06-12)
A654 - Web Application Deployment - Configuring and Controlling Tomcat [2652] Reading and writing cookies in Java Servlets and JSPs - (2010-02-26)
[2163] CATALINA_OPTS v JAVA_OPTS - What is the difference? - (2009-05-09)
[2061] Tomcat 6 - Annotated Sample Configuration Files - (2009-03-01)
[2039] The Invoker - (2009-02-13)
[1994] tomcat-users.xml; what a difference a space made - (2009-01-16)
[1943] Port and Glasses - (2008-12-14)
[1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
[1503] Web page (http) error status 405 - (2008-01-12)
[1370] Apache Tomcat Performance Tuning - (2007-09-29)
[914] A practical example of roles - (2006-11-04)
[907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
[837] Tomcat - Shutdown port - (2006-08-18)
Some other Articles
Match the Bedroom to the HotelMood shotsActionscript / Flash / Flex (IAQ/FAQ)Compressing web pages sent out from server. Is it worth it?FSB (Federation of Small Businesses) Western RegionCash is not an acceptable way of payingScrew it or Glue it? Access to Object variables - a warningWireless Internet Access at hotels - an update and some pitfallsEvening, Devizes and Sells Green