[xuxueli/xxl-job]为什么每秒都在后台执行sql查询?能不能只在设置的时间点运行?

2024-04-24 835 views
8
Which version of XXL-JOB do you using?

2.1.2

Expected behavior

我只设置了一个任务, Cron为0 0 9,10,18,19,23 ? 但是后台一直非常繁忙, 我设置了DEBUG模式输出sql,发现一直在跑一些sql,导致日志文件都有十几g, 能不能只在设置的时间点运行?

image

Actual behavior Steps to reproduce the behavior
er_code, t.trigger_msg, t.handle_time, t.handle_code, t.handle_msg, t.alarm_status FROM xxl_job_log AS t WHERE t.id = ? 
2020-07-03 00:10:57.796 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==> Parameters: 112834(Long)
2020-07-03 00:10:57.799 DEBUG 36056 --- [XNIO-1 task-355] com.xxl.job.admin.dao.XxlJobLogDao.load  : <==      Total: 1
2020-07-03 00:10:57.800 DEBUG 36056 --- [XNIO-1 task-355] c.x.job.admin.service.impl.AdminBizImpl  : >>>>>>>>> JobApiController.callback fail, handleCallbackParam=HandleCallbackParam{logId=114180, logDateTim=1592916268027, executeResult=ReturnT [code=200, msg=null, content=null]}, callbackResult=ReturnT [code=500, msg=log repeate callback., content=null]
2020-07-03 00:10:57.800 DEBUG 36056 --- [XNIO-1 task-355] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==>  Preparing: SELECT t.id, t.job_group, t.job_id, t.executor_address, t.executor_handler, t.executor_param, t.executor_sharding_param, t.executor_fail_retry_count, t.trigger_time, t.trigger_code, t.trigger_msg, t.handle_time, t.handle_code, t.handle_msg, t.alarm_status FROM xxl_job_log AS t WHERE t.id = ? 
2020-07-03 00:10:57.801 DEBUG 36056 --- [XNIO-1 task-355] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==> Parameters: 114181(Long)
2020-07-03 00:10:57.808 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : <==      Total: 1
2020-07-03 00:10:57.808 DEBUG 36056 --- [XNIO-1 task-358] c.x.job.admin.service.impl.AdminBizImpl  : >>>>>>>>> JobApiController.callback fail, handleCallbackParam=HandleCallbackParam{logId=112834, logDateTim=1592914922028, executeResult=ReturnT [code=200, msg=null, content=null]}, callbackResult=ReturnT [code=500, msg=log repeate callback., content=null]
2020-07-03 00:10:57.809 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==>  Preparing: SELECT t.id, t.job_group, t.job_id, t.executor_address, t.executor_handler, t.executor_param, t.executor_sharding_param, t.executor_fail_retry_count, t.trigger_time, t.trigger_code, t.trigger_msg, t.handle_time, t.handle_code, t.handle_msg, t.alarm_status FROM xxl_job_log AS t WHERE t.id = ? 
2020-07-03 00:10:57.809 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==> Parameters: 112835(Long)
2020-07-03 00:10:57.812 DEBUG 36056 --- [XNIO-1 task-355] com.xxl.job.admin.dao.XxlJobLogDao.load  : <==      Total: 1
2020-07-03 00:10:57.813 DEBUG 36056 --- [XNIO-1 task-355] c.x.job.admin.service.impl.AdminBizImpl  : >>>>>>>>> JobApiController.callback fail, handleCallbackParam=HandleCallbackParam{logId=114181, logDateTim=1592916269029, executeResult=ReturnT [code=200, msg=null, content=null]}, callbackResult=ReturnT [code=500, msg=log repeate callback., content=null]
2020-07-03 00:10:57.813 DEBUG 36056 --- [XNIO-1 task-355] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==>  Preparing: SELECT t.id, t.job_group, t.job_id, t.executor_address, t.executor_handler, t.executor_param, t.executor_sharding_param, t.executor_fail_retry_count, t.trigger_time, t.trigger_code, t.trigger_msg, t.handle_time, t.handle_code, t.handle_msg, t.alarm_status FROM xxl_job_log AS t WHERE t.id = ? 
2020-07-03 00:10:57.813 DEBUG 36056 --- [XNIO-1 task-355] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==> Parameters: 114182(Long)
2020-07-03 00:10:57.822 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : <==      Total: 1
2020-07-03 00:10:57.822 DEBUG 36056 --- [XNIO-1 task-358] c.x.job.admin.service.impl.AdminBizImpl  : >>>>>>>>> JobApiController.callback fail, handleCallbackParam=HandleCallbackParam{logId=112835, logDateTim=1592914923025, executeResult=ReturnT [code=200, msg=null, content=null]}, callbackResult=ReturnT [code=500, msg=log repeate callback., content=null]
2020-07-03 00:10:57.823 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==>  Preparing: SELECT t.id, t.job_group, t.job_id, t.executor_address, t.executor_handler, t.executor_param, t.executor_sharding_param, t.executor_fail_retry_count, t.trigger_time, t.trigger_code, t.trigger_msg, t.handle_time, t.handle_code, t.handle_msg, t.alarm_status FROM xxl_job_log AS t WHERE t.id = ? 
2020-07-03 00:10:57.823 DEBUG 36056 --- [XNIO-1 task-358] com.xxl.job.admin.dao.XxlJobLogDao.load  : ==> Parameters: 112836(Long)
Other information

回答

4

我的任务执行时间可能一次得花几分钟,比较长,是不是返回失败了和这个有关系?

5

系统后台一直有线程在跑,具体可以看 com.xxl.job.admin.core.thread 里面的代码,日志大的话,可以定时删除或者是提高日志级别

8

这会不会对mysql产生不必要的计算, 能不能设置不要在后台一直每秒执行n个查询?

7

好像没有设置的地方,只能自己修改源码

3

这是正常的吧? 正常的话我就不管了

0

@wolfmanwoking 我的cron没问题啊

8

实际上调器 就是一个时间轮+sql查询更新。每次更新和查询任务都会查 5秒左右即将执行的任务的。