作者:敖士伟
一、环境
1.主机
win2003 sp2(CPU E2160双核 2G RAM),.net 3.5 sp1,asp.net mvc 2
2.测试机
win7 旗舰版 64bit(i5 4G RAM),apache ab.exe 2.3
3.网络
100M以太
二、代码
代码都是直接输出"Hello world!",无其它html输出
1.MVC
public ActionResult Index()
{
ViewData["Message"] = "Hello world!";
return View();
}
2.winForm
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello world!");
}
三、结果
1.第一组并发10个用户
(1)MVC
Requests per second: 868.11 [#/sec] (mean)
Time per request: 11.519 [ms] (mean)
Time per request: 1.152 [ms] (mean, across all concurrent requests)
Transfer rate: 235.68 [Kbytes/sec] received
(2)winForm
Requests per second: 953.84 [#/sec] (mean)
Time per request: 10.484 [ms] (mean)
Time per request: 1.048 [ms] (mean, across all concurrent requests)
Transfer rate: 232.87 [Kbytes/sec] received
2.第二组并发50个用户
(1)MVC
Requests per second: 803.40 [#/sec] (mean)
Time per request: 62.235 [ms] (mean)
Time per request: 1.245 [ms] (mean, across all concurrent requests)
Transfer rate: 218.29 [Kbytes/sec] received
(2)winForm
Requests per second: 965.03 [#/sec] (mean)
Time per request: 51.812 [ms] (mean)
Time per request: 1.036 [ms] (mean, across all concurrent requests)
Transfer rate: 235.66 [Kbytes/sec] received
四、结果分析
winForm比MVC快14%
(((965.03+953.84)/2)/((803.40+868.11)/2)-1)*100%
MVC在url_routing过程中应该消耗的资源较多