【详述】
把Trino查询迁移到Starrocks时, 发现相同资源情况下,同一个SQL在trino中耗时2s+, 在Starrocks中耗时16s+.
SQL是简单的select查询,通过profile分析发现查询耗时集中在BE节点HDFS_SCAN阶段。读取了两个scan_range, 平均大小70MB, 一个读取的很快,一个读取的很慢。
从trino的查询分析来看,ufs没有瓶颈,怀疑是BE实现的问题, 能帮忙一起分析下原因么
SQL
SELECT 'xxx_episode_id' AS "aid" , if('episode_en_name' = 'tv_name', 'tv_name', concat('tv_name', '</br>', 'episode_en_name')) AS "tv_name" , 'channel_id', 'channel_name', 'online_time', 'tag_place' FROM table LIMIT 10;
看到OpenFile耗时久
| └──HDFS_SCAN (id=0) |
| Estimates: [row: 10, cpu: ?, memory: ?, network: ?, cost: 4320.0] |
| TotalTime: 17s39ms (100.00%) [CPUTime: 228.231ms, ScanTime: 16s811ms] |
| OutputRows: 20 |
| Detail Timers: [ScanTime = IOTaskExecTime + IOTaskWaitTime] |
| IOTaskExecTime: 8s565ms [min=319.212ms, max=16s811ms] |
| OpenFile: 8s267ms [min=165.493ms, max=16s369ms] |
| ReaderInit: 8s267ms [min=165.447ms, max=16s369ms] |
| IOTaskWaitTime: 84.239us [min=65.571us, max=102.908us]
【是否存算分离】 存算分离
【StarRocks版本】3.3.6
【集群规模】1fe+6be
f1992e8d-ad88-11ef-97d1-fa163e451b63profile.txt (28.1 KB)
Trino读取的数据量总共34.68MB,Starrocks读取数据量135.612 MB。 这也是性能差距的原因之一,但不因该有这么大差距
Trino Plan
Fragment 2 [SOURCE]
CPU: 2.02s, Scheduled: 3.29s, Blocked 0.00ns (Input: 0.00ns, Output: 0.00ns), Input: 443493 rows (0B); per task: avg.: 147831.00 std.dev.: 209064.61, O
Output layout: []
Output partitioning: SINGLE []
LimitPartial[count = 10]
│ Layout: []
│ Estimates: {rows: 10 (0B), cpu: 0, memory: 0B, network: 0B}
│ CPU: 0.00ns (0.00%), Scheduled: 0.00ns (0.00%), Blocked: 0.00ns (0.00%), Output: 10 rows (0B)
│ Input avg.: 147831.00 rows, Input std.dev.: 141.42%
└─ TableScan[table = xxxxxx]
Layout: []
Estimates: {rows: ? (0B), cpu: 0, memory: 0B, network: 0B}
CPU: 629.00ms (100.00%), Scheduled: 1.09s (100.00%), Blocked: 0.00ns (0.00%), Output: 443493 rows (0B)
Input avg.: 147831.00 rows, Input std.dev.: 141.42%
Input: 443493 rows (0B), Physical input: 34.68MB, Physical input time: 230.01ms