Subject: Practical results show that the trick #1 is mazing
Author: EricJ
In response to: Step 3) Enable GZIP compression to speed up your web page
Posted on: 10/05/2012 03:08:18 PM
Just applying the trick #1 "Take advantage of caching to save the trips for static contents", most pages of my website are already triple faster. Here is what I put:
<IfModule mod_expires.c>
### activate mod_expires
ExpiresActive On
### Expire ALL IMAGES 1 month from when they're accessed
ExpiresByType image/* A2592000
## Expire .css's 1 month from when they're accessed
ExpiresByType text/css "access 1 month"
### Expire everything else 1 day from when it's last modified
ExpiresDefault "modification plus 1 day"
### Apply a Cache-Control header to index.html
<Files index.html>
Header append Cache-Control "max-age=3600, must-revalidate"
</Files>
</IfModule>
Here is what I got:
+-----------------------------------------------------------------+
| | | Time | Requests | Bytes In |
+-----------------------------------------------------------------+
| Base line | First View | 1.470s | 11 | 130 KB |
|-----------------------------------------------------------------|
| Before trick #1 | Repeat View | 1.001s | 11 | 2 KB |
| After trick #1 | Repeat View | 0.122s | 0 | 0 KB |
+-----------------------------------------------------------------+
Observations:
The trips from client to server in order to form the webpage (gif,css,etc) has dropped significantly from 11 to 0.
Even though the repeat view trips bring essentially no pay-load but 304 Not Modified, as evidenced by 2 KB, the useless trips still takes decent amount of time to bother the server.
The speed says it all by witnessing 1.001s vs. 0.122s.
Conclusion: Trick #1 "Take advantage of caching" is a win-win situation for both user and server: user feels much faster whileas server saves a lot of bandwidth.
>
> On 12/14/2011 02:16:41 AM WebSpider wrote:
Compress everything except images
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>
Request Header:
GET /css/layout.css HTTP/1.1
Accept-Encoding: gzip, deflate
Response Header:
HTTP/1.1 200 OK
Content-Encoding: gzip
References: