presto + 如何调整task.concurrency

jes*_*ica 1 presto

来自 presto 文档:

task.concurrency描述: https: //prestosql.io/docs/current/admin/properties.html

    Type: integer
    Restrictions: must be a power of two
    Default value: 16
    Default local concurrency for parallel operators such as joins and aggregations. This value should be adjusted up or down based on the query concurrency and worker resource utilization. 
Lower values are better for clusters that run many queries concurrently because the cluster will already be utilized by all the running queries, so adding more concurrency will result in slow downs due to context switching and other overhead. Higher values are better for clusters that only run one or a few queries at a time. This can also be specified on a per-query basis using the task_concurrency session property.
Run Code Online (Sandbox Code Playgroud)

根据我的理解 - 我们需要task.concurrency根据CPU cores X Number of Thread

我将给出来自一台 presto 工作机器上的 lscpu 的示例

lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                16
On-line CPU(s) list:   0-15
Thread(s) per core:    2
Run Code Online (Sandbox Code Playgroud)

因为 16 X 2 = 32

那么根据我的理解它应该是task.concurrency=32

并且该参数只能在文件presto workers中配置config.properties

我在这儿吗?

Dai*_*rom 6

不幸的是,答案有点复杂。

task.max-worker-threads属性是 Presto 将用于执行查询任务的线程数。这是一种协作式多任务设计,其中每个任务预计仅使用线程大约一秒钟,然后返回调度程序。正如您所料,此属性通常是相对于 CPU 核心数设置的(当前默认值为核心数的 2 倍)。

该属性是为工作并行task.concurrency任务生成的任务数。有一些工作任务需要单线程。例如,final需要一个计数器来将行数限制为精确计数。在这样的步骤之后,规划者可以插入工作人员本地交换,以允许并行执行后续步骤。对于这些并行步骤,系统必须选择一个数字来并行运行,并且此选项控制该决定。对于此属性,该数字与核心数量没有直接关系,因为上面提到的任务调度程序可以处理比核心更多的任务,但通常不需要超过核心数量。由于将数据分割成非常小的块,所以较高的值可能会导致效率低下。另一方面,如果数量太低,则可能会增加查询延迟,因为所有内容都需要等待几个线程来处理大量数据。通常,8 或 16 的值足以满足更多安装的需要。LIMITtask.concurrency