
点击蓝字,关注我们

01
问题复现

02
解决思路
查看海豚运行日志(未发现异常)
tail home/dolphinscheduler/api-server/logs/dolphinscheduler-api.log

尝试重启海豚的api-server模块
sh home/dolphinscheduler/bin/dolphinscheduler-daemon.sh stop api-server
sh home/dolphinscheduler/bin/dolphinscheduler-daemon.sh start api-server
尝试请求超时连接发现请求能出数据,但是要十多秒 
尝试查看源码,可能是慢查询
代码位置
使用arthas查看运行情况
curl -O https://arthas.aliyun.com/arthas-boot.jar
java -jar arthas-boot.jar
#找dolphinscheduler-api的那个就是,我的是第一个就看到了
trace org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl queryProjectListPaging -n 1

queryProjectListPaging方法

select * from t_ds_project p
where 1=1 and p.id in(1,2,3,5,6,8,9,12,13,14,16,17,19,21,22,23,25,26)
group by p.id
order by p.id desc



获得慢sql,进行分析
select
p.id, p.name, p.code, p.description, p.user_id, p.flag, p.create_time, p.update_time
,
u.user_name as user_name,
(SELECT COUNT(*) FROM t_ds_process_definition AS def WHERE def.project_code = p.code) AS def_count,
(SELECT COUNT(*) FROM t_ds_process_definition_log def, t_ds_process_instance inst WHERE def.code =
inst.process_definition_code and def.version = inst.process_definition_version AND def.project_code = p.code
AND inst.state=1 ) as inst_running_count
from t_ds_project p
left join t_ds_user u on u.id=p.user_id
where 1=1
and p.id in
(1, 2, 3, 5, 6, 8, 9, 12, 13, 14, 16, 17, 19, 21, 22, 23, 25, 26)
group by p.id,u.user_name
order by p.id desc LIMIT 100
inst_running_count这里查询慢。查看
t_ds_process_definition表就28万多数据,
t_ds_process_definition_log表有1千数据。
由此可知是日志数据太多了。尝试优化这个查询,给
t_ds_process_instance加索引
create index qwl_diy_index
on t_ds_process_instance (process_definition_code, process_definition_version, state);

参与Apache DolphinScheduler 社区有非常多的参与贡献的方式,包括:


球分享

球点赞

球在看
文章转载自海豚调度,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




