首页 > 精选文章 > Linux > 正文

[proxy很慢]apache rewrite proxy性能测试

测试对象

RewriteRule ^/([0-9a-z])([0-9a-z])([0-9a-z])([0-9a-z]+)/(.*) /$1/$2/$3/$1$2$3$4/$5 [L]

这个规则的作用是:能把http://example.com/dummy/index.html重写到:DOCUMENTROOT/d/u/m/dummy/index.html,为了将大量文件(目录)散列。

测试过程

有rewrite,访问rewrite之后的URL

http_load -p 30 -s 60 tst.list
137829 fetches, 26 max parallel, 275658 bytes, in 60.0003 seconds
2 mean bytes/connection
2297.14 fetches/sec, 4594.28 bytes/sec
msecs/connect: 0.0604275 mean, 11.447 max, 0.021 min
msecs/first-response: 2.70699 mean, 1190.06 max, 0.305 min

有rewrite,直接访问rewrite之前的URL

http_load -p 30 -s 60 tst2.list
148477 fetches, 30 max parallel, 296954 bytes, in 60 seconds
2 mean bytes/connection
2474.62 fetches/sec, 4949.23 bytes/sec
msecs/connect: 0.058889 mean, 8.447 max, 0.02 min
msecs/first-response: 2.52814 mean, 1324.63 max, 0.298 min

无rewrite,直接访问rewrite之前的URL

http_load -p 30 -s 60 tst2.list
151920 fetches, 29 max parallel, 303840 bytes, in 60 seconds
2 mean bytes/connection
2532 fetches/sec, 5064 bytes/sec
msecs/connect: 0.0608508 mean, 153.375 max, 0.02 min
msecs/first-response: 2.35597 mean, 1091.58 max, 0.259 min

有rewrite,但通过proxy实现

http_load -p 30 -s 60 tst.list
58586 fetches, 30 max parallel, 117172 bytes, in 60.001 seconds
2 mean bytes/connection
976.417 fetches/sec, 1952.83 bytes/sec
msecs/connect: 0.0769494 mean, 100.978 max, 0.022 min
msecs/first-response: 8.93129 mean, 1190.54 max, 0.871 min

结论(草,待改)

测试是在一个FreeBSD虚拟机上进行的。测试结果的绝对数值偏小,但对得出上述结论没什么影响。

  • 上一篇:谷歌首次在中国大规模投户外广告
  • 下一篇:用Squid实现反向代理
  • 了解这些字:很的意思 慢的意思 性的意思 能的意思 测的意思 试的意思