开启.htaccess重写规则对吞吐率的影响

关闭.htaccess

D:\xampp\apache\bin>ab -n 10000 -c 100 http://www.test.com/test.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.test.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        Apache/2.2.22
Server Hostname:        www.test.com
Server Port:            80

Document Path:          /test.php
Document Length:        0 bytes

Concurrency Level:      100
Time taken for tests:   41.672 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1880000 bytes
HTML transferred:       0 bytes
Requests per second:    239.97 [#/sec] (mean)
Time per request:       416.724 [ms] (mean)
Time per request:       4.167 [ms] (mean, across all concurrent requests)
Transfer rate:          44.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.9      1      16
Processing:   141  412  24.3    413     838
Waiting:      127  412  23.9    413     520
Total:        143  414  24.2    415     839

Percentage of the requests served within a certain time (ms)
  50%    415
  66%    418
  75%    421
  80%    422
  90%    427
  95%    433
  98%    459
  99%    492
 100%    839 (longest request)

开启.htaccess

D:\xampp\apache\bin>ab -n 10000 -c 100 http://www.test.com/test.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.test.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        Apache/2.2.22
Server Hostname:        www.test.com
Server Port:            80

Document Path:          /test.php
Document Length:        0 bytes

Concurrency Level:      100
Time taken for tests:   42.438 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      1880000 bytes
HTML transferred:       0 bytes
Requests per second:    235.64 [#/sec] (mean)
Time per request:       424.380 [ms] (mean)
Time per request:       4.244 [ms] (mean, across all concurrent requests)
Transfer rate:          43.26 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.0      1      65
Processing:   140  420  31.5    419     789
Waiting:      126  420  31.3    419     727
Total:        142  422  31.5    420     791

Percentage of the requests served within a certain time (ms)
  50%    420
  66%    426
  75%    430
  80%    432
  90%    439
  95%    457
  98%    519
  99%    541
 100%    791 (longest request)

通过AB压力测试可以发现,未开启htaccess是吞吐率为239.97,开启htaccess吞吐率为235.64。
每秒相差4.33,对性能有稍微影响,但是影响不大,实际上htaccess受规则的影响很大,结果可能会更糟糕,建议多次测试取平均。

此条目发表在web服务器, 服务器应用分类目录,贴了, 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注