Windows Server 2008 R2 IIS7 上的 MVC2 性能
我正在一台功能强大的 Windows Server 2008 R2 服务器上的 IIS7 下部署 MVC2 应用程序。它连接到 SQL Server 2008 DB,并且应用程序性能比在开发人员工作站上的调试器中运行(连接到同一 SQL Server DB)时显着慢。我已经检查了网络连接,事件日志中没有任何内容表明 Windows 存在问题。我还在数据库服务器上运行了探查器,并且查询正在快速启动。
任何有关诊断此性能问题的帮助将不胜感激。我什至构建了一个新的 2008 R2 服务器来测试它,希望它是服务器本身,但性能是相同的。
谢谢
编辑 1:
IIS 运行在运行 Windows Server 2008 R2 Standard、32GB RAM 的 Dell R710 服务器上。 SQL Server 2008 托管在运行 Server 2008 R2 Standard、12GB RAM 的独立 R710 上。最初,我在虚拟机上运行 IIS,但我将其移至物理机,以查看性能下降是否是由于虚拟机造成的。我在两者上都经历了相同的性能,因此看起来这不是一个因素。
编辑2:
看来,打开与数据库的连接是瓶颈的一部分,随后存储过程的触发也花费了大量时间:
-打开数据库连接:5秒(后续连接是缓存,因此不需要 5 秒)
-第一个存储过程:< 1 秒
-第二个存储过程:5 秒 -
第三个存储过程:< 1 秒
- 第四个存储过程:< 1 秒
- 第五个存储过程:6 秒
I am deploying a MVC2 application under IIS7 on a Windows Server 2008 R2 server with plenty of horsepower. It's connecting to a SQL Server 2008 DB and the applications performance is dramatically slower than when running in the debugger on a developer workstation (connecting to the same SQL Server DB). I've already checked network connections and nothing in the eventlogs indicate an issue with Windows. I've also run the Profiler on the DB server and the queries are firing off fast.
Any help with diagnosing this performance issue would be appreciated. I've even built a new 2008 R2 server to test it on in hopes that it was the server itself but the performance was the same.
Thanks
Edit 1:
IIS is running on a Dell R710 server running Windows Server 2008 R2 Standard, 32GB ram. SQL Server 2008 is hosted on a separate R710 running Server 2008 R2 Standard, 12GB ram. Initially I had IIS running on a VM but I moved it to the physical machine to see if performance degradation was due to the VM. I'm experiencing the same performance on both so it looks like it wasn't a factor.
Edit 2:
It appears that opening the connection to the database is part of the bottleneck with the subsequent firing of stored procedures also taking a considerable amount of time:
-Open db connection: 5 sec (subsequent connections are cached so they don’t require 5 seconds)
-First sproc : < 1 sec
-Second sproc: 5 sec
-Third sproc: < 1 sec
-Fourth sproc: < 1 sec
-Fifth sproc: 6 sec
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,Windows Server 2008 R2具有IIS 7.5,而不是IIS7。可能没关系。然而,它是一个不同的版本。
其次,你需要找出瓶颈在哪里。尝试删除查询并仅使用虚拟数据。还慢吗?如果不是,那么它与数据访问无关。如果是,那么您就知道这是数据访问问题。
First, Windows Server 2008 R2 has IIS 7.5, not IIS7. Probably doesn't matter. However, it is a different version.
Second, you need to find out where the bottleneck is. Try removing the queries and just using dummy data. Is it still slow? If not, then it has nothing to do with the data access.. if so, then you know it's a data access issue.
以下是有关优化 ASP.NET MVC 应用程序的演示文稿中的幻灯片 。他们能够将应用程序的性能从 8 请求/秒提高到 400 请求/秒。
他们在幻灯片中提到了如何对其进行分析并识别瓶颈(查询编译、对 RenderPartial 的多次调用、url 生成等),并在演示结束时给出了一些提示。
Here are slides from a presentation about optimizing ASP.NET MVC applications. They were able to improve their app's performance from 8 req/sec to 400 req/sec.
They mention in the slides how they profiled it and identified bottlenecks (query compilation, many calls to RenderPartial, url generation etc.) and give some tips at the end of the presentation.