Share
Embed
Data Compression
Introduction to basic compression Algorithms available on the web.
SudarshanReddy kurri
January 24, 2016
Transcript
19 slides
-
DATA COMPRESSION Data compression is the process of encoding
data so that it takes less storage space or less transmission time than it would if it were not compressed. Compression is possible because most real-world data is very redundant -
DATA COMPRESSION TECHNIQUES Two types of data Compression techniques.
Lossless Compression. Used in spreadsheets, PNG, PDF, WOFF, executable program Compression etc., Lossy Compression. Used in JPEG, MPEG ,MP3 etc., -
DATA TRANSFER CLIENT makes a REQUEST & SERVER RESPONDS
back to the CLIENT. Data Transfer takes place during these REQUESTS & RESPONSES b/w CLIENT & SERVER. These days many sites takes the advantage of browser caching to minimizes the data transfer and to provide smooth transitions. -
POPULAR COMPRESSION ALGORITHMS • DEFLATE • GZIP • BZIP2 •
XPRESS • COMPRESS • SCDH -
REQUEST & RESPONSE HEADERS Servers indicate compression algorithms used
for a given response using Content- Encoding RESPONSE HEADER. If the server utilizes compression, it should generally include a Vary : Accept- Encoding RESPONSE HEADER to help ensure that a cache does not mistakenly serve a compressed response to a client that cannot understand it. HTTP requests advertise the decompression algorithms the client supports using the Accept-Encoding REQUEST HEADER. -
REQUEST & RESPONSE BODIES In theory, HTTP allows client
to compress request bodies using the same Content- Encoding mechanism. In practice however, this feature is not used by browsers and is only rarely used by other types of HTTP clients. One Problem is that a client does not know, whether a server accepts compressed requests in prior. In contrast, a server knows whether a client accepts compressed responses by examining the Accept-Encoding REQUEST HEADER. -
DEFLATE ALGORITHM It is the popular compression technique used
in the web and many algorithms are developed based on this. This algorithm is used for HTTP/1.1 Content-Encoding. HTTP SPECIFICATION: Content-Encoding : deflate DEFLATE algorithm combines CLZ77 Algorithm & HUFFMAN Encoding. -
DATA COMPRESSION In general, HTTP Content-Encoding based compression applies
to only the RESPONSE BODY. HTTP HEADERS are not compressed Content-Encoding is rarely applied to REQUEST BODIES. -
ZOPFLI ALGORITHM Zopfli is an algorithm based on DEFLATE
implementation It is used where the static resources such as jquery.js & other frameworks are reused often. As these resources are transferred across the web over million times across various devices. It only takes one-time compression costs for a millions-of-times transfer size savings. The beauty of ZOPFLI is that its output is compatible with all of the billions of existing DEFLATE encoders deployed worldwide, making its use an easy choice for any static content. -
FILE FORMATS Many file formats internally use DEFLATE compression
such as PNG image formats or WOFF font format. Recently Google developed a new compression algorithm BROTLI and open sourced it. It produces about 20 to 26% higher compression ratios over Zopfli. These are already shipped in new Firefox Developer Edition Version 44 & will be shipped in the next higher version release of Google Chrome. Today, Brotli is the compression engine behind the newish WOFF2 font format. -
ADVANTAGES Better compression algorithms leads to: Better Space Utilization,
Faster Page Loads, Lower Data Transfer fees and Reduced Battery Use.