From 69a9adc5135b63000b6418072d0c5ea7cb7eb6f1 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Fri, 1 Nov 2024 16:29:12 +0800 Subject: [PATCH] Apply suggestions from code review --- tiflash/tiflash-mintso-scheduler.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tiflash/tiflash-mintso-scheduler.md b/tiflash/tiflash-mintso-scheduler.md index 42ca87becd88d..bd82ae5bfcad3 100644 --- a/tiflash/tiflash-mintso-scheduler.md +++ b/tiflash/tiflash-mintso-scheduler.md @@ -5,23 +5,23 @@ summary: Learn the implementation principles of the TiFlash MinTSO Scheduler. # TiFlash MinTSO Scheduler -The TiFlash MinTSO Scheduler is a distributed scheduler for [MPP](/glossary.md#mpp) Tasks in TiFlash. This article introduces the implementation principles of the TiFlash MinTSO Scheduler. +The TiFlash MinTSO scheduler is a distributed scheduler for [MPP](/glossary.md#mpp) tasks in TiFlash. This document describes the implementation principles of the TiFlash MinTSO scheduler. ## Background -When processing MPP queries, TiDB splits the query into one or more MPP Tasks and sends these MPP Tasks to the corresponding TiFlash nodes for compilation and execution. Before TiFlash used the [pipeline execution model](/tiflash/tiflash-pipeline-model.md), TiFlash needed to use several threads to execute each MPP Task, with the specific number of threads depending on the complexity of the MPP Task and the concurrency parameters set in TiFlash. +When processing MPP queries, TiDB splits the query into one or more MPP tasks and sends these MPP tasks to the corresponding TiFlash nodes for compilation and execution. Before TiFlash uses the [pipeline execution model](/tiflash/tiflash-pipeline-model.md), TiFlash needs to use several threads to execute each MPP task, with the specific number of threads depending on the complexity of the MPP task and the concurrency parameters set in TiFlash. -In high concurrency scenarios, TiFlash nodes receive multiple MPP Tasks simultaneously. If the execution of MPP Tasks is not controlled, the number of threads TiFlash needs to request from the system will increase linearly with the number of MPP Tasks. Too many threads will affect TiFlash's execution efficiency, and since the operating system itself supports a limited number of threads, TiFlash will encounter errors when it requests more threads than the operating system can provide. +In high concurrency scenarios, TiFlash nodes receive multiple MPP tasks simultaneously. If the execution of MPP tasks is not controlled, the number of threads that TiFlash needs to request from the system will increase linearly along with the increasing number of MPP tasks. Too many threads will affect TiFlash's execution efficiency, and since the operating system itself supports a limited number of threads, TiFlash will encounter errors when it requests more threads than the operating system can provide. -To improve TiFlash's processing capability in high concurrency scenarios, an MPP Task scheduler needs to be introduced in TiFlash. +To improve TiFlash's processing capability in high concurrency scenarios, an MPP task scheduler needs to be introduced into TiFlash. -## Implementation Principles +## Implementation principles -As mentioned in the background, the initial purpose of introducing the TiFlash Task Scheduler is to control the number of threads used during MPP query execution. A simple scheduling strategy is to specify the maximum number of threads TiFlash can request. For each MPP Task, the scheduler decides whether the MPP Task can be scheduled based on the current number of threads used by the system and the expected number of threads the MPP Task will use: +As mentioned in the [background](#background), the initial purpose of introducing the TiFlash task scheduler is to control the number of threads used during MPP query execution. A simple scheduling strategy is to specify the maximum number of threads TiFlash can request. For each MPP task, the scheduler decides whether the MPP task can be scheduled based on the current number of threads used by the system and the expected number of threads the MPP task will use: ![TiFlash MinTSO Scheduler v1](/media/tiflash/tiflash_mintso_v1.png) -Although the above scheduling strategy can effectively control the number of system threads, MPP Tasks are not the smallest independent execution units, and there are dependencies between different MPP Tasks: +Although the preceding scheduling strategy can effectively control the number of system threads, an MPP task is not the smallest independent execution unit, and dependencies exist between different MPP tasks: ```sql EXPLAIN SELECT count(*) FROM t0 a JOIN t0 b ON a.id = b.id;