Main Content
Compressing web pages sent out from server. Is it worth it? Archive - Originally posted on "The Horse's Mouth" - 2007-09-14 16:57:26 - Graham Ellis
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.
Some other articles
A654 - Configuring and Controlling Tomcat Gathering information - logging - with log4j. First steps. Reading and writing cookies in Java Servlets and JSPs CATALINA_OPTS v JAVA_OPTS - What is the difference? Tomcat 6 - Annotated Sample Configuration Files The Invoker tomcat-users.xml; what a difference a space made Port and Glasses WEB-INF (Tomcat) and .htaccess (httpd) Automatic startup and shutdown of Tomcat Web page (http) error status 405 Apache Tomcat Performance Tuning This article A practical example of roles Browser -> httpd -> Tomcat -> MySQL. Restarting. Tomcat - Shutdown port A603 - Further httpd Configuration Identifying and clearing denial of service attacks on your Apache server Helping search engines with appropriate 400 error codes Building up from a small PHP setup to an enterprise one Forwarding a whole domain, except for a few directories - Apache http server Parse error: parse error, unexpected T_STRING on brand new web site - why? Apache Internal Dummy Connection - what is it and what should I do with it? An image from a website that occasionally comes out as hyroglyphics Redirecting a page - silent, temporary or permanent? How did I do THAT? Monitoring and loading tools for testing Apache Tomcat Database connection Pooling, SSL, and command line deployment - httpd and Tomcat Moving a directory on your web site How to avoid duplicating web page maintainance mod_rewrite for newcomers mod_proxy_ajp and mod_proxy_balancer examples Pointing all the web pages in a directory at a database mod_proxy and mod_proxy_ajp - httpd WEB-INF (Tomcat) and .htaccess (httpd) Configuring Apache httpd What to do if the Home Page is missing User and Group settings for Apache httpd web server Strange behaviour of web directory requests without a trailing slash Default file (MiMe types) for Apache httpd and Apache Tomcat Online hotel reservations - Melksham, Wiltshire (near Bath) Which modules are loaded in my Apache httpd Using a MySQL database to control mod_rewrite via PHP Load Balancing with Apache mod_jk (httpd/Tomcat) .php or .html extension? Morally Static Pages This article Simple but effective use of mod_rewrite (Apache httpd) Sharing the load with Apache httpd and perhaps Tomcat httpd.conf or .htaccess? Passing GET parameters through Apache mod_rewrite Clustering, load balancing, mod_rewrite and mod_proxy To list a directory under httpd on a web server, or not? Using different URLs to navigate around a single script An unhelpful error message from Apache httpd Denial of Service ''attack'' Apache httpd to Tomcat - jk v proxy 2006 - Making business a pleasure Apache httpd - serving web documents from different directories Separating 'per instance' data from binaries and web sites Spotting a denial of service attack A211 - Web Application Design and Deployment Sharing the user experience - designing a form with the customer in mind Copyright, Portability and other nontechnical web site issues What does an browser understand? What does an HTML document contain? New bathing idea for hotels from Hotelympia Letting new visitors know we provide training courses This article What country are you in? How we find out on our web site From Web to Web 2 Finding the language preference of a web site visitor Web Application Components Server side scripting of styles to suit the browser Sudoku helper or sudoku cheat Skills and responsibilities