Friday, 14 February 2014

Hemant Kurmi - Compression of HttpServletRequest and HttpServletResponse by gzip encoding

Description 
This filter is on HTTP headers in a HttpServletRequest, compress data written to the HttpServletResponse, or decompress data read from the request. When supported by the client browser, this can potentially greatly reduce the number of bytes written across the network from and to the client. As a Filter, this class can also be easily added to any J2EE 1.3+ web application.





Installation

1).Add the pjl-comp-filter-XX.jar file containing CompressingFilter to your web application's WEB-INF/lib directory.

2).Add the following entries to your web.xml deployment descriptor:

 <filter>
  <filter-name>CompressingFilter</filter-name>
  <filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class>
 </filter>

 <filter-mapping>
  <filter-name>CompressingFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

The below data is of my application where i tested this compression techniques

The count is based on data fetched from fiddler when running  app  with and without compression Filter.

Data compression ratio=5:1

Header space savings =80%

Encoding used= gzip

Below header data is actual and after installing CompressingFilter.



Before encoding
After using gzip encoding
    Request Count: 12
    Bytes Sent: 8,212
    Bytes Received: 92,623

    ACTUAL PERFORMANCE
    --------------
    Requests started at: 17:58:52:1558
    Responses completed at: 17:58:57:9514
    Aggregate Session time: 00:00:05:1525
    Sequence (clock) time: 00:00:05.7955795

    RESPONSE CODES
    --------------
    HTTP/404: 1
    HTTP/304: 10
    HTTP/200: 1

    RESPONSE BYTES (by Content-Type)
    --------------
    ~headers: 1,384
    text/html: 91,239
    Request Count: 12
    Bytes Sent: 8,206
    Bytes Received: 15,392

    ACTUAL PERFORMANCE
    --------------
    Requests started at: 18:30:13:7882
    Responses completed at: 18:30:14:9522
    Aggregate Session time: 00:00:00:7760
    Sequence (clock) time: 00:00:01.1640000

    RESPONSE CODES
    --------------
    HTTP/404: 1
    HTTP/304: 10
    HTTP/200: 1

    RESPONSE BYTES (by Content-Type)
    --------------
    ~headers: 1,661
    text/html: 13,731






#hemant #kurmi 
#hemant #kurmi #hemant #kurmi
#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant#hemant #kurmi #hemant #kurmi #hemant #kurmi
#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi

No comments:

Post a Comment

Hemant Kurmi - 2021 - Some Amazing Facts About Memory: Petabyte, Exabyte, and Zettabyte

Some Amazing Facts About Memory: Petabyte, Exabyte, and Zettabyte As technology advances, our ability to store and process data has grown ...