SQL Server 2012中Task是如何调度的?
从SQL Server 7.0以来调度算法并没有很大的改变。 算法概述: 调度从分配NUMA节点开始,使用循环分配的方式,当一下链接来了,先分配给Node1,然后分配给Node2,然后在Node1 分配了NUMA节点之后,在分配调度器,根据Load factor来做调度,Load factor可以简
从SQL Server 7.0以来调度算法并没有很大的改变。
算法概述:
调度从分配NUMA节点开始,使用循环分配的方式,当一下链接来了,先分配给Node1,然后分配给Node2,然后在Node1
分配了NUMA节点之后,在分配调度器,根据Load factor来做调度,Load factor可以简单的认为是分配给调度器的任务数量
task分配是根据Load factor,如果首先的调度器比其他调度器多了120%,那么选择其他调度器,否则现在首选调度器
SQL Server 2012调度算法只在企业版上做了修改
新的连接分配:新的连接是用环形循环分配,和前面提到的一样。所有的sql server 2012 产品都是这样分配连接的,美国服务器,然后查询目标节点把连接分配给负荷最小的调度器,然后这个调度器变为这个连接的首选调度器。
新的连接并没有首选调度器,所以需要再分配的节点内给连接分配一个调度器,负荷最小的调度器被选中,如图的例子现在了Node1的sched2.
SQL Server 2012之前和非企业版
这个比较简单,当task被请求,使用首选调度器,继续上面的例子如图:是sched2,当load factor是其他调度器120%以上的时候就需要重新选中调度器。
SQL Server 2012企业版
在企业版中,对load factor的算法进行了改进。
每个调度器,都有一个以cpu为目标的,资源池,并是有load factor对能力进行跟踪。并不是Load factor一样120%,而是通过每个资源池的平均cpu
调度还是以首选调度器开始,如果调度之后,并没有比同节点内的所有调度器平均少80%,那么可以调度,否则做调度平衡,选择可用资源最多的调度器。
调度的例子(笔者认为例子有些错误,所以做了修改):
Scheduler RG Pool Target Pool Runnable Tasks Avg Pool/Task
1 50 10 5
2 50 8 6.25 Currently Best Target – More resources to provide for tasks in the same pool
假设sched1 可以为每个task提供5,香港虚拟主机,那么sched2可以提供6.25
当前平均是 (5+6.25)/2 = 5.625
当有一个任务要被分配,首选是sched1那么如果被分配,可提供 50/11 = 4.545 > 5.625*0.8 = 4.5008所以可以分配
Scheduler RG Pool Target Pool Runnable Tasks Avg Pool/Task
1 50 11 4.545 Not below 80th percentile
2 50 8 6.25
当前平均= 5.3977 (6.25 + 4.5454/2)
然后又有一个新的要分配,首选还是sched1,50/12 = 4.1666 4.3181所以需要做调整,选择自愿最多的一个调度器
Scheduler RG Pool Target Pool Runnable Tasks Avg Pool/Task
1 50 11 4.5454
2 50 9 5.55 Added task
当前平均值 5.047 (5.55 + 4.5454 / 2)
相关Trace Flag
-T8008 强制调度,不管scheduler提示,香港服务器租用,总是调度给最小的负荷(使用最小load factor或者资源池)
-T8016 忽略负载均衡,总是调度给首选调度器

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Recently, many Win11 users have reported that when shutting down, they are prompted that the taskhostwindow task host is executing the shutdown task. So what is going on? Users can enter the Desktop folder under the local registry editor, and then select AutoEndTasks in the right window to set it. Let this site carefully introduce to users the solution to this problem when shutting down. Windows 11 shutdown prompts that the taskhostwindow task host is executing the shutdown task. Solution 1. Use the key combination win key + r key, enter "regedit" and press Enter, as shown in the figure below. 2. Search for [HKEY

WindowsServerBackup is a function that comes with the WindowsServer operating system, designed to help users protect important data and system configurations, and provide complete backup and recovery solutions for small, medium and enterprise-level enterprises. Only users running Server2022 and higher can use this feature. In this article, we will explain how to install, uninstall or reset WindowsServerBackup. How to Reset Windows Server Backup If you are experiencing problems with your server backup, the backup is taking too long, or you are unable to access stored files, then you may consider resetting your Windows Server backup settings. To reset Windows

By default, macOSSonoma hides all active windows when you click on your desktop wallpaper. This is convenient if you tend to have a bunch of files on your desktop that you need to access. However, if you find this behavior maddening, there is a way to turn it off. Apple's latest macOS Sonoma Mac operating system has a new option called "Click the wallpaper to show the desktop." Enabled by default, this option can be particularly useful if you tend to have multiple windows open and want to access files or folders on your desktop without having to minimize or move the windows. When you enable the feature and click on the desktop wallpaper, all open windows are temporarily swept aside, allowing direct access to the desktop. Once done, you can again

With the rapid development of Internet business and the gradually increasing business volume, the amount of data that a single server can process is far from meeting demand. In order to meet the requirements of high concurrency, high availability, and high performance, distributed architecture emerged as the times require. In a distributed architecture, task distribution and scheduling is a very critical component. The quality of task distribution and scheduling will directly affect the performance and stability of the entire system. Here, we will introduce how to use the go-zero framework to implement distributed task distribution and scheduling. 1. Distributed task distributionTask distribution

MySQL is currently one of the most widely used relational databases. It provides numerous functions and tools, including scheduled tasks and scheduling functions. In actual development, we often need to perform certain tasks regularly, such as backing up databases, generating reports, etc. At this time, MySQL's scheduled tasks and scheduling functions can come in handy. In this article, we will introduce MySQL's scheduled tasks and scheduling functions, and how to use them to achieve efficient scheduled tasks and scheduling. 1. MySQL’s scheduled tasks and scheduling functions MySQL

On the occasion of releasing the build 26040 version of Windows Server, Microsoft announced the official name of the product: Windows Server 2025. Also launched is the Windows11WindowsInsiderCanaryChannel version build26040. Some friends may still remember that many years ago someone successfully converted Windows NT from workstation mode to server mode, showing the commonalities between various versions of Microsoft operating systems. Although there are clear differences between Microsoft's current version of the server operating system and Windows 11, those who pay attention to the details may be curious: why Windows Server updated the brand,

How to modify the default name of nginx, you can disguise it a little, or you can install Tip: Generally, modifications are made before nginx is compiled. After modification, the code needs to be recompiled as follows: scr/core/nginx.conf#definenginx_version"1.4.7"#definenginx_ver"nginx/"n

While Microsoft released the Win11 preview update for the desktop, today it also released the Windows Server Long Term Service Channel (LTSC) preview Build 25335. As usual, Microsoft did not publish a complete change log, or even provide a corresponding blog post. Microsoft has adjusted the Windows Server preview version update log to make it the same as the Canary channel version. If no new content is introduced, the official blog post will not be posted. Note from IT Home: The server brand has not been updated and is still Windows Server 2022 in the preview version. In addition, Microsoft calls these versions Windows Server vNext instead of the Windows version that is already on the market.
