sql server 性能

SQL Server Performance Tuning can be a difficult assignment, especially when working with a massive database where even the minor change can raise a significant impact on the existing query performance. Performance Tuning always plays a vital role in database performance as well as product performance. A query can be optimized with the proper evaluation of a piece of code or SQL Statements. The important thing in Query Optimization is to understand, which process or expression needs evaluation in the piece of code. Everyone expects to get a quick response from the query on the production, but How?

SQL Server性能调优可能是一项艰巨的任务,尤其是在处理大型数据库时,即使是很小的更改也会对现有查询性能产生重大影响。 性能调优在数据库性能以及产品性能中始终扮演着至关重要的角色。 可以通过对一段代码或SQL语句进行适当的评估来优化查询。 查询优化中的重要内容是了解代码中哪个过程或表达式需要评估。 每个人都希望从生产查询中得到快速响应,但是如何呢?

Performance Tuning deals with the specifics about the Server, Client, Design & Architecture, Database Engine, Hardware & Network design. As the initial step of SQL Server configuration, we need to calculate the required Buffer Memory (RAM), Storage, CPU’s, etc. Different types of hardware are available with various quality in the market to perform the best. The below image represents what hardware configurations are required to be monitored to observe the performance.

性能调优处理有关服务器,客户端,设计和体系结构,数据库引擎,硬件和网络设计的细节。 作为SQL Server配置的第一步,我们需要计算所需的缓冲内存(RAM),存储,CPU等。市场上有各种质量不同的硬件可供选择,以发挥最佳性能。 下图表示需要监视哪些硬件配置才能观察性能。

Managing the hardware for SQL Server is not the only goal to get high performance with the SQL Server. But systematic designing and monitoring are required to make it available for better long-term performance as well. If database architecture requirement is to configure multiple SQL Server instances in the single machine, then the Database engineer has to calculate and design the plan for hardware allocation according to the usage.

管理SQL Server的硬件并不是获得SQL Server高性能的唯一目标。 但是还需要进行系统的设计和监控,以使其具有更好的长期性能。 如果数据库体系结构要求是在一台计算机上配置多个SQL Server实例,则数据库工程师必须根据用途计算和设计硬件分配计划。

Below you will find the critical performance parameters for performance tuning with different categories.

您将在下面找到用于不同类别的性能调优的关键性能参数。

RAM或缓冲存储器 (RAM or Buffer Memory)

SQL Server loads the data into the RAM, which is processed before processing or returning to the client. What should be the RAM value for the SQL Server? Buffer memory should be of a size that is enough to maintain active data of your database. Query logic and data manipulation of each SQL request will be performed in the RAM for better performance unless fetching all data from the data page and manipulating it. If your SQL Server is not configured with enough RAM, then the older cache will be removed, and new active data will be kept in the buffer memory. Each edition and version of SQL server has different criteria for the Memory Allocation (RAM).

SQL Server将数据加载到RAM中,然后在处理或返回客户端之前先对其进行处理。 SQL Server的RAM值应该是多少? 缓冲存储器的大小应足以维护数据库的活动数据。 除非从数据页中获取所有数据并对其进行操作,否则将在RAM中执行每个SQL请求的查询逻辑和数据操作,以提高性能。 如果您SQL Server没有配置足够的RAM,则较旧的缓存将被删除,新的活动数据将保留在缓冲存储器中。 每个版本SQL Server都有不同的内存分配(RAM)标准。

SQL Server allows configuring the memory by a server property. SQL Server buffer memory can be configured with two parameters, Minimum server memory, and Maximum server memory. Minimum memory allocation will consume the (n) MB memory for buffer when the SQL Server service starts. Maximum memory will be the highest memory allocation for a buffer to the SQL Server as memory available from the hardware.

SQL Server允许通过服务器属性配置内存。 可以使用两个参数(最小服务器内存和最大服务器内存)配置SQL Server缓冲内存。 SQL Server服务启动时,最小的内存分配将占用(n)MB的内存作为缓冲区。 最大内存将是为SQL Server缓冲区提供的最大内存分配,作为可从硬件获得的内存。

处理器(CPU) (Processor (CPU))

Multithreading by processors improves the performance of parallel SQL Server thread executions. SQL Server allows specifying the processor sockets (Numa Nodes) with the cores and their Logical CPUs for the processing affinity and I/O affinity. A socket is the numa node at the hardware side; the dual-core processor will have two logical CPU’s and the quad-core will have four logical CPUs. The user system and laptop have a single socket, and servers use multiple sockets to boost performance.

处理器的多线程处理提高了并行SQL Server线程执行的性能。 SQL Server允许使用内核及其逻辑CPU指定处理器套接字(Numa节点)以实现处理亲和力和I / O亲和力。 套接字是硬件端的numa节点; 双核处理器将具有两个逻辑CPU,四核将具有四个逻辑CPU。 用户系统和便携式计算机具有单个插槽,服务器使用多个插槽来提高性能。

Users can configure the CPU allocation by the server properties. By default, an automatic option will be selected for allocating the processor to SQL Server dynamically as available to process the task. While unchecking the automatic option, the user will be allowed to specify the logical CPUs for the SQL Server thread process and I/O operations.

用户可以通过服务器属性配置CPU分配。 默认情况下,将选择一个自动选项,以将处理器动态分配给SQL Server,以用于处理任务。 取消选中自动选项时,将允许用户为SQL Server线程进程和I / O操作指定逻辑CPU。

IO / IOPS(每秒输入/输出操作) (IO / IOPS (Input/output operations per second))

Most of us know I/O stands for Input/output and IOPS stands for the Input/output per second. IOPS clearly defines a ratio of the number of operations performed by storage within a period to the duration of this period in seconds, and it is the unit to measure read and write operations on the storage device. There are many parameters of IO, which can affect the SQL Server performance and that needs to be taken care of for the performance tuning.

我们大多数人都知道I / O代表输入/输出,而IOPS代表每秒的输入/输出。 IOPS明确定义了一段时间内存储执行的操作数与该时间段持续时间之比(以秒为单位),它是衡量存储设备上的读写操作的单位。 IO有许多参数,这些参数会影响SQL Server的性能,因此在进行性能调整时需要注意这些参数。

  • IOPS Calculation

    IOPS计算

    Several Read/Write operations on the Disk. Different types of disks can have different IOPS length

    磁盘上的几个读/写操作。 不同类型的磁盘可以具有不同的IOPS长度

  • Average Disk Queue Length

    平均磁盘队列长度

    Each hardware can perform a limited number of Read/Write operation per second, but if storage has more IO requests than the maximum limit, then that threads or request will be in Disk Queue. It happens when massive read/write operations are being performed parallel to the routine task. So, this average disk queue needs to be monitored for performance tuning

    每个硬件每秒只能执行有限数量的读/写操作,但是如果存储的IO请求超过最大限制,则该线程或请求将位于磁盘队列中。 当与例行任务并行执行大量读/写操作时,就会发生这种情况。 因此,需要监视此平均磁盘队列以进行性能调整

  • Read Vs. Write Operation Ratio

    对比 写操作率

    Performance tuning for a Read and Write operation is different. Based on the nature of product operation, hardware quality can be decided. If write operations are very high, then the user can choose the premium hardware to perform the best IOPS with better SAN box cache

    读取和写入操作的性能调整是不同的。 根据产品操作的性质,可以确定硬件质量。 如果写入操作非常高,则用户可以选择高级硬件来执行具有更好的SAN盒缓存的最佳IOPS。

  • Average IO Latency

    平均IO延迟

    The standard reading says that read operation should be completed in less than 15ms, and Write operation should be completed in less than 25ms. If average IO latency is higher than this reading, then disk queue and hardware performance need to be verified

    标准读取表示读取操作应在不到15ms的时间内完成,而写入操作应在不到25ms的时间内完成。 如果平均IO延迟高于此读数,则需要验证磁盘队列和硬件性能

    • Read < 15ms读取<15ms
    • Write < 25ms写<25ms
  • Split IO

    分割IO

    A physical disk can be partitioned in the logic disk with the drive letters. We follow Infra standard with the distribution of the data into the multiple logical drives, which in turn organize the IO. Still, each drive may not have the same average IOPS calculation. Therefore, the operation team has to monitor the disk wise IO to track the usage of Physical and Logical disk

    可以使用驱动器号在逻辑磁盘中对物理磁盘进行分区。 我们遵循Infra标准,将数据分配到多个逻辑驱动器中,这些逻辑驱动器又组织了IO。 但是,每个驱动器可能没有相同的平均IOPS计算。 因此,操作团队必须监视明智的磁盘IO,以跟踪物理磁盘和逻辑磁盘的使用情况

  • RAID Level

    RAID级别

    RAID configuration is most likely to be used for installed applications on storage, which means you are using multiple disks for reliability and redundancy. Write operations can be powerfully penalized by some RAID operations. At least six disk operations are required for every writes request in RAID level 6 while, only two disk operations are needed for RAID levels 1 and 10. To sum up all this, we can say that the lower the number of disk operations, the higher the IOPS capacity

    RAID配置很可能用于存储中已安装的应用程序,这意味着您正在使用多个磁盘来提高可靠性和冗余性。 一些RAID操作可能会严重影响写入操作。 RAID级别6的每个写入请求至少需要六个磁盘操作,而RAID级别1和10则仅需要两个磁盘操作。总而言之,我们可以说磁盘操作数越少,磁盘操作数就越高。 IOPS容量

    Basically, RAID Levels are the concept of data striping and mirroring with storage. Below is the list of RAID levels that are implementing by the organizations

    基本上,RAID级别是数据条带化和存储镜像的概念。 以下是各组织正在实施的RAID级别的列表

    • RAID 0 (Data Striping)RAID 0(数据分条)
    • RAID 1 (Data Mirroring)RAID 1(数据镜像)
    • RAID 4 (Data Striping with the Parity Information)RAID 4(带有奇偶校验信息的数据分条)
    • RAID 5 (Data Striping with the Parity Information distribution on all disks)RAID 5(在所有磁盘上具有奇偶校验信息分布的数据分条)
    • RAID 6 (Data Striping with the Double Parity Information for better data redundancy)RAID 6(具有双奇偶校验信息的数据分条可提供更好的数据冗余)
    • RAID 10 ([RAID 1 + RAID 0] = [Mirroring + Striping] – Hybrid RAID)RAID 10([RAID 1 + RAID 0] = [镜像+条带化–混合RAID)

磁盘性能 (DISK Performance)

Physical Disk and Logical Disk both can be used in Infra standard. Logical Disk is the logical partitions of the physical disk with the drive letter. The logical disk is used to distribute the data into multiple logical units. Each disk has the IOPS life with the (n) number of total IOPS. When it crosses this digit, disk refreshment may be required to maintain the performance. Therefore, the operational team performs tech-refresh with updating the hardware on the server. Bytes per Second Disk IO is also one of the performance parameters for the disk. Different quality disks have various capacities to perform in a range of IO per second on disk.

物理磁盘逻辑磁盘均可在Infra标准中使用。 逻辑磁盘是带有驱动器号的物理磁盘的逻辑分区。 逻辑磁盘用于将数据分配到多个逻辑单元中。 每个磁盘的IOPS寿命为(n)总IOPS数。 当它超过此数字时,可能需要刷新磁盘以保持性能。 因此,运营团队通过更新服务器上的硬件来执行技术更新。 每秒字节数磁盘IO也是磁盘的性能参数之一。 不同质量的磁盘具有各种容量,可以在磁盘上以每秒IO的范围执行。

With the increasing use of application and engine, a lake of hardware assets degrades the SQL Server performance. The basic knowledge of hardware performance tuning can help Database Administrators to monitor and improve the SQL Server performance.

随着应用程序和引擎使用的增加,大量的硬件资产降低了SQL Server的性能。 硬件性能调优的基本知识可以帮助数据库管理员监视和改善SQL Server性能。

These monitors and metrics are also costly while fetching details in a predefined polling period. So, configure the detailed monitor for the server, but it should be available when its basic monitors alert the critical situation. Nowadays, many third-party monitors are available in the industry with the configurable parameter to set up as required.

在预定义的轮询周期中获取详细信息时,这些监视器和度量标准也很昂贵。 因此,为服务器配置详细的监视器,但是当其基本监视器警告紧急情况时,该监视器应该可用。 如今,行业中有许多第三方监视器,它们具有可配置的参数,可以根据需要进行设置。

结论 (Conclusion)

Performance Tuning at the hardware level isn’t a simple assignment for the users. Users can gain that expertise when an issue happens with the hardware resources and solve it with the challenging investigation. And that is the reason, it is a good practice to have a strong Technical Operation team in an organization.

对于用户而言,在硬件级别进行性能调优并不是一项简单的任务。 当硬件资源出现问题时,用户可以获得专业知识,并通过具有挑战性的调查来解决问题。 这就是原因,在组织中拥有强大的技术运营团队是一个好习惯。

翻译自: https://www.sqlshack.com/sql-server-hardware-performance-tuning/

sql server 性能

sql server 性能_SQL Server硬件性能调整相关推荐

  1. sql server 性能_SQL Server性能基础

    sql server 性能 "The goal of monitoring databases is to assess how a server is performing. Effect ...

  2. sql server 跟踪_SQL Server跟踪标志指南; 从-1到840

    sql server 跟踪 SQL Server trace flags are configuration handles that can be used to enable or disable ...

  3. sql数据库性能指标_SQL Server磁盘性能指标–第1部分–最重要的磁盘性能指标

    sql数据库性能指标 memory and 内存和processor metrics. These metrics indicate system and SQL Server performance ...

  4. sql server 群集_SQL Server群集索引概述

    sql server 群集 This article targets the beginners and gives an introduction of the clustered index in ...

  5. sql tempdb清理_SQL Server 2019内存优化的TempDB元数据

    sql tempdb清理 In this article, I will walk you through the new feature in SQL Server 2019, memory-opt ...

  6. sql server 面试_SQL Server审核面试问题

    sql server 面试 In this article, we will discuss a number of common and important SQL Server Audit que ...

  7. sql数据透视_SQL Server中的数据科学:取消数据透视

    sql数据透视 In this article, in the series, we'll discuss understanding and preparing data by using SQL ...

  8. sql server 别名_SQL Server别名概述

    sql server 别名 This article gives an overview of SQL Server Alias and its usage for connecting with S ...

  9. 2008 r2 server sql 中文版补丁_SQL Server 2008 SP4 补丁

    SQL Server 2008 SP4 补丁对于客户而言,Microsoft SQL Server 2008 Service Pack 4 中的几个关键改进如下所示: 改进了从 SQL Server ...

最新文章

  1. MOS管体二极管的作用
  2. 查询出来时间不对_2020年一级、二级建造师执业资格考试成绩可查询!
  3. input输入框的各种事件
  4. HDU2066:一个人的旅行(Dijkstra)
  5. pcl里面使用KdTree来搜索
  6. 您好,我是中科院做语音识别的博士生,我想参加阿里招聘但是,北京 爱问知识人...
  7. 【English】20190513
  8. 论文赏析[TACL19]生成模型还在用自左向右的顺序?这篇论文教你如何自动推测最佳生成顺序
  9. [选择性翻译][HDP Ambari 2.2.2安装使用说明][1]
  10. AttributeError: ‘Polygon‘ object has no property ‘normed‘
  11. 分享10款保护隐私的搜索引擎,快手动收藏!
  12. 推荐 干掉垃圾流氓插件得批处理文件和注册表文件
  13. bootstrap栅格化框架
  14. Spring Boot入门(24):Spring Boot事务 | 超级详细,建议收藏
  15. Java 不允许在一个范围大的作用域下重新定义同名变量
  16. ESP32-CAM高性价比温湿度监控系统配网与上网方案设计与实现
  17. Linux部署war包项目
  18. 开源棒棒糖学习Android-26之Button、EditText等等的老子TextView一万多行的类源码赏析
  19. (59)TCL脚本命令【全局变量】
  20. Adobe Acrobat编辑 域 并在java itext中应用

热门文章

  1. apache服务器性能不行,Apache服务器性能调优
  2. c语言int超出范围溢出处理_整数溢出是怎么回事?Python和Numpy的整数为何不一样?...
  3. csv逗号分隔符转换_机器学习Python实践——数据导入(CSV)
  4. vba两个集合的差集_Python中的集合是如何使用的?
  5. 虚拟世界来自现实世界,同时又促进现实世界
  6. C语言学习系列(六)基本语法
  7. 【BZOJ】【3671】【NOI2014】随机数生成器
  8. 图 | 为什么存在关于图的研究
  9. HIT Software Construction Review Notes(1-1 Multi-Dimensional Views of Software Construction)
  10. 面试必知的25个经典回答 ,最全的面试干货,没有之一