性能重新编程网站在MVC3与实体框架 [英] Performance reprogramming website in MVC3 with Entity Framework

查看:186
本文介绍了性能重新编程网站在MVC3与实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有一个相当大的网站,每天约有1万人次。

At the moment I have a fairly big website with about 10k visitors a day.

这是一个社区网站,新闻/博客/视频和一个大论坛。

This is a community website with news/blogs/videos and a big forum.

本上的表现faily以及一个自制的PHP5应用程序的所有运行,具有良好的性能。该数据库是MySQL5.1数据库。

This all runs on a self made PHP5 application which performance faily well, has good performance. The database is a MySQL5.1 database.

现在我得到fedup PHP和松散的类型化框架,缺少命名空间的和适当的MVC设置,所以我想重写ASP.NET MVC3的网站。

Now I am getting fedup with PHP and the loose typed framework, lack of namespacing and a proper MVC setup, so I am thinking of rewriting the site in MVC3 ASP.NET.

现在我有这方面的经验,但不是在MVC框架着呢,我对性能,尤其是实体框架的几个问题:
它甚至值得使用实体框架?这将花费开销和性能沦落的很多?我不知道但如果我应该切换到MSSQL。

Now I have experience with this, but not in the MVC framework yet, and I have a few questions about the performance, especially the Entity Framework: Is it even worth using the entity framework? Will it cost alot of overhead and performance degration? I am not sure yet if I should switch to MSSQL.

推荐答案

在使用类似的 EF或NHibernate的你总是要住的权衡性能和便利之间。如果你可以用一个比较糟糕的表现生活(我想应该是可能的瓦特/ ORM的运行您的网站)的NHibernate应您的第一选择,从我的角度来看,是比较成熟的,而EF仍然缺乏提供商的支持,并有一些不足之处就在develevopment工作流程(使用NHibernate时,而不是使用MS工具时,你可能期望的那样)。

When using an ORM like EF or NHibernate you always have to live with the trade-off between performance and convenience. If you can live with a relatively bad performance (I think it should be possible to run your site w/ an ORM) NHibernate should your first choice, from my point of view it is more mature while EF is still lacking provider support and has some shortcomings with respect to the develevopment workflow (which you possibly expect when using NHibernate but not when using a MS tool).

如果你从PHP切换到.NET你应该考虑从MySQL切换到MSSQL,只是因为它完全适合到MS生态系统(和性能/可扩展性也应该被提高,使用时这可能可能outweight你经验研究的性能下降企业风险管理)。

If you switch from PHP to .NET you should consider switching from MySQL to MSSQL, just because it fits perfectly into the MS ecosystem (and performance/scalability should be improved too, this could possibly outweight the performance degradation you expierence when using an ERM).

您也可以看看LINQ这可能是一个经典的ORM和硬codeD SQL命令(也相对于性能之间的替代性,的 LINQ to SQL是pretty快速并使用EF的时候,你也可以使用LINQ Entitiy框架(那pretty慢))。 LINQ会适合你的需要,如果你想抽象wihtout需要无尽的配置一定水平,如果你喜欢RAD(谁不?)。

You could also take a look at LINQ which could be an alternative between a classic ORM and hard coded SQL commands (also with respect to the performance, LINQ to SQL is pretty fast and you can also use LINQ to Entitiy Framework when using EF (thats pretty slow)). LINQ would fit your needs if you want some level of abstraction wihtout the need of endless configuration and if you like RAD (who doesn't?).

在ASP.NET一般MVC3的表现也相当不错,但你应该知道,你需要一些经验来调整你的应用程序,并避免(通用)的陷阱。切割长话短说:你应该能够轻松地写出具有比PHP脚本网页(设计)更好的性能ASP.NET应用程序

In general the performance of ASP.NET MVC3 is quite good, but you should know that you need some experience to tweak your application and avoid (common) pitfalls. Cutting a long story short: You should be easily able to write an ASP.NET application that has a better performance than a scripted PHP page (by design)

但你也应该知道,如果你决定自己提交到MS生态系统(.NET,MSSQL瓦特/ LINQ / EF)它很难突破和提供商LINQ和EF非MS RDBMS可能花费一些钱(检查 www.devart.com )。

But you should also know, if you decide to commit yourself to the MS ecosystem (.NET, MSSQL w/ LINQ/EF) its hard to break out and providers for LINQ and EF for non-MS RDBMS might cost some bucks (check www.devart.com).

希望这给你一些指导

延伸阅读:

  • ORM wars: Comparing nHibernate, LINQ To SQL & the Entity Framework
  • NHibernate vs Entity Framework: a performance test
  • NHibernate vs. Entity Framework 4.0

这篇关于性能重新编程网站在MVC3与实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆