...

Web Server Compression (IIS 6) Proven Practice

by user

on
Category:

local news

2

views

Report

Comments

Transcript

Web Server Compression (IIS 6) Proven Practice
Proven Practice
Web Server Compression (IIS 6)
Product(s): Cognos 8, Third Party (IIS)
Area of Interest: Infrastructure
Web Server Compression (IIS 6)
2
Copyright
Copyright © 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC
is an IBM Company. While every attempt has been made to ensure that the
information in this document is accurate and complete, some typographical
errors or technical inaccuracies may exist. Cognos does not accept
responsibility for any kind of loss resulting from the use of information
contained in this document. This document shows the publication date. The
information contained in this document is subject to change without notice.
Any improvements or changes to the information contained in this document
will be documented in subsequent editions. This document contains
proprietary information of Cognos. All rights are reserved. No part of this
document may be copied, photocopied, reproduced, stored in a retrieval
system, transmitted in any form or by any means, or translated into another
language without the prior written consent of Cognos. Cognos and the
Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated)
in the United States and/or other countries. IBM and the IBM logo are
trademarks of International Business Machines Corporation in the United
States, or other countries, or both. All other names are trademarks or
registered trademarks of their respective companies. Information about
Cognos products can be found at www.cognos.com
This document is maintained by the Best Practices, Product and Technology
team. You can send comments, suggestions, and additions to
[email protected] .
Cognos Proprietary Information
Web Server Compression (IIS 6)
3
Contents
1
INTRODUCTION ............................................................................................ 4
1.1
1.2
PURPOSE ............................................................................................................4
APPLICABILITY .....................................................................................................4
2
WHY ENABLE HTTP COMPRESSION? ............................................................ 4
2.1
2.2
THIN CLIENT APPLICATIONS .....................................................................................4
HTTP COMPRESSION..............................................................................................4
3
CONFIGURING HTTP COMPRESSION FOR IIS 6........................................... 6
3.1
3.2
3.3
3.4
3.5
BACKUP THE EXISTING CONFIGURATION .......................................................................6
ENABLE COMPRESSION............................................................................................7
ALLOW THE FILTER ................................................................................................8
STOP THE WEB SERVER PROCESSES .......................................................................... 11
SPECIFYING THE FILES TO BE COMPRESSED .................................................................. 11
4
EXAMPLE BANDWIDTH REDUCTION .......................................................... 15
5
TURNING COMPRESSION OFF .................................................................... 16
Cognos Proprietary Information
Web Server Compression (IIS 6)
4
1 Introduction
1.1
Purpose
This document discusses Web Server compression and how implementing it
can decrease the network bandwidth usage of a IBM Cognos 8 installation. It
includes a practical example of configuring Microsoft Internet Information
Server (IIS 6) to enable compression suited to the IBM Cognos 8
environment.
1.2
Applicability
Although IBM Cognos 8 and IIS 6 are specifically mentioned, the same
principles should apply to any web based application and any web server that
enables HTTP compression.
2 Why Enable HTTP Compression?
2.1
Thin Client Applications
IBM Cognos 8 is a ‘thin client’ application – that is to say for typical end users
no specific software is required to be installed on the client PC’s beyond a
supported Web Browser. This is in comparison to a ‘thick client’ application
such as a spreadsheet application that is usually individually installed on the
PC of everyone that uses it.
Deploying and administering thin client applications is far simpler than thick
client applications – typically only a handful of servers needs to be installed,
configured, backed up, upgraded, etc. compared to potentially thousands of
individual client PCs.
Because of the server-centric nature of thin client applications, more
emphasis is placed on the networking infrastructure than other application
topologies. One aspect of maintaining an efficient networking environment is
to optimize bandwidth usage by decreasing the amount of traffic used.
2.2
HTTP compression
A common technique used to reduce bandwidth usage is compression. File
compression is very familiar to regular computer users who daily use utilities
such as WinZip to shrink the size of files before archiving or emailing them.
How well different types of files compress depend on many factors, but
typically text content will compress very well compared to binary file formats,
especially if the binary format is all already optimized for size, such as the GIF
and JPEG image formats.
Cognos Proprietary Information
Web Server Compression (IIS 6)
5
The screenshot below shows how a typical HTML file compresses significantly
from 20KB to 5KB when using WinZip:
The fact that plain text compresses so efficiently can be used to great
advantage when deploying web applications as much web content is plain
text - for example HTML, JavaScript and CSS (cascading style sheets). All
modern Web Servers and Web Browsers have compression / decompression
algorithms built into them allowing content to be compressed while it is
transmitted over the network. Much like a user might zip a document and
email it to a colleague who then unzips it to use it, the Web Server can
compress content which the Browser than uncompresses before consuming
it.
The compression / decompression process does require additional CPU usage,
but the gain in bandwidth usage usually provides a net gain in overall
efficiency, especially in an application such as IBM Cognos 8 where the web
tier is rarely operating at full capacity as the application tier will usually be
the performance bottleneck.
Cognos Proprietary Information
Web Server Compression (IIS 6)
6
3 Configuring HTTP compression for IIS 6
This section contains the steps required to configure Microsoft Internet
Information Server (IIS) 6 to enable compression. Configuration partly takes
place in the IIS Configuration Console and partly by manually editing the Web
Server configuration file. It is important to note that these configuration
steps will affect the Web Server as a whole, and are designed with the IBM
Cognos 8 application specifically in mind. If the Web Server hosts additional
applications or content, the Web Server administrator should be engaged to
ensure the changes are appropriate or change them accordingly.
3.1
Backup the existing configuration
Before proceeding with adding the compression settings, the existing
configuration should be backed up so any changes can be easily reverted. To
do this launch the IIS Manager console, right-click on the web site you are
configuring and choose All Tasks Backup/Restore Configuration… :
Cognos Proprietary Information
Web Server Compression (IIS 6)
7
In the resulting dialog box, click the Create Backup… button and give your
backup a name then click OK to write the backup.
3.2
Enable Compression
In the IIS Manager Administration console right click on Web Sites and
choose Properties:
Cognos Proprietary Information
Web Server Compression (IIS 6)
8
In the properties dialog box select the Service tab and under the HTTP
compression section tick Compress application files and Compress
static files.
By default the temporary directory is set to %windir%\IIS Temporary
Compressed Files (this should already exist on your server). If you wish to
change this, you may do so. If you do choose an alternative location,
remember to ensure that the account IUSR_<machinename> that the IIS
service runs as has write permissions to it.
3.3
Allow the filter
IIS 6 security requires that the compression filter be explicitly enabled, to do
this right click on Web Service Extensions and then choose Add a new
Web service extension…
Cognos Proprietary Information
Web Server Compression (IIS 6)
Call it HTTP Compressor and browse to
c:\windows\system32\inetsrv\gzip.dll (where c:\windows is your
Windows install location). Tick the Set extension status to Allowed
option:
After clicking OK, you should see the new Web Service Extension listed:
Cognos Proprietary Information
9
Web Server Compression (IIS 6)
Cognos Proprietary Information
10
Web Server Compression (IIS 6)
3.4
11
Stop the Web Server Processes
This step will disable the Web Server, so be sure to perform it while the
system is not required.
From the Windows Services control panel stop the service IIS Admin
Service, you should be warned that World Wide Web Publishing Service
and HTTP SSL will also stop. Choose Yes.
These services need to be stopped because to finishing configuring
compression, the metabase.xml file needs to be edited which these
processes sometimes lock.
3.5
Specifying the files to be compressed
Open the file metabase.xml located in c:\windows\system32\inetsrv\
(where c:\windows\ is your Windows installation location) in Notepad or
some other text editor.
Search for the text <IIsCompressionScheme, there will be two entries,
one for deflate and one for gzip (these they are the two compression
methods that IIS supports). Both these sections must be edited to add the
file types we want the Web Server to compress.
Cognos Proprietary Information
Web Server Compression (IIS 6)
12
Under the entry HcFileExtensions you should see that the file types htm,
html and txt are already listed. This is the static Web Server content that
will be compressed. IBM Cognos 8 makes comprehensive use of JavaScript
and CSS files so these should be added. Additionally xml, xsl and dtd are all
text format files used by IBM Cognos 8 which will benefit from being
compressed. Accordingly, add the file types js, css, xml, xsl and dtd. Take
care to ensure that no additional spacing is inadvertently added to the file as
you edit it. Remember to edit both the deflate and gzip sections and
ensure they are both the same. Refer to the screenshots below to see how
the edited files should look.
The setting HcDynamicCompressionLevel controls how efficiently content
is compressed. The higher the value the smaller the resultant content is but
the greater the CPU use. The valid range is from 0 to 10 with the default
being 0. The CPU usage for levels 0 - 9 is fairly low but for level 10 it
increases dramatically, yet the compression for level 9 is nearly as good as
level 10. Accordingly, set the value to 9 - do this for both the deflate and
gzip sections.
The setting HcScriptFileExtensions specifies what dynamically generated
content will be compressed. It should be set to asp, dll and exe by default.
This means that traffic generated by the IBM Cognos 8 ISAPI gateway should
already be compressed (the executable being cognosisapi.dll ). It is worth
adding cgi to this list in case the cognos.cgi gateway is being used.
Because it is the cognos.cgi / cognosisapi.dll components that serve up
report output, any PDF, Excel output etc. will be compressed as a
consequence of setting the HcScriptFileExtensions correctly.
See the screenshots on the next page to confirm how the deflate and gzip
sections of the modified metabase.xml file should look.
Cognos Proprietary Information
Web Server Compression (IIS 6)
Cognos Proprietary Information
13
Web Server Compression (IIS 6)
14
After saving the file, restart the Web Services from the Windows Services
control panel that were stopped in step 3.4.
Test the Cognos 8 environment to be sure that the Web Server is still
functioning correctly. You can use Windows Explorer to look at the directory
%windir%\IIS Temporary Compressed Files (or wherever the location
was configured) to confirm that the static content appears there. You should
see files listed with names such as $^_gzip_D^^PROGRAM
FILES^COGNOS^C8^WEBCONTENT^CCL^HELPDOCS.JS
Cognos Proprietary Information
Web Server Compression (IIS 6)
15
4 Example bandwidth reduction
Using a tool such as IBM Page Detailer or one of many Firefox extensions the
traffic between Browser and Web Server can be traced to look at the
headers. For example examining the file cookie_jar.js, a file containing
various JavaScript functions, these are the Web Server response headers
both before and after compression is enabled:
Response headers before compression:
Content-Length
Content-Type
Last-Modified
Accept-Ranges
Etag
Server
X-Powered-By
Date
6215
application/x-javascript
Tue, 30 Jan 2007 01:33:00 GMT
bytes
"02e9b93e44c71:36f"
Microsoft-IIS/6.0
ASP.NET
Wed, 07 Mar 2007 17:19:46 GMT
Response headers after compression:
Content-Length
Content-Type
Content-Encoding
Last-Modified
Accept-Ranges
Etag
Vary
Server
X-Powered-By
Date
1989
application/x-javascript
gzip
Tue, 30 Jan 2007 01:32:58 GMT
bytes
"016a92e44c71:381"
Accept-Encoding
Microsoft-IIS/6.0
ASP.NET
Wed, 07 Mar 2007 17:31:49 GMT
By looking at the Content-Length you can see the compressed version is 4226
bytes smaller. Another file, rsapp.htm, is 870797 bytes before compression
and 329021 bytes after compression.
Opening the sample Go Sales and Retailers package in Cognos 8 Query
Studio using Firefox without compression enabled results in 1.39MB of traffic
– with compression turned on this is reduced to 0.32MB.
These tests were performed with all Browser caching disabled – forcing each
request for content to go back to the server every time. In a production
environment Browsers would usually cache some of the data for subsequent
requests, so the actual bandwidth gains may not be as comprehensive as
indicated above.
Cognos Proprietary Information
Web Server Compression (IIS 6)
16
5 Turning Compression Off
To turn compression on or off, go to the IIS Manager Administration console,
right click on Web Sites and choose Properties. In the properties dialog
box select the Service tab and under the HTTP compression section tick or
untick Compress application files and Compress static files (see section
3.2 for more details).
There is no need to revert the metabase.xml changes – if you disable
compression then the changes made in section 3.5 will simply be ignored.
Enabling compression again will pick the changes back up.
After changing the compression settings, stop and start the World Wide
Web Publishing Service to ensure the changes take effect.
6 Adobe PDF Issues
Occasionally turning on HTTP compression may cause issues with displaying
PDF’s generated from Cognos. Typically the Adobe Acrobat Reader
application will display the error “The file is damaged and could not be
repaired.” or “Expected a dict object”. Is this happens, the problem can
be resolved by removing the dll and cgi entries from the
HcScriptFileExtensions section of the metabase.xml file.
Removing these entries means that content generated from the cognos.cgi or
cognosisapi.dll gateways will no longer be compressed, resulting in higher
bandwidth usage. However the static content (as defined under
HcFileExtensions) will still be compressed, providing considerable savings
compared to no compression at all.
Cognos Proprietary Information
Fly UP