Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 407|回复: 0

SQLServer 2012异常问题(二)--由安装介质引发性能问题

[复制链接]
  • TA的每日心情
    奋斗
    2024-11-24 15:47
  • 签到天数: 804 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726782
    发表于 2021-6-1 09:54:12 | 显示全部楼层 |阅读模式

    问题描述:生产环境一个数据库从SQLSERVER 2008 R2升级到SQLSERVER 2012 ,同时更换硬件,但迁移后发现性能明显下降,应用写入、读取性能下降的比较厉害;

     

    向微软寻求帮助后得出答案,原来这与SQLSERVER的安装介质有关。

    大致意思是说由于NUMA架构可以自行管理内存池,在安装了CAL的EE后,由于限制只能使用20个cores,同样内存则只能管理到20个cores涉及到的NUMA的对应的内存空间(具体算法为 限制内存=当前物理内存/NUMA数量*(总核数/20)),如果限制SQL Server的最大使用内存超过前面说的限制内存,则当使用内存大于限制内存需要再向操作系统再申请空间时,则会产生跨NUMA处理的情况,导致大量消耗系统资源,引起性能下降;

     

    http://blogs.msdn.com/b/saponsqlserver/archive/2012/06/15/sql-server-2012-enterprise-editions.aspx

    这是我在网上找到的解释,摘录其中几段(本人E文水平有限,翻译不当之处敬请见谅)

    关于SQLSERVER EE的安装介质(EE为Enterprise Editions简拼,企业版)

    • SQL Server EE is no longer being offered under the Server + CAL (Client Access License) licensing model. For customers with Software Assurance on existing SQL EE Server licenses (or access to them under their current Enterprise Agreements during term) a version of Enterprise Edition was created to enable them to upgrade to SQL Server 2012. This version has technical restrictions limiting an instance to using only 20 processor cores (40 CPU threads with Hyperthreading).. Customers must still have the proper version of the CAL and additional physical and virtual use right restrictions of this SKU (Stock Keeping Unit) apply. Please refer to the three documents listed above for additional details.
    • An Enterprise Edition which is licensed per core and which does not have limits on the # of cores usable on a server (within the absolute limits supported). This Enterprise Edition does reflect the new licensing model for SQL Server Enterprise Edition.

    上面说到 即便是SQLSERVER EE,由于授权方式的差异导致对processor cores的限制

    For customers with Software Assurance on existing SQL EE Server licenses

    An Enterprise Edition which is licensed per core and which does not have limits on the # of cores usable on a server

    通过以下方式可以检查当前运行的SQL EE信息

    1、sp_readerrorlog ,第一行显示SQLSERVER 版本信息如下

    2012-05-08 16:04:54.56 Server      Microsoft SQL Server 2012 - 11.0.2100.60 (X64)

                 Feb 10 2012 19:39:15

                 Copyright (c) Microsoft Corporation

    Enterprise Edition (64-bit)on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)

    2、select serverproperty('Edition') ,显示版本信息如下

    Enterprise Edition (64-bit)

    如何判断当前的SQL EE是基于per CAL还是per core的呢?如果显示的信息如上所示,那就是基于per CAL的,文中再次强调此模式下受限于20 cores;

    Answer is: It is the CAL licensed one and with that the Enterprise Edition which is limited to 20 cores!!!

    而如果显示的信息如下所示,那就是基于per core的 则没有限制;

    The per-core licensed Enterprise Edition will show like this:

    2012-05-18 23:57:29.77 Server Microsoft SQL Server 2012 - 11.0.2100.60 (X64)

    Feb 10 2012 19:39:15

    Copyright (c) Microsoft Corporation

    Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)

     Executing:

    select serverproperty('Edition')

    which then could show this result:

    Enterprise Edition: Core-based Licensing (64-bit)

     

    关于20 cores的限制问题,需要区分CPU是否支持超线程而言

    Other indications that there might be a limitation to 20 cores could be identified as well at the beginning of the SQL Server 2012 errorlog where we can find a message like:

    SQL Server detected 4 sockets with 6 cores per socket and 6 logical processors per socket, 24 total logical processors; using 20 logical processors based on SQL Server licensing.

    In the case above, we are looking at a server with the last generation of Intel processors which did not have Hyperthreading yet. Or in more modern Intel Servers with Hyperthreading it would look like:

    SQL Server detected 4 sockets with 8 cores per socket and 16 logical processors per socket, 64 total logical processors; using 40 logical processors based on SQL Server licensing.

    上文中的描述,根据SQL Server 2012 errorlog中的内容,我们可以看到

    如果SQL Server 检测到 4个插槽,每个插槽有6个核,且有6个逻辑处理器(单线程),则总共为24个逻辑处理器,受限于SQL Server licenseing,只能使用20个逻辑处理器;

    对于超线程CPU:

    如果SQL Server 检测到 4个插槽,每个插槽有8个核,且有16个逻辑处理器(单线程),则总共为64个逻辑处理器,受限于SQL Server licenseing,只能使用40个逻辑处理器;

     

    Another possibility of discovery is through the Microsoft MAP toolkit. Where to get it and how to use it is excellently described in this document: http://download.microsoft.com/download/F/F/2/FF29F6CC-9C5E-4E6D-85C6-F8078B014E9F/Determining_SQL_Server_2012_Core_Licensing_Requirements_at_SA_Renewal_Apr2012.pdf

    另外一种可能的发现是通过Microsoft MAP toolkit,可以在以下这个文档中得到更准确的描述;

    ---------------------------华丽丽的分割线---------------------------------------

    How is the throttle of 20 cores enforced for the CAL license-based Enterprise Edition?

    The limitation or the cap is enforced by the # of SQL Server schedulers. Usually SQL Server creates one scheduler thread for every logical CPU on a server. Each of those scheduler threads is administrating a pool of worker threads which execute requests or are in different other states. A scheduler only can have one thread running at maximum. If a scheduler thread over all of the time has one of worker threads running, it can leverage at maximum one logical CPU and not a bit more. If there are (as in the second situation above) only 40 schedulers active to schedule worker threads, the maximum number of CPU power we can use at any given time is 40 logical CPUs.

    Querying sys.dm_os_schedulers with this query:

    select * from sys.dm_os_schedulers

    we will realize that the all the schedulers are ‘Visible’ for all the logical CPUs, but only 40 of them will be ‘Online’, whereas the others are ‘Offline’

    If you disable Hyperthreading, the number of schedulers being Online will decline to 20, since one single core is now represented by one CPU thread only compared to two with Hyperthreading enabled. In cases where there are many more CPU threads or logical CPUs than the limit of the Server+CAL licensed SQL Server 2012 Enterprise Edition, one certainly can use affinity mask settings to chose the CPUs SQL Server shall use.

    通过sys.dm_os_schedulers这个DMV可以查询到SQL Server调度线程的情况;

     

    如何在EE的两个不同的产品间变更?在下面的链接中可以找到答案

    http://msdn.microsoft.com/zh-cn/library/ms143393.aspx

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2025-1-23 12:14 , Processed in 0.067575 second(s), 30 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表