ASP.NET MVC Performance

2020-01-26 18:47发布

I found some wild remarks that ASP.NET MVC is 30x faster than ASP.NET WebForms. What real performance difference is there, has this been measured and what are the performance benefits.

This is to help me consider moving from ASP.NET WebForms to ASP.NET MVC.

14条回答
The star\"
2楼-- · 2020-01-26 19:23

The only concrete numbers I can find which are from early ASP.NET MVC-development is on this forum-thread:

http://forums.asp.net/p/1231621/2224136.aspx

Rob Connery himself somewhat confirms statement that ScottGu has claimed that ASP.NET MVC can serve 8000 requests per second.

Maybe Jeff and his crew can give some kind of hint from their development of this site.

查看更多
何必那么认真
3楼-- · 2020-01-26 19:25

My testing shows something between 2x and 7x more req/sec on MVC, but it depends how you build your webforms app. With just "hello world" text on it, without any server side control, mvc is around 30-50% faster.

查看更多
祖国的老花朵
4楼-- · 2020-01-26 19:26

The projects created with visual studio. One is mvc4 template, another is WebForm (tranditional). And when make load test with WCAT, this is the result,

MVC4 is quite slow than WebForms, any ideas?

enter image description here

MVC4

  • could get about 11 rps
  • rps is quite low both 2-cpu or 4-cpu server

enter image description here

WebForms (aspx)

  • could get above 2500 rps

  • the performance killer has been found that it's a bug of MVC Bata or RC. And The performance would be improved once i remove Bundles things. Now the latest version fixed this.

查看更多
贼婆χ
5楼-- · 2020-01-26 19:27

It decreased one of my pages from 2MB payload, to 200k, just by eliminating the viewstate and making it bearable programatically to work with the submitted output.

The size alone, even though the processing was the same will create vast improvements in connections per second and speed of the requests.

查看更多
我欲成王,谁敢阻挡
6楼-- · 2020-01-26 19:27

There's really no way to answer this. MVC uses the Web Forms view engine by default itself, and can be configured to use any number of custom view engines, so if you want a performance comparison you'll have to be more specific.

查看更多
Fickle 薄情
7楼-- · 2020-01-26 19:28

For me the real "performance" improvement in MVC is the increase the testable surface of the application. With WebForms there was a lot of the application that was hard to test. With MVC the amount of code that becomes testable basically doubles. Basically all that isn't easily testable is the code that generates the layout. All of your business logic and data access logic -- including the logic that populates the actual data used in the view -- is now amenable to testing. While I expect it to be more performant as well -- the page life cycle is greatly simplified and more more amenable to web programming -- even if it were the same or a little slower it would be worth switching to from a quality perspective.

查看更多
登录 后发表回答