Requirements Testing

August 16th, 2007

You are currently browsing the articles from TechToolBlog written on August 16th, 2007.

YSlow & Improving Speed

Yahoo! came out with a FireBug addon - YSlow, that takes a look at your web page and offers a score on performance. Most of the recommendations are easy enough to follow, below are 3 that take some Apache httpd.conf hacking to get working:

1) Configure ETags

Add this to your httpd.conf

FileETag MTime Size

 

2) Turn on Expiration Headers

# Turn on Expires and set default to 0

ExpiresActive On

ExpiresDefault A7200

 

# Set up caching on media files for 1 year

<FilesMatch “\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$”>

ExpiresDefault A29030400

</FilesMatch>

 

# Set up caching on media files for 1 week

<FilesMatch “\.(gif|jpg|jpeg|png|swf)$”>

ExpiresDefault A604800

</FilesMatch>

 

# Set up 24 Hour caching on commonly updated files

<FilesMatch “\.(xml|txt|html|php|js|css)$”>

ExpiresDefault A86400

</FilesMatch>

 

3) Add Gzip compression

Install mod_gzip for Apache, add this to your httpd.conf to configure mod_gzip to handle files/settings

<IfModule mod_gzip.c>

 mod_gzip_on Yes

mod_gzip_can_negotiate Yes

mod_gzip_static_suffix .gz

AddEncoding gzip .gz

mod_gzip_update_static No

mod_gzip_command_version ‘/mod_gzip_status’

mod_gzip_keep_workfiles No

mod_gzip_minimum_file_size 512

mod_gzip_maximum_file_size 1048576

mod_gzip_maximum_inmem_size 60000

mod_gzip_min_http 1000

mod_gzip_handle_methods GET POST

 

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^httpd/unix-directory$

mod_gzip_item_include file \.shtml$

mod_gzip_item_include file \.html$

mod_gzip_item_include mime ^application/x-javascript$

mod_gzip_item_include mime ^application/javascript$

mod_gzip_item_include file \.js$

mod_gzip_item_include file \.css$

mod_gzip_item_include mime ^application/x-httpd-php$

mod_gzip_item_include file \.php$

mod_gzip_item_include handler ^cgi-script$

 

mod_gzip_dechunk Yes

 

# DO NOT WASTE TIME COMPRESSING IMAGES

mod_gzip_item_exclude mime ^image/.$

mod_gzip_item_exclude mime ^image/

mod_gzip_item_exclude rspheader Content-Type:image/*

</IfModule>

 That’s it, those 3 changes improved my score from F (60) to a respectable B (81).

image

Written by Tim on August 16th, 2007 with 1 comment.
Read more articles on unix and web 2.0 ish.