I had an argument with one of my friends who is an architect at a pretty large internet company. Basically he was saying that ASP.NET MVC is not for large-scale enterprise applications, that it is not as flexible as WebForms, and that an MVC app will be slower than a web forms app.
我和一个朋友发生了争执,他是一家相当大的互联网公司的架构师。基本上他说的是ASP。NET MVC不适合大型企业应用程序,它不像WebForms那样灵活,而且MVC应用程序比web forms应用程序要慢。
From my own experience working with MVC, I can say that it is more flexible and it is lighter weight because there is no page life cycle, viewstate, etc.. It should thus load faster at the very least. As far as I know, MVC is designed for medium to large scale traffic.
根据我使用MVC的经验,我可以说它更灵活,重量更轻,因为没有页面生命周期、viewstate等等。因此,它至少应该加载得更快。据我所知,MVC是为中型到大型流量而设计的。
What do you guys think? Has anyone compared speed and performance? And is ASP.NET MVC better for large scale apps than ASP.NET WebForms?
你们怎么看?有人比较过速度和性能吗?ASP。NET MVC比ASP更适合于大型应用。净WebForms吗?
In short, between these two choices, which would you choose to use for a large scale enterprise application?
简而言之,在这两个选项中,您将选择哪个用于大型企业应用程序?
4 个解决方案
#1
29
- Development Speed: WebForms
- 发展速度:WebForms
- Performance Speed: MVC
- 性能速度:MVC
- Ease of Use: WebForms (Typically)
- 易于使用:WebForms(通常)
- Unit Testing: MVC (Typically)
- 单元测试:MVC(一般)
#2
7
This site is a best example of ASP.net MVC's performance and scaling
这个站点是ASP.net MVC性能和扩展的最佳示例
Some features which I think which is necessary for Enterprise and which MVC provides are
我认为对于企业和MVC提供的一些特性是必要的
-
Unit testing - even though it takes time to implement this initially it saves lots of time in the future
单元测试——尽管最初实现它需要时间,但它在未来节省了很多时间
-
Separation of Concerns - this really improves development and modification speed
关注点分离——这确实提高了开发和修改速度
-
Performance - since both MVC and Webforms use the same ASP.net as the core framework and MVC is lighter and HTTP compliant it gives you better performance
性能——因为MVC和Webforms使用相同的ASP.net作为核心框架,而MVC更轻,并且兼容HTTP,所以性能更好
#3
4
I think MVC is a lighter framework, and more performant because it doesn't do a lot of the things that the WebForms framework does out of the box, like viewstate for example. I don't think it would be fair to say that MVC is not for larger scale applications, as it probably scales better than WebForms would in terms of performance. In terms of out of the box features, WebForms does more for you because it handles state between posts for you, via viewstate, etc.
我认为MVC是一个更轻量级的框架,而且性能更好,因为它不像WebForms框架那样做很多事情,比如viewstate。我不认为说MVC不适合更大的应用程序是公平的,因为它可能比WebForms的性能更好。就开箱即用的特性而言,WebForms为您做的更多,因为它为您处理文章之间的状态,通过viewstate等等。
I don't have any links to performance comparisons with me, but I would be extremely surprised if there aren't any out there. Even microsoft probably has some.
我与我的性能比较没有任何联系,但是如果没有的话,我会非常惊讶。甚至微软也可能有。
#4
1
The groupthink and cargocult programming is strong in this thread. Your architect friend is both right (probably for the wrong reasons) and wrong at the same time.
在这个线程中,groupthink和cargocult编程非常强大。您的架构师朋友既是对的(可能是由于错误的原因),也是错的。
that it is not as flexible as WebForms
它没有WebForms灵活
This is just silly. You can do anything with anything. They are both incredibly flexible. In terms of flexiblity MVC is likely the clear winner here as you can easily achieve Aspect Orientated Programming (AOP) using ActionFilters. Another reason MVC is likely the winner here is that dependency injection is thought of in MVC. You can have inversion of control and dependency injection in WebForms but it requires complex implementations involving the Model-View-Presenter pattern.
这是愚蠢的。你可以做任何事。它们都非常灵活。就灵活性而言,MVC很可能是明显的赢家,因为您可以使用actionfilter轻松实现面向方面的编程(AOP)。MVC很可能是赢家的另一个原因是依赖注入在MVC中被考虑。您可以在WebForms中进行控制反转和依赖注入,但是它需要复杂的实现,包括模型-视图-演示者模式。
MVC app will be slower than a web forms app.
MVC应用程序将比web forms应用程序慢。
This is invalid to claim, as written. Any application can be written slower comparatively as it's a complex process involving many aspects to reach an end product. However, in terms of raw speed. Webforms is substantially faster. https://*.com/a/20253243/37055
这是无效的要求,如书面的。任何应用程序都可以编写得比较慢,因为要达到最终产品,这是一个涉及许多方面的复杂过程。然而,就原始速度而言。Webforms明显更快。https://*.com/a/20253243/37055
it is lighter weight because there is no page life cycle, viewstate, etc.. It should thus load faster at the very least
它的重量更轻,因为没有页面生命周期、viewstate等。因此,它至少应该加载得更快
This is also an invalid statement to make. Page life cycle is irrelevant in all aspects because there are corollary life cycles in MVC in regards to controllers and action filters. View state is interesting... if you choose to stuff 100s and 1000s of kilobytes of data into view state requiring every postback to the server to have 1MB-5MB request, yes it will obviously be faster to do nearly anything differently. This isn't webforms fault, nevertheless webforms allows you to fall into the pit of failure very easily with viewstate.
这也是一个无效的声明。在所有方面,页面生命周期都是不相关的,因为在MVC中有关于控制器和操作过滤器的必然的生命周期。视图状态是有趣的……如果您选择将100s和1000s的数据填充到视图状态,要求对服务器的每个回发都有1MB-5MB的请求,显然,以不同的方式进行操作会更快。这不是webforms的错误,但是webforms允许您很容易地在viewstate中陷入失败的深渊。
is ASP.NET MVC better for large scale apps than ASP.NET WebForms?
是ASP。NET MVC比ASP更适合于大型应用。净WebForms吗?
No. Yet the answer to this question "is ASP.NET WebForms for large scale apps than ASP.NET WebForms ?" The answer is also No. The answer is no, because the answer is always it depends. Every framework has pros/cons and you need to measure those, there is not definitive answers.
不。然而,这个问题的答案是“ASP”。NET WebForms用于大型应用而非ASP。答案也是否定的。答案是否定的,因为答案总是要视情况而定。每个框架都有利弊,你需要衡量它们,没有确定的答案。
If you're building a content driven site who's job is to have the fastest possible page load times such as www.microsoft.com then you might very well choose webforms.
如果你正在建立一个内容驱动的网站,你的工作是拥有最快的页面载入时间,比如www.microsoft.com,那么你就可以选择webforms。
which would you choose to use for a large scale enterprise application?
对于大型企业应用程序,您会选择使用哪一种?
First, you very likely don't have this problem. You would not be in a position to ask this question if you were truly responsible to architect a large scale enterprise application. (or the hiring process didn't actually require large scale development experience).
首先,你很可能没有这个问题。如果您真正负责架构一个大型企业应用程序,您将无法提出这个问题。(或者招聘过程实际上并不需要大规模的开发经验)。
In terms of a large scale application the framework you choose is almost meaningless. Large scale applications are built on queuing. They will leverage tools such as MSMQ either directly or through a servicebus such as: Mass Transit, Azure Service Bus, or NServiceBus. Only with queuing can you reach the scale to handle millions of requests the way Amazon, Ebay and every other major player does.
对于大型应用程序,您选择的框架几乎毫无意义。大型应用程序构建在队列之上。它们将直接或通过服务总线(如:公共交通、Azure服务总线或NServiceBus)利用诸如MSMQ之类的工具。只有通过排队,你才能像亚马逊(Amazon)、Ebay和其他所有主要玩家一样处理数百万次请求。
#1
29
- Development Speed: WebForms
- 发展速度:WebForms
- Performance Speed: MVC
- 性能速度:MVC
- Ease of Use: WebForms (Typically)
- 易于使用:WebForms(通常)
- Unit Testing: MVC (Typically)
- 单元测试:MVC(一般)
#2
7
This site is a best example of ASP.net MVC's performance and scaling
这个站点是ASP.net MVC性能和扩展的最佳示例
Some features which I think which is necessary for Enterprise and which MVC provides are
我认为对于企业和MVC提供的一些特性是必要的
-
Unit testing - even though it takes time to implement this initially it saves lots of time in the future
单元测试——尽管最初实现它需要时间,但它在未来节省了很多时间
-
Separation of Concerns - this really improves development and modification speed
关注点分离——这确实提高了开发和修改速度
-
Performance - since both MVC and Webforms use the same ASP.net as the core framework and MVC is lighter and HTTP compliant it gives you better performance
性能——因为MVC和Webforms使用相同的ASP.net作为核心框架,而MVC更轻,并且兼容HTTP,所以性能更好
#3
4
I think MVC is a lighter framework, and more performant because it doesn't do a lot of the things that the WebForms framework does out of the box, like viewstate for example. I don't think it would be fair to say that MVC is not for larger scale applications, as it probably scales better than WebForms would in terms of performance. In terms of out of the box features, WebForms does more for you because it handles state between posts for you, via viewstate, etc.
我认为MVC是一个更轻量级的框架,而且性能更好,因为它不像WebForms框架那样做很多事情,比如viewstate。我不认为说MVC不适合更大的应用程序是公平的,因为它可能比WebForms的性能更好。就开箱即用的特性而言,WebForms为您做的更多,因为它为您处理文章之间的状态,通过viewstate等等。
I don't have any links to performance comparisons with me, but I would be extremely surprised if there aren't any out there. Even microsoft probably has some.
我与我的性能比较没有任何联系,但是如果没有的话,我会非常惊讶。甚至微软也可能有。
#4
1
The groupthink and cargocult programming is strong in this thread. Your architect friend is both right (probably for the wrong reasons) and wrong at the same time.
在这个线程中,groupthink和cargocult编程非常强大。您的架构师朋友既是对的(可能是由于错误的原因),也是错的。
that it is not as flexible as WebForms
它没有WebForms灵活
This is just silly. You can do anything with anything. They are both incredibly flexible. In terms of flexiblity MVC is likely the clear winner here as you can easily achieve Aspect Orientated Programming (AOP) using ActionFilters. Another reason MVC is likely the winner here is that dependency injection is thought of in MVC. You can have inversion of control and dependency injection in WebForms but it requires complex implementations involving the Model-View-Presenter pattern.
这是愚蠢的。你可以做任何事。它们都非常灵活。就灵活性而言,MVC很可能是明显的赢家,因为您可以使用actionfilter轻松实现面向方面的编程(AOP)。MVC很可能是赢家的另一个原因是依赖注入在MVC中被考虑。您可以在WebForms中进行控制反转和依赖注入,但是它需要复杂的实现,包括模型-视图-演示者模式。
MVC app will be slower than a web forms app.
MVC应用程序将比web forms应用程序慢。
This is invalid to claim, as written. Any application can be written slower comparatively as it's a complex process involving many aspects to reach an end product. However, in terms of raw speed. Webforms is substantially faster. https://*.com/a/20253243/37055
这是无效的要求,如书面的。任何应用程序都可以编写得比较慢,因为要达到最终产品,这是一个涉及许多方面的复杂过程。然而,就原始速度而言。Webforms明显更快。https://*.com/a/20253243/37055
it is lighter weight because there is no page life cycle, viewstate, etc.. It should thus load faster at the very least
它的重量更轻,因为没有页面生命周期、viewstate等。因此,它至少应该加载得更快
This is also an invalid statement to make. Page life cycle is irrelevant in all aspects because there are corollary life cycles in MVC in regards to controllers and action filters. View state is interesting... if you choose to stuff 100s and 1000s of kilobytes of data into view state requiring every postback to the server to have 1MB-5MB request, yes it will obviously be faster to do nearly anything differently. This isn't webforms fault, nevertheless webforms allows you to fall into the pit of failure very easily with viewstate.
这也是一个无效的声明。在所有方面,页面生命周期都是不相关的,因为在MVC中有关于控制器和操作过滤器的必然的生命周期。视图状态是有趣的……如果您选择将100s和1000s的数据填充到视图状态,要求对服务器的每个回发都有1MB-5MB的请求,显然,以不同的方式进行操作会更快。这不是webforms的错误,但是webforms允许您很容易地在viewstate中陷入失败的深渊。
is ASP.NET MVC better for large scale apps than ASP.NET WebForms?
是ASP。NET MVC比ASP更适合于大型应用。净WebForms吗?
No. Yet the answer to this question "is ASP.NET WebForms for large scale apps than ASP.NET WebForms ?" The answer is also No. The answer is no, because the answer is always it depends. Every framework has pros/cons and you need to measure those, there is not definitive answers.
不。然而,这个问题的答案是“ASP”。NET WebForms用于大型应用而非ASP。答案也是否定的。答案是否定的,因为答案总是要视情况而定。每个框架都有利弊,你需要衡量它们,没有确定的答案。
If you're building a content driven site who's job is to have the fastest possible page load times such as www.microsoft.com then you might very well choose webforms.
如果你正在建立一个内容驱动的网站,你的工作是拥有最快的页面载入时间,比如www.microsoft.com,那么你就可以选择webforms。
which would you choose to use for a large scale enterprise application?
对于大型企业应用程序,您会选择使用哪一种?
First, you very likely don't have this problem. You would not be in a position to ask this question if you were truly responsible to architect a large scale enterprise application. (or the hiring process didn't actually require large scale development experience).
首先,你很可能没有这个问题。如果您真正负责架构一个大型企业应用程序,您将无法提出这个问题。(或者招聘过程实际上并不需要大规模的开发经验)。
In terms of a large scale application the framework you choose is almost meaningless. Large scale applications are built on queuing. They will leverage tools such as MSMQ either directly or through a servicebus such as: Mass Transit, Azure Service Bus, or NServiceBus. Only with queuing can you reach the scale to handle millions of requests the way Amazon, Ebay and every other major player does.
对于大型应用程序,您选择的框架几乎毫无意义。大型应用程序构建在队列之上。它们将直接或通过服务总线(如:公共交通、Azure服务总线或NServiceBus)利用诸如MSMQ之类的工具。只有通过排队,你才能像亚马逊(Amazon)、Ebay和其他所有主要玩家一样处理数百万次请求。