ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • HTTP Compression
    개발/Web 2022. 6. 14. 20:33

    *복습 자료라서 뻔한 내용은 생략

     

     

    Summary.

     

    1. In practice, web developers don't need to implement compression mechanisms, both browsers and servers have it implemented already, but they have to be sure that the server is configured adequately. Compression happens at three different levels

    • first some file formats are compressed with specific optimized methods,
    • then general encryption can happen at the HTTP level (the resource is transmitted compressed from end to end),
    • and finally compression can be defined at the connection level, between two nodes of an HTTP connection

     

    2. File format compression

        + Each data type has some redundancy, that is wasted space, in it. If text can typically have as much as 60% redundancy, this rate can be much higher for some other media like audio and video

    • Loss-less compression, where the compression-uncompression cycle doesn't alter the data that is recovered. It matches (byte to byte) with the original. For images, gif or png are using lossless compression.
    • Lossy compression, where the cycle alters the original data in a (hopefully) imperceptible way for the user. Video formats on the Web are lossy; the jpeg image format is also lossy

     

    3. End-to-end compression

        + For compression, end-to-end compression is where the largest performance improvements of Web sites reside. End-to-end compression refers to a compression of the body of a message that is done by the server and will last unchanged until it reaches the client. Whatever the intermediate nodes are, they leave the body untouched

        + Nowadays, only two are relevant: gzip, the most common one, and br the new challenger

        + To select the algorithm to use, browsers and servers use proactive content negotiation. The browser sends an Accept-Encoding header with the algorithm it supports and its order of precedence, the server picks one, uses it to compress the body of the response and uses the Content-Encoding header to tell the browser the algorithm it has chosen. As content negotiation has been used to choose a representation based on its encoding, the server must send a Vary header containing at least Accept-Encoding alongside this header in the response; that way, caches will be able to cache the different representations of the resource

        + As compression brings significant performance improvements, it is recommended to activate it for all files, but already compressed ones like images, audio files and video

     

     

    4. Hop-by-hop compression

        + Connections between successive intermediate nodes may apply a different compression

        + the node transmitting the request advertizes its will using the TE header and the other node chooses the adequate method, applies it, and indicates its choice with the Transfer-Encoding header

        + In practice, hop-by-hop compression is transparent for the server and the client, and is rarely used. TE and Transfer-Encoding are mostly used to send a response by chunks, allowing to start transmitting a resource without knowing its length (Note that using Transfer-Encoding and compression at the hop level is so rare that most servers, like Apache, Nginx, or IIS, have no easy way to configure it. Such configuration usually happens at the proxy level)

     

     

    Additional.

    1. (다음에) HTTP Fingerprinting 이란?

     

     

     

    Reference.

    '개발 > Web' 카테고리의 다른 글

    Security Context  (0) 2022.06.18
    HTTP Range Request  (0) 2022.06.14
    HTTP Redirect  (0) 2022.06.14
    HTTP Caching  (0) 2022.06.14
    HTTP Authentication  (0) 2022.06.12
Designed by Tistory.