ASP.NET MVC Performance

后端 未结 14 958
花落未央
花落未央 2020-11-29 17:10

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 performanc

相关标签:
14条回答
  • 2020-11-29 17:34

    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.

    0 讨论(0)
  • 2020-11-29 17:35

    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.

    0 讨论(0)
  • 2020-11-29 17:36

    Contrary to the accepted opinion, optimized webforms usage completely kills MVC in terms of raw performance. Webforms has been hyper-optimized for the task of serving html far longer than MVC has.

    Metrics are available on http://www.techempower.com/benchmarks/#section=data-r7&hw=i7&test=db

    Every single comparison mvc is on the lower-middle/lower-upper rankings of the list, while optimized webforms usage places in the upper-middle/upper-lower rankings.

    Anecdotal but very serious validation to these metrics, www.microsoft.com is served by webforms not MVC. Does anyone here believe that they wouldn't have chosen MVC if it was empirically faster?

    0 讨论(0)
  • 2020-11-29 17:36

    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.

    0 讨论(0)
  • 2020-11-29 17:36

    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.

    0 讨论(0)
  • 2020-11-29 17:42

    I think that many of the people who think that WebForms are inherently slow or resource intensive are placing the blame in the wrong place. 9 times out of 10 when I am brought in to optimize a webforms app there are way too many places where the apps authors misunderstand the purpose of the viewstate. I'm not saying that the viewstate is perfect or anything, but it is WAY too easy to abuse it, and it is this abuse that is causing the bloated viewstate field.

    This article was invalueable in helping me understand many of these abuses. https://weblogs.asp.net/infinitiesloop/truly-understanding-viewstate

    In order to make a valid comparison between MVC and WebForms we need to be sure that both apps are using the architectures correctly.

    0 讨论(0)
提交回复
热议问题