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)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
A654 - Web Application Deployment - Configuring and Controlling Tomcat [837] Tomcat - Shutdown port - (2006-08-18)
[907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
[914] A practical example of roles - (2006-11-04)
[1370] Apache Tomcat Performance Tuning - (2007-09-29)
[1503] Web page (http) error status 405 - (2008-01-12)
[1553] Automatic startup and shutdown of Tomcat - (2008-02-24)
[1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
[1943] Port and Glasses - (2008-12-14)
[1994] tomcat-users.xml; what a difference a space made - (2009-01-16)
[2039] The Invoker - (2009-02-13)
[2061] Tomcat 6 - Annotated Sample Configuration Files - (2009-03-01)
[2163] CATALINA_OPTS v JAVA_OPTS - What is the difference? - (2009-05-09)
[2652] Reading and writing cookies in Java Servlets and JSPs - (2010-02-26)
[3043] Gathering information - logging - with log4j. First steps. - (2010-11-12)
A603 - Web Application Deployment - Further httpd Configuration [345] Spotting a denial of service attack - (2005-06-12)
[466] Separating 'per instance' data from binaries and web sites - (2005-10-16)
[526] Apache httpd - serving web documents from different directories - (2005-12-12)
[550] 2006 - Making business a pleasure - (2006-01-01)
[631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
[649] Denial of Service ''attack'' - (2006-03-17)
[662] An unhelpful error message from Apache httpd - (2006-03-30)
[755] Using different URLs to navigate around a single script - (2006-06-11)
[853] To list a directory under httpd on a web server, or not? - (2006-09-02)
[934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
[1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
[1080] httpd.conf or .htaccess? - (2007-02-14)
[1121] Sharing the load with Apache httpd and perhaps Tomcat - (2007-03-29)
[1207] Simple but effective use of mod_rewrite (Apache httpd) - (2007-05-27)
[1355] .php or .html extension? Morally Static Pages - (2007-09-17)
[1377] Load Balancing with Apache mod_jk (httpd/Tomcat) - (2007-10-02)
[1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
[1551] Which modules are loaded in my Apache httpd - (2008-02-23)
[1554] Online hotel reservations - Melksham, Wiltshire (near Bath) - (2008-02-24)
[1564] Default file (MiMe types) for Apache httpd and Apache Tomcat - (2008-03-04)
[1566] Strange behaviour of web directory requests without a trailing slash - (2008-03-06)
[1619] User and Group settings for Apache httpd web server - (2008-04-22)
[1636] What to do if the Home Page is missing - (2008-05-08)
[1707] Configuring Apache httpd - (2008-07-12)
[1767] mod_proxy and mod_proxy_ajp - httpd - (2008-08-22)
[1778] Pointing all the web pages in a directory at a database - (2008-08-30)
[1939] mod_proxy_ajp and mod_proxy_balancer examples - (2008-12-13)
[1954] mod_rewrite for newcomers - (2008-12-20)
[1955] How to avoid duplicating web page maintainance - (2008-12-20)
[1974] Moving a directory on your web site - (2009-01-03)
[2060] Database connection Pooling, SSL, and command line deployment - httpd and Tomcat - (2009-03-01)
[2272] Monitoring and loading tools for testing Apache Tomcat - (2009-07-07)
[2478] How did I do THAT? - (2009-10-26)
[2900] Redirecting a page - silent, temporary or permanent? - (2010-08-03)
[3133] An image from a website that occasionally comes out as hyroglyphics - (2011-01-14)
[3449] Apache Internal Dummy Connection - what is it and what should I do with it? - (2011-09-19)
[3635] Parse error: parse error, unexpected T_STRING on brand new web site - why? - (2012-03-03)
[3862] Forwarding a whole domain, except for a few directories - Apache http server - (2012-09-17)
[3955] Building up from a small PHP setup to an enterprise one - (2012-12-16)
[4001] Helping search engines with appropriate 400 error codes - (2013-02-11)
[4307] Identifying and clearing denial of service attacks on your Apache server - (2014-09-27)
A211 - Web Application Design and Deployment [23] Skills and responsibilities - (2004-08-22)
[356] Sudoku helper or sudoku cheat - (2005-06-23)
[443] Server side scripting of styles to suit the browser - (2005-09-12)
[659] Web Application Components - (2006-03-28)
[767] Finding the language preference of a web site visitor - (2006-06-18)
[1198] From Web to Web 2 - (2007-05-21)
[1256] What country are you in? How we find out on our web site - (2007-07-03)
[1545] Letting new visitors know we provide training courses - (2008-02-19)
[1547] New bathing idea for hotels from Hotelympia - (2008-02-20)
[1798] What does an browser understand? What does an HTML document contain? - (2008-09-15)
[2072] Copyright, Portability and other nontechnical web site issues - (2009-03-09)
[3532] Sharing the user experience - designing a form with the customer in mind - (2011-11-29)
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