[Enhancement] Arrow Stream Load decompresses record batches on Arrow's global thread pool

未关闭 适合新手
#68,891 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
半天
新手友好度
70/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
backend

调研方向

从 be/src/format/arrow/arrow_stream_reader.cpp 开始,这里使用 arrow::ipc::IpcReadOptions::Defaults() 读取 Stream Load 的请求体,并检查其中 use_threads 是如何设置的。同样的模式也出现在 arrow_flight_batch_reader.cpp 中。完成的标准是:Stream Load 读取路径在 scanner 线程上进行解压(可选地置于一个 BE 配置之后),现有的 Arrow 导入测试全部通过,并且吞吐量的变化已通过基准测试确认。

由索引模型根据 Issue 内容生成。

描述

Search before asking
  • I had searched in the issues and found no similar issues.
Description

ArrowStreamReader reads Stream Load bodies with arrow::ipc::IpcReadOptions::Defaults() (be/src/format/arrow/arrow_stream_reader.cpp, master too), and that leaves use_threads = true. For compressed IPC streams (ZSTD/LZ4 record batches), Arrow then decompresses every record batch's buffers on Arrow's single process-wide CPU thread pool, not on the scanner thread doing the read.

Under many concurrent Arrow loads, scanner threads mostly wait on that one pool's mutex and condition variable. Off-CPU stacks show around 75 scanner threads per BE parked in pthread_cond_signal / arrow::internal::ThreadPool::SpawnReal, while the BE stays well below CPU saturation.

Measurements

4 BEs (192 vCPU each, arm64), cloud mode, many concurrent Stream Loads, ZSTD-compressed Arrow record batches:

  • default IpcReadOptions (global pool): plateau of about 5.7M rows/s total, BEs at about 64% CPU;
  • the same data sent uncompressed: about 7.1M rows/s;
  • ZSTD, with decompression inline on the scanner thread (use_threads = false): 8.15–8.45M rows/s.
Solution

Read Stream Load bodies with use_threads = false (optionally behind a BE config), so decompression runs on the scanner thread that already owns the load. Load concurrency comes from the scanner pool, so Arrow's internal pool adds only contention. arrow_flight_batch_reader.cpp uses the same pattern and may benefit too.

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
主要语言
Java
星标
16.2k
派生
4k
平均合并
1 天 17 小时
30 天内合并 PR
660

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/doris 的其他 Issue

查看 apache/doris 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。