impala-admin shared

一 impala architecture

 

二  impala query

 

 

三 公司 impala 平台物理框架
16 台 DataNode (其中3台 Impalad 服务)
 

 

 

四 impala 主要功能
Impalad : ThriftServer (beeswax_serve :客户端 、 hs2_server : hive 元数据 、 be_serve : 内部server ) 管理页面 http://ip:25000/
ImpalaServer
State Store : Impalad 元数据
Catalogd : Hive 等外部元数据网关服务
CLI : 命令行工具
 
五 impala-admin 工程
5.1 任务背景
解决 impala 慢 sql, hdp (Hortonworks Data Platform) 全局参数 : default_query_options EXEC_TIME_LIMIT_S=600 执行超 10分钟,停止 impala query 任务。
然而 hdp impala 设置任务参数超10分钟停止,不一定会生效。之前手工取消任务,给运维工作带来不小工作量,也影响正常 task query 响应时间。
所以 需开发小功能,定义规则链,符合阈值进行任务处理(比如 取消任务等 )。
 
 
5.2 技术方案思路
5.2.1 通过 http://ip:25000/queries 页面,查询任务 ,了解如下

 

5.2.2 分析 apache impala 源码
http://ip:port/queries?json 接口,可获取 impala query 任务

 

 

 http://ip:port/cancel_query?query_id={query_id} 接口,可取消任务
 
5.2.3 搭建 impala-admin 框架
schedule task 定时扫描 impala rest api 接口,根据规则处理。 定时参数配置化。
责任链模式: (若有新 task 处理规则,加规则 handler )

 

5.2.4 测试环境中,触发规则,停止任务,需停止三次,任务才真正停止。

 

 

现象: 任务第一次 10:25 到达阈值被终止
任务第二次 10:35 会自动重启(在同一25000端口节点 查询),任务第二次到达阈值被终止
任务第三次 10:45 会自动重启(在同一25000端口节点 查询),任务第三次到达阈值被终止。
任务结束。
页面结果:

 

 

5.2.5 query ---> child queries 需要按照规则处理
主任务开始运行:
 

 

子任务已完成,回退到主任务。
 

 

 

现象是子任务触发规则停止了,主任务也停止。所以需要识别主任务 fork 的子任务,归集同一个handler 处理。

 

impala query task 生命周期:
主任务 开始--->
---> 子任务开始
---> 子任务结束
主任务 结束
 
主任务未必都有子任务,需根据当前命令,进行分析。(若有子任务,需明确子任务全局唯一规则)
 
六 impala -admin 服务
6.1 standby 模式
impala -admin 210 机器 active
211 机器 standby
 
 
 
说明:
1 因 impalad server 不稳定

 

 

impala-admin 日志,合理。
[2023-08-30 00:22:07.207] [] [] [ERROR] - com.cnpc.impala.admin.service.httprequestImpl.ImpalaWebServiceImpl.queryAllRunningQueriesService(ImpalaWebServiceImpl.java:59) - 执行 [queryAllRunningQueries] : request=[http://11.11.206.199:25000/queries?json] 异常 [I/O error on GET request for "http://11.11.206.199:25000/queries": Connection timed out (Connection timed out); nested exception is java.net.ConnectException: Connection timed out (Connection timed out)]
 
2 impala 任务规则:
2.1 全局参数
 

 

2.2 会话参数 SET EXEC_TIME_LIMIT_S = 3600 (生产环境:两次验证会话参数覆盖全局参数)
 
2.3 impala-admin 工程 (托底逻辑)
责任链: compute stats 规则 --> duration 时间 规则
compute stats 规则: 特殊规则,任务放行 (若需,设置会话参数覆盖全局参数)
duration 时间 规则: 托底逻辑,若全局参数未生效,触发规则 ( 全局参数 、会话参数 、规则阈值 最小阈值触发)
注释: task 时间窗口 [ 10 分钟 + 任务执行时间 --- 10 分钟 + 任务执行时间 + 任务检查间隔时间 1 分钟 ]
 
 
3 compute stats
Gathers information about volume and distribution of data in a table and all associated columns and partitions. The information is stored in the metastore database, and used by Impala to help optimize queries.
Because many of the most performance-critical and resource-intensive operations rely on table and column statistics to construct accurate and efficient plans, COMPUTE STATS is an important step at the end of your ETL process. Run COMPUTE STATS on all tables as your first step during performance tuning for slow queries, or troubleshooting for out-of-memory conditions:
  • Accurate statistics help Impala construct an efficient query plan for join queries, improving performance and reducing memory usage.
  • Accurate statistics help Impala distribute the work effectively for insert operations into Parquet tables, improving performance and reducing memory usage.
  • Accurate statistics help Impala estimate the memory required for each query, which is important when you use resource management features, such as admission control and the YARN resource management framework. The statistics help Impala to achieve high concurrency, full utilization of available memory, and avoid contention with workloads from other Hadoop components.
 

 

 

 

 

 

 

 

 

 

posted @   163博客  阅读(61)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示