File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Compression in Tomcat5/Apache2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Compression in Tomcat5/Apache2" Watch "Compression in Tomcat5/Apache2" New topic
Author

Compression in Tomcat5/Apache2

cs gthri
Greenhorn

Joined: Jan 28, 2005
Posts: 2
Hello
Can someone pl clear these doubts..
(1) What is GZIP,mod_gzip and mod_deflate? and how are they different?
(2) How can you enable mod_gzip in Apache 2.x? I find that only mod_deflate is available in httpd.conf file.
(3) Instead of coding JSP for compression, why cant you enable the builtin compression facility already available with servlet engine (eg.Tomcat 5.0.28)?Is there any difference?
(4) In fact, why cant we simply enable the mod_deflate compression facility available in the web server itself (eg.Apache2.0.52)?,instead of coding the JSP or enabling the one in the servlet engine. Wont the web server then compress all the output?(HTML's,JSP's and serialised Object's)?.
(4)Can you compress the serialised object sent from the servlet to applet?how can you do that? Do you need to write additional code in servlet for compression or just enabling mod_deflate would be enough?(would appreciate some code)
(5) What is the correct method of adding a new web application in Tomcat 5.0.28? I am using Apache2.0.52-mod_jk2-Tomcat5.0,28.What are the modification actually required in conf/server.xml and WEB-INF/web.xml files? Beacuse, you have mentioned the need to add the line, <Context path=......reloadable="true"/> within <Host></Host> in conf/server.xml.This line is not there initially.You have to manually add it and found that without this line, i have to restart Tomcat every time i modified my servlet,for the new code to take effect. Is this correct and is it necessary?

thanks
csg
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Moving this thread to the more appropriate Apache/Tomcat forum.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

1) gzip is the algorithm used to do the compression. mod_gzip and mod_deflate are two different apache modules that use gzip to compress server responses. gzip is 3rd party, mod_deflate is put out by apache
Info found by google:
http://www.webperformance.org/compression/
http://www.gzip.org/

2) mod_deflate is available because it's from apache and *probably* comes with the standard distribution. mod_gzip you'd have to download.
Info found by typing mod_deflate into search box on:
http://httpd.apache.org/docs-2.0/
http://httpd.apache.org/docs-2.0/mod/mod_deflate.html

3) no reason you can't. That's your choice. This would be most useful if you are running Tomcat standalone, and using apache compression is simply unavailable. As for a difference between "coding your own in a JSP" and using the container's "built-in".... when you code your own, you can convince yourself you're doing a better job.
found by google:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/http.html


4) again, no reason. Is that what you want to do? Web servers (and the Tomcat HTTP connector) will compress whatever MIME types you tell it to compress.

4#2) Yes. Any number of ways. Let tomcat do it, let the webserver do it, or programmatically. The applet will of course, need to un-compress the serialized object itself. For web pages, it's easy to add compression, because all modern browsers can un-compress the gzip'd pages and images and style sheets. Your applet will need similar help (probably).
stuff found by google:
http://java.sun.com/developer/technicalArticles/Programming/compression/
hmm... looks like what you're wanting to know is possible, since it's someone else's homework:
http://www.cs.fiu.edu/~weiss/cop3338_f00/assignments/assign10.html


5) http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/deployment.html

In conf/server.xml is one place you can specify your new application, but not the only one (though it's the oldest and most understood).
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html

modification to WEB-INF/web.xml ? If you're talking about the one supplied by Tomcat, none. If you're talking about the one in your web application... then it needs to exist, and lists all the servlets, filters, etc, etc, to be used in your app.

Adding that line is "correct", and it's certainly necessary if you don't want to restart Tomcat every time you change something.
Eduardo Bapner
Greenhorn

Joined: Jun 15, 2010
Posts: 2
Hi everyone. AS I see you have a very clear idea of these kind of scenarios, I'm going to ask you about my issue.

I have 2 groups of servers (3 jboss for one client and 2 jboss for other client). Every jboss has been configured with "compressionMinSize and compressableMimeType. Each group is a cluster balanced from other system acting as a mod-jk proxy and load balancer.

When i acces directly to the jboss on one system (without going through the proxy/loadbalancer) the responses are compressede, but when i access through the proxy, they are uncompressed.

¿Is there any way of making my proxy "transparent" so responses keep compressed?

I don´t want the apache to perform the comrpession as is a shared equipment that can be compromised by the load introduced using compression.

Thanks in advance for your answers.
 
 
subject: Compression in Tomcat5/Apache2