Subject: Step 2) Use Keep-Alive to avoid excess connections
Author: WebSpider
In response to: Simple steps to speed up web page -- server side settings
Posted on: 12/10/2011 02:10:56 PM
Keep-Alive is active only with files where the length is known beforehand. This means that most CGI scripts, server-side included files and directory listings will not use the Keep-Alive protocol.
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
Request Header:
GET /css/layout.css HTTP/1.1
Connection: Keep-Alive
Response Header:
HTTP/1.1 200 OK
Content-Length: 1408
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
>
> On 12/09/2011 07:37:41 PM
WebSpider wrote:
1) Take advantage of caching to save the trips for static contents.
Use Expires or Cache-Control:
<IfModule mod_expires.c>
### activate mod_expires
ExpiresActive On
### Expire .gif's 1 month from when they're accessed
ExpiresByType image/gif A2592000
### Expire .jpg's 1 month from when they're accessed
ExpiresByType image/jpg "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>
Request Header:
Accept-Encoding gzip,deflate,sdch
Accept-Language en-US,en;q=0.8
Connection keep-alive
Pragma no-cache
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.3
Host www.mycompany.com
User-Agent Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/535.8 (KHTML, like
Gecko) Chrome/17.0.942.0
Safari/535.8
Accept */*
Cache-Control no-cache
Referer http://www.mycompany.com/
Response Header:
Date Thu, 24 Nov 2011 00:05:36 GMT
Connection close
Content-Length 83016
Last-Modified Mon, 19 Sep 2005 05:31:21 GMT
Server Apache/2.2.21 (Amazon)
ETag "22e65-14448-4011940dedc40"
Content-Type image/gif
Accept-Ranges bytes
Cache-Control max-age=2592000
Expires Sat, 24 Dec 2011 00:26:20 GMT
References: