Hi,
How can I determine compression ratio for a specific web page in IIS 7.5? Thank you
Hi,
How can I determine compression ratio for a specific web page in IIS 7.5? Thank you
Every page will have a different compression ratio, depending on it's content. The easiest way to check the compression ratio is to simply download the page twice, once compressed and once uncompressed, and compare the results.
The easiest way to do this is the 'Accept-encoding' header, which specifies which encodings a client can cope with. If you include gzip, IIS will compress the page.
This can be done in the language of your choice. The language of my choice is python:
import urllib2
url = 'http://www.example.com/the-page-to-test.aspx'
c = len(urllib2.urlopen(urllib2.Request(url, headers={"Accept-Encoding": "gzip"}) ).read())
p = len(urllib2.urlopen(urllib2.Request(url)).read())
ratio = float(p)/float(c)
print("Compression ratio is 1:%.2f" % ratio)
It can be typed into an interactive python session, or saved into a .py file and run.