[英]Optimising SQL Server 2008 Stored Procedures
Update 25/03/2011 I've marked this question as answered, while I don't yet have the specific answers to help improve the system I don't think it's fair to hold off until I've gone that far. 更新25/03/2011我已经将这个问题标记为已回答,而我还没有具体的答案来帮助改进系统我认为在我走得那么远之前推迟是不公平的。 The question was broad, and the answers have given me lots of pointers to help me on my way.
这个问题很广泛,答案给了我许多指导,帮助我顺利完成。 When I have more specific questions to ask i'll be back with those.
当我有更具体的问题要问我会回来的时候。 Unfortunately I can only mark one answer with the tick, but I want to thank everyone for their input, it's all been valuable, thanks for your time.
不幸的是,我只能用勾号标记一个答案,但我要感谢大家的意见,这一切都很有价值,谢谢你的时间。
Original Question 原始问题
Apologies in advance as this question is going to probably be quite broad! 提前道歉,因为这个问题可能会非常广泛!
I'm literally just about to step in to a project where one of our other developers has put together a massive system based around SQL Server 2008 Enterprise Edition, Reporting Services and Stored Procedures. 我真正准备介入一个项目,其中一个其他开发人员已经组建了一个基于SQL Server 2008企业版,Reporting Services和存储过程的大型系统。 What we've found in performance testing on a VM system (ie where SQL Server is running on a Windows Server 2008 R2 system hosted by VMWare1 ESXi) is that it does not appear to take advantage of extra memory or cores.
我们在VM系统上进行性能测试时发现的(即,在VMWare1 ESXi托管的Windows Server 2008 R2系统上运行SQL Server),它似乎没有利用额外的内存或内核。
As I get in to this project I was looking for some guidance about some initial outline questions: 当我进入这个项目时,我正在寻找关于一些初步大纲问题的一些指导:
Further, I guess the next obvious point is - what are the things I need to look out for in the code that might provide more insight to others as to how it's structured and allow me to provide more specific examples? 此外,我想下一个显而易见的一点是 - 在代码中我需要注意哪些事情可以为其他人提供更多洞察力,使其具体化并允许我提供更具体的示例? There are a lot of lines of code in the system, but obviously the ideal is to try and find a condensed example or pattern that demonstrates usage.
系统中有很多代码行,但显然理想的是尝试查找演示用法的精简示例或模式。
The Stored Procedures are, I believe, called by Reporting Services. 我相信,存储过程是由Reporting Services调用的。
In our tests it almost seems that it's linear execution - ie if we configure the VM with 2 cores, 2ghz CPU allocation, and 4gb of memory, if 1 report concurrently runs in 2 minutes, 2 will take nearly 4 minutes (ie twice the time for both reports), it's not quite as linear as that but close enough - everything gets slower almost as though they aren't really running in parallel at all. 在我们的测试中,它似乎是线性执行 - 即如果我们配置具有2个内核,2ghz CPU分配和4GB内存的VM,如果1个报告在2分钟内同时运行,则2将花费将近4分钟(即两倍的时间)对于这两个报告而言,它不是那么线性但足够接近 - 一切都变慢了,几乎就好像它们并没有真正并行运行。
Could it be SQL Server Reporting Services is simply only running reports one at a time or something related to that? 可能是SQL Server Reporting Services只是一次只运行一个报告或与之相关的东西吗?
Stored procedures are all developed in Transact-SQL. 存储过程都是在Transact-SQL中开发的。
Again, apologies for the broad question. 再次,为广泛的问题道歉。 If there's someone out there that can help educate me in how to get deeper and more knowledgeable in this area then that would be most appreciated!
如果有人在那里可以帮助教育我如何在这个领域获得更深入和更多的知识,那么这将是非常感激的!
Matt. 马特。
A couple of things to keep in mind 要记住几件事
EXEC sp_who2
and look at the BlkBy column EXEC sp_who2
并查看BlkBy列 Can you show some code, we can quickly look at it and tell you if we see red flag 你能展示一些代码,我们可以快速查看它并告诉你我们是否看到了红旗
if from the same connection you make two procedure calls, they will run consecutive. 如果从同一个连接中进行两次过程调用,它们将连续运行。 That is, one will run and when it is complete the next one will run.
也就是说,一个将运行,当它完成时,下一个将运行。
from one connection, if you a procedure and at the same time from a different connection run a procedure, they will run simultaneiosly, depending on locking conditions. 从一个连接,如果你是一个程序,同时从一个不同的连接运行一个程序,它们将同时运行,具体取决于锁定条件。
when it comes to virtualization, brent ozar is your best friend. 在虚拟化方面,布伦特盎司是你最好的朋友。 Virtualization Best Bractices
虚拟化最佳实践
Also, is the dat athe reports pulling optimized for the reports? 此外,报告的报告是否针对报告进行了优化? If not then it'll take a lot of processing on the sql side and report side to render the reports.
如果没有那么它将在sql端和报告端进行大量处理以呈现报告。 you might need to develop some sort of olap process if the oltp system is under a lot of use.
如果oltp系统有很多用途,你可能需要开发某种olap过程。 You also might consider cacheing the reports depending on the requirements for the reports.
您还可以考虑根据报告的要求缓存报告。
Another thing is to check to the max memory setting for sql server, if it's set to 2 gb max, adding antoher 4gb isn't going to do you a whole lot of good. 另一件事是检查sql server的最大内存设置,如果它设置为2 gb max,添加antoher 4gb并不会给你带来很多好处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.