• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to comprese HTTP response

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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.

Regards,
Mohit
 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a few different ways to measure this:

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.
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The book Servlets and JSP: the J2EE Web Tier has a servlet that implements #3 above. You can download the source here:

http://www.jspbook.com/code.jsp

Look for the class com.jspbook.CompressionTest.
[ March 22, 2006: Message edited by: Scott Johnson ]
 
mohit mehta
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanx a ton Scott.
finally I am able to test my application compression ratio.
even today i found one more example in tomcat example servlet where they are providing way to test compression.

in tomcat 5.0 inside servlets-examples folder you can get CompressionFilter and CompressionTest also.

Once again thank you very much for such great help.

Mohit.
 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).

http://www.xk72.com/charles/

Jason.
[ March 24, 2006: Message edited by: Jason Moors ]
    Bookmark Topic Watch Topic
  • New Topic