210 likes | 364 Views
APV Technical Training. Chapter 07 - HTTP Compression. Objectives. To understand HTTP Compression concepts. To understand HTTP Compression configuration. HTTP Compression. HTTP Compression is defined in the following RFCs 1950: ZLIB Algorithm 1951: DEFLATE Algorithm 1952: GZIP Algorithm
E N D
APV Technical Training Chapter 07 - HTTP Compression
Objectives • To understand HTTP Compression concepts. • To understand HTTP Compression configuration.
HTTP Compression • HTTP Compression is defined in the following RFCs • 1950: ZLIB Algorithm • 1951: DEFLATE Algorithm • 1952: GZIP Algorithm • Array ADC appliance supports GZIP algorithm which is described in RFC 1952. It is the default supported algorithm by browsers. • Array ADC appliance supports both Hardware and Software HTTP compression. SW compression can toll large CPU cycles. HW Compression is recommended for high traffic site with large text based content. • Provides the ability to compress web content on-the-fly (Dynamic Content) during download.
HTTP Compression Support • Compression can be inserted into a network without modifying the web applications (simple and cheap). • Most current web browsers support compressed content. • When browser sends GET request, a header will indicate whether compression is supported. • Compression engine will not compress the content if it detects that a client does not support compression. • Compression engine will check the “Content-Type: <MIME-Type>” for qualified content type to compress and send compressed data to client. • Browser will automatically decompress any compressed content when it receives it. • Server may store compressed data to serve client requests (good for static content). For dynamic content; server real-time compression each response is a big burden to CPU. Still desire to off-load compression to in-line ADC unit.
HTTP Compression Benefits • Users require less time to download content. • Compressed HTTP responses mean faster download times, which translates to an improved web-surfing experience for users (especially those with slow Internet connections). • ISP bandwidth cost savings • Compressed HTTP responses means reduced bandwidth utilization • Offload compression function from web server • Administrators do not need to implement resource intensive compression functions on the web server; especially for Dynamic Content. • Speed up SSL delivery • Compression is particularly useful where secure SSL connections are used, because it reduces the amount of content that has to be encrypted and decrypted by the client. • Compression can be enabled/disabled at will.
Performance Gains • Most users are connecting via dial-up @ 2–4 Kbytes/second. • Use a 20 Kbyte file download as an example.
Compressible Content • What HTTP content is compressible? • Array ADC Appliance is using standard GZIP to interact with standard browser; therefore, limited to text-based content. • Content that can be compressed for all browsers includes the following: • HTML files • Text files • XML files • Microsoft Word documents • Content that can be compressed for configured browsers includes the following: • JavaScript files • CSS (Cascading Style Sheets) files • PDF files • PPT (MS Power Point) • XLS (MS Excel) • DOC
Compressible Content • Certain content types are not compressible because they are already compressed or not suitable for GZIP: • Compressed image formats • .jpg • .gif • png • rar • zip • exe • flv • mov • wma • mp3 • avi
Compression - MIME Types • Array ADC Appliance compression is performed based on MIME type (Content-Type:) responded by server, not filename extension because scripts can serve up documents. • Example: An .asp page can return an MS Word MIME type (application/msword) • The MIME types (text based) that are always compressed regardless of the browser include: • text/html • text/plain • text/xml • application/msword
Compression - Browser + MIME • Browser can Lie (BUG) • Early versions of Netscape 4 say they support ZLIB inflation when they really can't • Browsers have problems dealing with certain types of compressed content. • Example: Netscape 6 cannot display compressed PDF documents • Array ADC appliance compresses the following MIME types for selected browsers: • text/javascript • text/css • application/x-javascript • application/x-pointplus • application/pdf • Configuration of browser types to apply compression for the above MIME types is described in the CLI section.
HTTP Compression Header • HTTP Header • Accept-Encoding: gzip, deflate
HTTP Compression Configuration • To enable/disable HTTP compression http compression {on | off} [virtual_name] • This command allows the user to enable/disable HTTP data compression using gzip. • By default; WEB object with MIME type text/html, text/plain, text/xml and application/msword will be compressed. • If virtual service name is specified, this command enables/disables HTTPcompression feature for the specified virtual service. • Only when both the global HTTPcompression feature and the per virtual service http compression feature are all enabled, the system will compress the HTTP data of a virtual service.
Compression – Built-in Policies • To load a built-in set of tested user-agent/browser policies for compression of JavaScript, CSS or PDF content • http compression advanced useragent on • Configuration Example: • Enable the default compression policy to extend the compression coverage with known good browsers and content type.
Compression – Configurable Policy • To enable/disable HTTP compression of JavaScript, CSS or PDF content for selected browsers http compression policy useragent <user-agent> <js | css | pdf | doc | ppt | xls> • The user-agent string identifies the browsers to which the configured MIME types can be sent compressed. • Configuration Examples: • Send compressed Java Script, CSS, PDF documents to IE 7.0/8.0 browsers, the following command can be used
Compression – Exclusion Policy • Array ADC Appliance can exclude specific web object from compression. Such as web object with negative compression ratio. Rarely; compression may cause application failure for most updated browsers. http compression policy urlexclude <vhost> <URL> • Configuration Example: • Due to execution timing issue, we exclude Java Script “strange.js” from compression.
Compression – Statistics (CLI) • To display HTTP compression statistics • show stat comp • Compression Ratio • High to 75% of text files • Overall 35% web sites
Summary • HTTP Compression Overview • Reduce download time/Faster response. • Save bandwidth (30-50%, for typical web site). • Best for dynamic content; narrowband connections with faster computers CPU. • HTTP Compression Support • Most modern browsers that support HTTP 1.1 support ZLIB inflation of deflated documents. • HTTP Compression Configuration • http compression {on | off} • http compression advanced useragent on • http compression policy • urlexclude <Virtual Service> <URL> • useragent <Browser> <MIME type> • show statistics compression