This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am working on one Struts-AJAX combination based project. Where we are loading many text/xml on client machine in response. Now due to this Web application has became very slow. One way we found is to compress HTTP response and i found few example on that, like using Compressionfilter to wrap response in Gzip stream[refe tomcat examples for CompressionFilter implementation] Now I have implemented that in our application and application is running without any problem also. But i want to test about how much data compression is taken place in this?
Can anyone tell me how to about this?
How can i get datacompression rate?
Please suggest me some idea.
It will be great help if reply as soon as possible.
1. You could modify the compression filter to record the compression ratio. (Assuming you have access to the filter source code.)
2. You could create two filters -- one for either side of your compression filter to record the output stream lengths before and after the compression.
3. But I think the simplest solution (and the least impacting to performance) would be to write an applet or a servlet to request your compressed page twice. Once with the "accept-encoding: gzip" header and once without. Then compare the lengths of the two responses.
Joined: Aug 24, 2005
The book Servlets and JSP: the J2EE Web Tier has a servlet that implements #3 above. You can download the source here:
I've used a web debugging tool called Charles (For some reason!), it's Shareware so you can evalute for free, I've found it really helpful in determining bandwidth.
Charles is an HTTP proxy / HTTP monitor that you to view all of the HTTP traffic between a client and the server. This includes requests, responses and the HTTP headers (which contain the cookies and caching information).