wood burning stoves 2.0*
The moose likes Servlets and the fly likes gzip content vs. regular content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "gzip content vs. regular content" Watch "gzip content vs. regular content" New topic
Author

gzip content vs. regular content

Niral Trivedi
Ranch Hand

Joined: Nov 26, 2001
Posts: 46
Hi,
I am trying to send gzip content in one of our servlet. And it is working correctly. But comparing response time bet'n sending gzip content and regular content is alsmot same. Isn't gzip content response time should be faster?
The page I am trying contains many images as well as lots of other text content. Then what might be the reason?
Is it because my webserver and JRUN is on same physical machine?
Thanks in advance.
john guthrie
Ranch Hand

Joined: Aug 05, 2002
Posts: 124
i could believe this. a bunch of small images compressed won't be much small than a bunch of small images uncompressed. and you are still making all the same number of requests, which is probably where the bulk of the latency is.
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
compression is only useful when the bandwidth is narrow and message is huge.
for small message or running on a broadband network, compression benefits little, cause compression also incurs an overhead.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by danny liu:
compression is only useful when the bandwidth is narrow and message is huge.
for small message or running on a broadband network, compression benefits little, cause compression also incurs an overhead.

Really what danny liu mentioned above is reasonable, compression has processing overhead... If there is a broadband network, sending uncompressed message, which is small, is alright...
In messaging issue like this, we always have to think about the trade-offs between processing time and delivery dealy time....


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Jayson Falkner
Author
Ranch Hand

Joined: May 07, 2001
Posts: 57
Just a note, compression is always fairly helpful. Sending the same content using less bandwidth is ideal. However, normally you only want to compress your web pages (e.g. HTML, JavaScript, CSS) and not images. Most image formats provide a method to already be compressed, which means you don't benefit much by doing it on the server-side. Of course, you'll really notice compression the most when sending a large web page over a slow connection.
About the issue of how long it takes to compress content. Yes, compressing content takes time. However, if your server isn't taxed, you might as well compress. Plus you can always cache compressed responses so that you aren't compressing every page on the fly.
Hope that helps!.


Jayson Falkner<br />jayson@jspinsider.com<br />Author of <a href="http://www.jspbook.com" target="_blank" rel="nofollow">Servlets and JavaServer Pages; the J2EE Web Tier</a>
Niral Trivedi
Ranch Hand

Joined: Nov 26, 2001
Posts: 46
Thanks for your responses.
As Jayson said, I read article on O'Reilly about compression and cache filter. But the thing is, we are using Servlet 2.2 and that's why can not use Filter yet. We are going to move ultimately to newer Websphere version but till than we want to utilize such a good practice.
So, I want to do similar compression through our controller servlet. So, in that case, as Jayson suggested, how can we separate HTML,JavaScript from gif/jpg files?
Thanks again.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: gzip content vs. regular content