[JIRA-Opensymphony] Commented: (CACHE-49) Add Http1.1 Compression (GZip) and increase efficiency

[email protected]
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
The following comment has been added to this issue:

     Author: Paul Rivers
    Created: Thu, 7 Aug 2003 12:03 AM
       Body:
What's great about it is that it doesn't just add compression, it will reduce the memory overhead of OSCache (among other benefits), thus it benefits OSCache to include it. :-)
---------------------------------------------------------------------
View the issue:

  http://jira.opensymphony.com/secure/ViewIssue.jspa?key=CACHE-49


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: CACHE-49
    Summary: Add Http1.1 Compression (GZip) and increase efficiency
       Type: New Feature

     Status: Assigned
   Priority: Major

    Project: OSCache

   Assignee: Chris Miller
   Reporter: Paul Rivers

    Created: Mon, 4 Aug 2003 3:46 PM
    Updated: Mon, 4 Aug 2003 3:46 PM

Description:
By adding support for compressing web pages using gzip to OSCache, you can:
1. Decrease the memory used by OSCache to cache web pages.
2. In situations where the cache is infrequently invalidated, reduce the amount of work the webserver does - smaller files means the webserver sends less data, and which takes less work.
2. Of course, increased load time for web pages for the end user and less use of bandwidth.

As you may know, all http1.1 compliant browsers must be capable of reading content compressed using gzip (At least that's my understanding - it's mentioned at http://www.w3.org/Protocols/rfc2068/rfc2068) This seems to reduce the size of most webpages to about 33% of their original size. For example, the OSCache homepage compresses to 33.5% of its original size, going from an estimated download time of 2.2 seconds to 0.7 seconds. The java.sun.com homepage can be reduced to 14.8% of its original size if it was gzip compressed (Source: http://leknor.com/code/gziped.php). Mozilla also did their own compression testing: http://www.mozilla.org/projects/apache/gzip/

The problem is that using gzip compression normally increases the load on the server - each time a page is requested, it must be gzipped. With static html pages, it is possible to cache the compressed page, so it isn't compressed over and over again. Obviously, that won't work with dynamic content - but since anyone using OSCache IS managing a cache of their pages, this is the perfect place for it! It also doesn't require a lot of extra coding - the jdk already has classes that perform gzip compression for you. In fact, tomcat ships with code to do compression on a web page as example code (Tomcat 4.1\webapps\examples\WEB-INF\classes\compressionFilters).

Of course, only certain types of content benefit from and should be compressed - html, htm, xml are good, jpg and gif shouldn't be compressed.

I think enabling gzip should be configurable by the user - use gzip for requests with certain content types (best solution), file extensions, url's matching a regular expression, or pick and choose individual files.

The only major problem I can think of is - What should OSCache do when a request comes in that doesn't support gzip (you can check the headers for a web page request to determine if it supports gzip compression)? I know of 3 possibilites:
1. Send an error - who uses an http1.0 browser anyways? ;-)
2. Decompress the page on the server and send it - http1.0 requests are the exception. This seems like the most sensible default behavior.
3. Keep a cache of both the compressed and uncompressed pages. I think this should be available as an option, but not the default. You would actually use more memory this way.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.opensymphony.com/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.