简体   繁体   English

SQL 服务器是否自动将 memory 分配给所有实例?

[英]Does SQL Server automatically allocate memory to all instances?

I have a single instance of SQL Server on my server machine, with 80% of the memory reserved to it.我的服务器机器上有一个 SQL 服务器实例,其中 80% 的 memory 保留给它。 This is configured in the SQL Server max memory settings.这是在 SQL 服务器最大 memory 设置中配置的。

If I create an additional instance, will it use the reserved memory, or will it attempt to use the unallocated 10%?如果我创建一个额外的实例,它会使用保留的 memory,还是会尝试使用未分配的 10%?

Simply put, is the reserved memory used by SQL Server instance specific?简单来说就是SQL服务器实例所使用的预留memory是服务器实例特有的吗?

Max and Min Server Memory are NOT reservations.最大和最小服务器 Memory 不是保留。 It does not work the same way as eg VmWare with reservations.它的工作方式与保留的 VmWare 不同。

On startup, the instance only uses a minimum amount of memory - it does not grab the Min Server Memory amount immediately.启动时,实例仅使用最小数量的 memory - 它不会立即获取 Min Server Memory 数量。

In normal use, your instance will continue to use more memory as required until it reaches the Max Server Memory limit - but only if there is no external memory pressure signalled by Windows. In normal use, your instance will continue to use more memory as required until it reaches the Max Server Memory limit - but only if there is no external memory pressure signalled by Windows. If the system requests more memory, SQL Server will release this but will not release if it would drop below Min Server Memory.如果系统请求更多 memory,SQL 服务器将释放此,但如果它低于 Min 服务器 Memory 将不会释放。

Therefore if you are going to install more than 1 instance - you need to be careful in regards to the Min Server Memory and not set this so high that the sum of all Min Server Memory amounts plus the amount needed by the OS and other programs is more than the total physical memory available.因此,如果您要安装超过 1 个实例 - 您需要小心 Min Server Memory 并且不要将其设置得太高,以至于所有 Min Server Memory 数量的总和加上操作系统和其他程序所需的数量是多于可用的总物理 memory。 Also think about what is realistic for the Max Server memory - as one instance increases memory uses it may request other instances to release some memory back - possibly impacting performance of other instances.还要考虑一下 Max Server memory 的现实情况 - 随着一个实例的增加 memory 使用它可能会要求其他实例释放一些 memory 回来 - 可能会影响其他实例的性能。

You'll need to monitor what your instance actually needs - counters such as Page Life Expectancy can help give you an idea of how long pages stay in memory after loaded (ie is there memory pressure) which will help you identify the impact of lowering Max Server Memory for that instance.您需要监控您的实例实际需要什么 - Page Life Expectancy 等计数器可以帮助您了解加载后页面在 memory 中停留的时间(即是否存在 memory 压力),这将帮助您确定降低 Max 的影响该实例的服务器 Memory。

The performance characteristics of each database will affect what you configure.每个数据库的性能特征都会影响您的配置。

In saying that, in these days of virtualisation - I would tend to avoid multiple instances per server and simply spin up another VM for my new instance.话虽如此,在虚拟化的这些日子里——我倾向于避免每台服务器有多个实例,而只是为我的新实例启动另一个虚拟机。 That way I can have more control over the actual physical reservations for memory - but I still need to be aware of operations like ballooning if I over-allocate.这样我就可以更好地控制 memory 的实际物理保留 - 但如果我过度分配,我仍然需要注意像气球这样的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM