UNIX系のシステムでは、ファイルの持つタイムスタンプ情報に「修正時間」(mtime)、「作成時間」(ctime)、「アクセス時間」(atime)
情報があります。

touchコマンドでは-mオプションでmtimeを、-aオプションでatimeを更新できます。

ls -l で mtime、ls -lc で ctime、ls -lu で atime を表示することができます。

CODE:
  1. # ls -l *.txt
  2. -rw-r--r-- 1 root root 0  513 16:50 access.txt
  3. -rw-r--r-- 1 root root 0  513 16:50 modify.txt
  4. # touch -a access.txt
  5. # touch -m modify.txt
  6. # ls -lu *.txt
  7. -rw-r--r-- 1 root root 0  513 16:58 access.txt
  8. -rw-r--r-- 1 root root 0  513 16:50 modify.txt
  9. # ls -l *.txt
  10. -rw-r--r-- 1 root root 0  513 16:50 access.txt
  11. -rw-r--r-- 1 root root 0  513 16:58 modify.txt

非常にアクセス負荷の高い静的コンテンツ用のWWWサーバの場合はこのatimeに対する更新を無くしてやることで、負荷を下げること
ができます。

アクセス対象のファイルはこうなっています。

CODE:
  1. # ls -l *.html
  2. -rw-r--r-- 1 root root 44 1121  2004 index.html
  3. # ls -lu *.html
  4. -rw-r--r-- 1 root root 44  5月  8 17:56 index.html

ここでabで性能を確認しました。

3回実施した上で後の2回が以下の通り。

CODE:
  1. /usr/local/apache2/bin/ab -n 10000 -c 100 http://stockholm/
  2.  
  3. # /usr/local/apache2/bin/ab -n 10000 -c 100 http://stockholm/
  4. This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
  5. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  6. Copyright 2006 The Apache Software Foundation, http://www.apache.org/
  7.  
  8. Benchmarking stockholm (be patient)
  9. Completed 1000 requests
  10. Completed 2000 requests
  11. Completed 3000 requests
  12. Completed 4000 requests
  13. Completed 5000 requests
  14. Completed 6000 requests
  15. Completed 7000 requests
  16. Completed 8000 requests
  17. Completed 9000 requests
  18. Finished 10000 requests
  19.  
  20. Server Software:        Apache/2.2.4
  21. Server Hostname:        stockholm
  22. Server Port:            80
  23.  
  24. Document Path:          /
  25. Document Length:        44 bytes
  26.  
  27. Concurrency Level:      100
  28. Time taken for tests:   11.277795 seconds
  29. Complete requests:      10000
  30. Failed requests:        0
  31. Write errors:           0
  32. Total transferred:      2617830 bytes
  33. HTML transferred:       441320 bytes
  34. Requests per second:    886.70 [#/sec] (mean)
  35. Time per request:       112.778 [ms] (mean)
  36. Time per request:       1.128 [ms] (mean, across all concurrent requests)
  37. Transfer rate:          226.64 [Kbytes/sec] received
  38.  
  39. Connection Times (ms)
  40. min  mean[+/-sd] median   max
  41. Connect:        0   10  10.1      8      65
  42. Processing:    17  100  16.9    100     694
  43. Waiting:       16   72  25.6     79     658
  44. Total:         17  111  20.4    109     713
  45.  
  46. Percentage of the requests served within a certain time (ms)
  47. 50%    109
  48. 66%    114
  49. 75%    118
  50. 80%    121
  51. 90%    131
  52. 95%    139
  53. 98%    147
  54. 99%    154
  55. 100%    713 (longest request)
  56. # /usr/local/apache2/bin/ab -n 10000 -c 100 http://stockholm/
  57. This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
  58. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  59. Copyright 2006 The Apache Software Foundation, http://www.apache.org/
  60.  
  61. Benchmarking stockholm (be patient)
  62. Completed 1000 requests
  63. Completed 2000 requests
  64. Completed 3000 requests
  65. Completed 4000 requests
  66. Completed 5000 requests
  67. Completed 6000 requests
  68. Completed 7000 requests
  69. Completed 8000 requests
  70. Completed 9000 requests
  71. Finished 10000 requests
  72.  
  73. Server Software:        Apache/2.2.4
  74. Server Hostname:        stockholm
  75. Server Port:            80
  76.  
  77. Document Path:          /
  78. Document Length:        44 bytes
  79.  
  80. Concurrency Level:      100
  81. Time taken for tests:   11.428654 seconds
  82. Complete requests:      10000
  83. Failed requests:        0
  84. Write errors:           0
  85. Total transferred:      2610000 bytes
  86. HTML transferred:       440000 bytes
  87. Requests per second:    874.99 [#/sec] (mean)
  88. Time per request:       114.287 [ms] (mean)
  89. Time per request:       1.143 [ms] (mean, across all concurrent requests)
  90. Transfer rate:          222.95 [Kbytes/sec] received
  91.  
  92. Connection Times (ms)
  93. min  mean[+/-sd] median   max
  94. Connect:        0   42  30.3     41     104
  95. Processing:    25   70  18.0     68     117
  96. Waiting:        1   39  24.8     38     108
  97. Total:         25  113  17.1    113     217
  98.  
  99. Percentage of the requests served within a certain time (ms)
  100. 50%    113
  101. 66%    120
  102. 75%    126
  103. 80%    129
  104. 90%    136
  105. 95%    140
  106. 98%    144
  107. 99%    145
  108. 100%    217 (longest request)

Requests per second: 880.845 (平均)

index.htmlのタイムスタンプは以下の通りで確かに
atimeは更新されています。

CODE:
  1. # ls -l *.html
  2. -rw-r--r-- 1 root root 44 1121  2004 index.html
  3. # ls -lu *.html
  4. -rw-r--r-- 1 root root 44  513 17:08 index.html

atimeの更新は、/etc/fstabのマウントオプションとして「noatime」を指定することで無効化できる。

LABEL=/ / ext3 defaults,noatime 1 1

atimeの更新を無効化すると、mountコマンドで「noatime」と表示されます。

$ mount
/dev/hda1 on / type ext3 (rw,noatime)
(省略)

上記を設定した上で、再度以下を実施しました。

CODE:
  1. # /usr/local/apache2/bin/ab -n 10000 -c 100 http://stockholm/
  2. This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
  3. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  4. Copyright 2006 The Apache Software Foundation, http://www.apache.org/
  5.  
  6. Benchmarking stockholm (be patient)
  7. Completed 1000 requests
  8. Completed 2000 requests
  9. Completed 3000 requests
  10. Completed 4000 requests
  11. Completed 5000 requests
  12. Completed 6000 requests
  13. Completed 7000 requests
  14. Completed 8000 requests
  15. Completed 9000 requests
  16. Finished 10000 requests
  17.  
  18. Server Software:        Apache/2.2.4
  19. Server Hostname:        stockholm
  20. Server Port:            80
  21.  
  22. Document Path:          /
  23. Document Length:        44 bytes
  24.  
  25. Concurrency Level:      100
  26. Time taken for tests:   11.135027 seconds
  27. Complete requests:      10000
  28. Failed requests:        0
  29. Write errors:           0
  30. Total transferred:      2610000 bytes
  31. HTML transferred:       440000 bytes
  32. Requests per second:    898.07 [#/sec] (mean)
  33. Time per request:       111.350 [ms] (mean)
  34. Time per request:       1.114 [ms] (mean, across all concurrent requests)
  35. Transfer rate:          228.83 [Kbytes/sec] received
  36.  
  37. Connection Times (ms)
  38. min  mean[+/-sd] median   max
  39. Connect:        0    0   1.4      0      24
  40. Processing:    11  110 367.6     82    9107
  41. Waiting:       11   90 125.6     82    8169
  42. Total:         11  110 367.6     82    9107
  43.  
  44. Percentage of the requests served within a certain time (ms)
  45. 50%     82
  46. 66%     83
  47. 75%     84
  48. 80%     84
  49. 90%     92
  50. 95%    106
  51. 98%    109
  52. 99%    747
  53. 100%   9107 (longest request)
  54. # /usr/local/apache2/bin/ab -n 10000 -c 100 http://stockholm/
  55. This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
  56. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  57. Copyright 2006 The Apache Software Foundation, http://www.apache.org/
  58.  
  59. Benchmarking stockholm (be patient)
  60. Completed 1000 requests
  61. Completed 2000 requests
  62. Completed 3000 requests
  63. Completed 4000 requests
  64. Completed 5000 requests
  65. Completed 6000 requests
  66. Completed 7000 requests
  67. Completed 8000 requests
  68. Completed 9000 requests
  69. Finished 10000 requests
  70.  
  71. Server Software:        Apache/2.2.4
  72. Server Hostname:        stockholm
  73. Server Port:            80
  74.  
  75. Document Path:          /
  76. Document Length:        44 bytes
  77.  
  78. Concurrency Level:      100
  79. Time taken for tests:   11.79239 seconds
  80. Complete requests:      10000
  81. Failed requests:        0
  82. Write errors:           0
  83. Total transferred:      2610000 bytes
  84. HTML transferred:       440000 bytes
  85. Requests per second:    902.59 [#/sec] (mean)
  86. Time per request:       110.792 [ms] (mean)
  87. Time per request:       1.108 [ms] (mean, across all concurrent requests)
  88. Transfer rate:          229.98 [Kbytes/sec] received
  89.  
  90. Connection Times (ms)
  91. min  mean[+/-sd] median   max
  92. Connect:        0    0   1.4      0      24
  93. Processing:    11  109 294.7     89    9563
  94. Waiting:       11   96 152.2     88    9563
  95. Total:         11  109 294.7     89    9563
  96.  
  97. Percentage of the requests served within a certain time (ms)
  98. 50%     89
  99. 66%     90
  100. 75%     91
  101. 80%     92
  102. 90%     94
  103. 95%    104
  104. 98%    110
  105. 99%    693
  106. 100%   9563 (longest request)

Requests per second: 900.33 (平均)

1%と非常にわずかですが確かにチューニング効果はあるようです。
実際にatimeが必要になる局面が想定できないなら、やってみても
良い気がします。

それと確かにatimeは更新されていません。

CODE:
  1. # ls -lu *.html
  2. -rw-r--r-- 1 root root 44  513 17:08 index.html

※この調査はCentOS5+apache2.2.4で実施しました。
サーバのスペックはかなり低いものです。