SQL Server 2k5的内存消耗?

时间:2020-03-05 18:43:23  来源:igfitidea点击:

我有一个正在运行sql server的开发虚拟机以及用于堆栈的其他一些应用程序,但我发现其他应用程序的运行情况非常差。进行一些挖掘之后,SQL Server占用了内存。经过快速的网络搜索后,我发现默认情况下,它会消耗尽可能多的内存,以便缓存数据并将其按其他应用程序的要求返回给系统,但是显然,此过程通常不会足够快地进行我的情况是一个普遍的问题。

但是,有一种方法可以限制SQL Server允许的内存。我的问题是,我应该如何设置此限制。显然,我需要进行一些猜测和检查,但是是否存在绝对最小阈值?任何建议表示赞赏。

编辑:

我会注意到,开发人员机器具有2 GB的内存,因此,我希望能够在768 mb或者更小的内存上运行vm。该虚拟机将仅用于本地开发和测试,因此负载将非常小。在本地对代码进行测试之后,它会转到另一个专用于SQL Server的环境。我在这里真正要寻找的是关于最低要求的建议

解决方案

回答

so id like to be able to run the vm on
  768 mb or less if possible.

那将取决于数据和数据库的大小。但是我通常希望给SQL Server至少一个GB

回答

这实际上取决于机器上还发生了什么。让事情在典型的负载下运行,并查看任务管理器,以了解其他所有需求。尝试以该号码开头。

当然,对于生产机器,最好将机器的控制权交给Sql Server(处理器-> Boost Sql Server Priority),并让它拥有所需的所有RAM。

由于我们使用的是VM,也许我们可​​以为Sql Server创建一个专用的虚拟机,然后在其他VM上运行其他所有内容。

回答

由于这是一个开发环境,因此我同意Greg的观点,只是使用反复试验即可。使其完全正确并不是那么关键。

但是,如果我们在VM中做了很多工作,为什么不给它至少2GB的一半呢?

回答

从SQL Server文档中摘录:

Maximum server memory (in MB)
  
  Specifies the maximum amount of memory
  SQL Server can allocate when it starts
  and while it runs. This configuration
  option can be set to a specific value
  if you know there are multiple
  applications running at the same time
  as SQL Server and you want to
  guarantee that these applications have
  sufficient memory to run. If these
  other applications, such as Web or
  e-mail servers, request memory only as
  needed, then do not set the option,
  because SQL Server will release memory
  to them as needed. However,
  applications often use whatever memory
  is available when they start and do
  not request more if needed. If an
  application that behaves in this
  manner runs on the same computer at
  the same time as SQL Server, set the
  option to a value that guarantees that
  the memory required by the application
  is not allocated by SQL Server.

最低建议是:否。内存越多越好。 SQL Sever需要尽可能多的内存,否则将浪费IO。

停止SQL Server。运行其他应用程序,并注意它们所需的内存量。从总可用RAM中减去该值,然后将该数字用于SQL Server中的最大内存设置。