株式会社スタイルズ
http://nosa.cocolog-nifty.com/sanonosa/2004/06/keepalive.html
バーチャルホストごとに設定
ちなみに、KeepAlive の設定は、Apache であればバーチャルホストごとに変えることができます。
VirtualHost ディレクティブの中に、KeepAlive Off とすれば、オフになります
ファイルごとに設定
SetEnvIf Request_URI "^/aaa/bbb\.html$" nokeepalive
nokeepalive
This disables KeepAlive when set.Environment Variables in Apache - Apache HTTP Server Version 2.4
KeepAlive 設定状況
【KeepAlive Off】
http://www.livedoor.com/
http://www.yahoo.co.jp/
【KeepAlive On】
http://d.hatena.ne.jp/
Keep-Alive: timeout=7, max=5
2013
最後に大手サイトのKeep-Aliveの状況をまとめてみました(いずれもPCアクセス)。
【KeepAlive On】
livedoor.com
infoseek.jp(JS関連)
pathtraq.com【KeepAlive Off】
iGoolge
yahoo.co.jp
はてぶ
excite.co.jp
mixi.jp
gree.jp
mbga.jp
2010
KeepAliveTimeout 2秒
KeepAliveTimeout 2
Apache2系 5
そのときに出てきたのが、Apache HTTP ServerでKeepAliveTimeoutを2秒に設定しているという話です。
ftp-adminの憂鬱: KeepAliveTimeoutは2秒
○はてなダイアリー
Keep-Alive: timeout=7, max=5○アメブロ
Keep-Alive: timeout=1, max=100○livedoor
Keep-Alive: timeout=2, max=16○楽天ブログ
Keep-Alive: timeout=15, max=97○ココログ
Keep-Alive: timeout=5, max=32
2009
MaxKeepAliveRequests
Apacheパフォーマンス・チューニングの実践 (2/2):ApacheによるWebサーバ構築(16) - @IT
MaxKeepAliveRequests(デフォルトは100)には1ページ当たりの平均的なファイル数+α程度を設定し、KeepAliveTimeoutにはデフォルト(15秒)よりも小さい値を設定するのがいいだろう。
1セッションで処理すれば効率があがる。
KeepAlive 弊害
Safari ファイルアップロード 失敗
# fix upload issues with Safari BrowserMatch "Safari" nokeepalive
Safariからのファイルアップロードに失敗する時の対処法(Apacheの設定)
Safariからのファイルアップロードする先のサーバで、ApacheのKeepAliveをOffにすると、このトラブルが発生しなくなります。
Apacheのhttpd.confの適切な場所に、下記の一行を追加して、Apacheの再起動を行ってください。(setenvif_moduleが有効になっている前提でです)
BrowserMatch "Safari" nokeepalive