Home Database Mysql Tutorial SQL Server 2012中Task是如何调度的?

SQL Server 2012中Task是如何调度的?

Jun 07, 2016 pm 05:39 PM
server task how Scheduling

从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 忽略负载均衡,总是调度给首选调度器

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Windows 11 shutdown prompts task host window task host is executing the shutdown task solution Windows 11 shutdown prompts task host window task host is executing the shutdown task solution Feb 12, 2024 pm 12:40 PM

Windows 11 shutdown prompts task host window task host is executing the shutdown task solution

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

How to install, uninstall, and reset Windows server backup

How to disable the 'Click to Show Desktop' feature in macOS How to disable the 'Click to Show Desktop' feature in macOS Nov 23, 2023 pm 02:31 PM

How to disable the 'Click to Show Desktop' feature in macOS

Use go-zero to implement distributed task distribution and scheduling Use go-zero to implement distributed task distribution and scheduling Jun 22, 2023 am 09:06 AM

Use go-zero to implement distributed task distribution and scheduling

Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience Feb 19, 2024 pm 02:36 PM

Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience

How to implement distributed scheduled tasks and scheduling in PHP microservices How to implement distributed scheduled tasks and scheduling in PHP microservices Sep 25, 2023 pm 05:54 PM

How to implement distributed scheduled tasks and scheduling in PHP microservices

How to modify the Nginx version name to disguise any web server How to modify the Nginx version name to disguise any web server May 14, 2023 pm 09:19 PM

How to modify the Nginx version name to disguise any web server

Microsoft releases Windows Server vNext preview version 25335 Microsoft releases Windows Server vNext preview version 25335 Jan 10, 2024 am 08:49 AM

Microsoft releases Windows Server vNext preview version 25335

See all articles