This commit is contained in:
xuxueli 2017-08-15 17:31:20 +08:00
parent ab53b9c5d3
commit 2190120de5
4 changed files with 174 additions and 167 deletions

View File

@ -37,8 +37,8 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
## Documentation ## Documentation
- [中文文档](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB官方文档.md) - [中文文档](http://www.xuxueli.com/xxl-job/)
- [English Documentation](https://github.com/xuxueli/xxl-job/blob/master/doc/XXL-JOB-English-Documentation.md) - [English Documentation](http://www.xuxueli.com/xxl-job/en/)
## Features ## Features

View File

@ -1,4 +1,4 @@
# 《A lightweight distributed task scheduling framework. "XXL-JOB" # 《Distributed task scheduling framework XXL-JOB
[![Build Status](https://travis-ci.org/xuxueli/xxl-job.svg?branch=master)](https://travis-ci.org/xuxueli/xxl-job) [![Build Status](https://travis-ci.org/xuxueli/xxl-job.svg?branch=master)](https://travis-ci.org/xuxueli/xxl-job)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/)
@ -41,8 +41,9 @@ In 2015 - November, XXL-JOB finally RELEASE the first big version of V1.0, then
In 2015 - December, I will XXL-JOB published to our internal knowledge base, and get internal colleagues recognized. In 2015 - December, I will XXL-JOB published to our internal knowledge base, and get internal colleagues recognized.
In 2016 - 01 months, my company started XXL-JOB internal access and custom work, in this thank Yuan and Yin two colleagues contribution, but also to thank the internal other attention and support colleagues. In 2016 - 01 months, my company started XXL-JOB internal access and custom work, in this thank Yuan and Yin two colleagues contribution, but also to thank the internal other attention and support colleagues.
In 2017-05-13, the link of "let the code run" in "[the 62nd source of open source China Genesis](https://www.oschina.net/event/2236961)" held in Shanghai,, I stepped on and made a speech about the XXL-JOB, five hundred spectators in the audience reacted enthusiastically ([pictorial review](https://www.oschina.net/question/2686220_2242120)). In 2017-05-13, the link of "let the code run" in "[the 62nd source of open source China Genesis](https://www.oschina.net/event/2236961)" held in Shanghai,, I stepped on and made a speech about the XXL-JOB, five hundred spectators in the audience reacted enthusiastically ([pictorial review](https://www.oschina.net/question/2686220_2242120)).
#### My company have access to XXL-JOB, internal alias "Ferrari" (Ferrari based on XXL-JOB V1.1 version customization, new access application recommended to upgrade the latest version). > Our company have access to XXL-JOB, internal alias "Ferrari" (Ferrari based on XXL-JOB V1.1 version customization, new access application recommended to upgrade the latest version).
According to the latest statistics, from 2016-01-21 to 2017-07-07 period, the system has been scheduled about 600,000 times, outstanding performance. New access applications recommend the latest version, because after several major updates, the system's task model, UI interaction model and the underlying scheduling communication model has a greater optimization and upgrading, the core function more stable and efficient. According to the latest statistics, from 2016-01-21 to 2017-07-07 period, the system has been scheduled about 600,000 times, outstanding performance. New access applications recommend the latest version, because after several major updates, the system's task model, UI interaction model and the underlying scheduling communication model has a greater optimization and upgrading, the core function more stable and efficient.
So far, XXL-JOB has access to a number of companies online product line, access to scenes such as electronic commerce, O2O business and large data operations, as of 2016-07-19, XXL-JOB has access to the company But not limited to: So far, XXL-JOB has access to a number of companies online product line, access to scenes such as electronic commerce, O2O business and large data operations, as of 2016-07-19, XXL-JOB has access to the company But not limited to:
- 1、大众点评 - 1、大众点评
@ -82,11 +83,17 @@ So far, XXL-JOB has access to a number of companies online product line, access
- 35、北京诺亦腾科技有限公司 - 35、北京诺亦腾科技有限公司
- 36、增长引擎(北京)信息技术有限公司 - 36、增长引擎(北京)信息技术有限公司
- …… - ……
> The company that access and use this product is welcome to register at the [address](https://github.com/xuxueli/xxl-job/issues/1 ), only for product promotion.
Welcome everyone's attention and use, XXL-JOB will also embrace changes, sustainable development. Welcome everyone's attention and use, XXL-JOB will also embrace changes, sustainable development.
### 1.4 Download ### 1.4 Download
#### Documentation
- [中文文档](http://www.xuxueli.com/xxl-job/)
- [English Documentation](http://www.xuxueli.com/xxl-job/en/)
#### Source repository address (The latest code will be released in the two git warehouse in the same time) #### Source repository address (The latest code will be released in the two git warehouse in the same time)
Source repository address | Release Download Source repository address | Release Download
@ -104,19 +111,15 @@ Source repository address | Release Download
</dependency> </dependency>
``` ```
#### Blog address
- [oschina address](http://my.oschina.net/xuxueli/blog/690978)
- [cnblogs address](http://www.cnblogs.com/xuxueli/p/5021979.html)
#### Technical exchange group (technical exchange only) #### Technical exchange group (technical exchange only)
- Group 6399758605 - Tecent QQ Group 6399758605
- Group 5138274130 Group is full, please add group 6 - Tecent QQ Group 5138274130
- Group 4464762661 Group is full, please add group 6 - Tecent QQ Group 4464762661
- Group 3242151780 Group is full, please add group 6 - Tecent QQ Group 3242151780
- Group 2438249535 Group is full, please add group 6 - Tecent QQ Group 2438249535
- Group 1367260654 Group is full, please add group 6 - Tecent QQ Group 1367260654
- [Gitter](https://gitter.im/xuxueli/xxl-job)
### 1.5 Environment ### 1.5 Environment
- JDK1.7+ - JDK1.7+
@ -399,7 +402,7 @@ Actually it is a python script fragment.
## 4. Task Management ## 4. Task Management
#### 4.0 configure executor ### 4.0 configure executor
click"执行器管理" on the left menu,it will go to the page as shown below: click"执行器管理" on the left menu,it will go to the page as shown below:
![输入图片说明](https://static.oschina.net/uploads/img/201703/12223509_Hr2T.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/12223509_Hr2T.png "在这里输入图片标题")
@ -409,7 +412,7 @@ click"执行器管理" on the left menu,it will go to the page as shown below:
If you want to create a new executor,please click "+新增执行器" button: If you want to create a new executor,please click "+新增执行器" button:
![输入图片说明](https://static.oschina.net/uploads/img/201703/12223617_g3Im.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/12223617_g3Im.png "在这里输入图片标题")
#### Description of executor attributes ### Description of executor attributes
AppName: the unique identity of the executor cluster,executor will registe automatically and periodically by appName so that it can be scheduled. AppName: the unique identity of the executor cluster,executor will registe automatically and periodically by appName so that it can be scheduled.
名称: the name of ther executor,it is used to describe the executor. 名称: the name of ther executor,it is used to describe the executor.
@ -419,29 +422,29 @@ If you want to create a new executor,please click "+新增执行器" button:
手动录入:fill in executor address manually and it will be used by schedule center, multiple address separated by commas. 手动录入:fill in executor address manually and it will be used by schedule center, multiple address separated by commas.
机器地址:only effective when "注册方式" is "手动录入",support fill in executor address manually. 机器地址:only effective when "注册方式" is "手动录入",support fill in executor address manually.
#### 4.1 create new task ### 4.1 create new task
Go to task management list page,click “新增任务” button on the upper right corneron the pop-up window“新增任务”page configure task property and save.learn more info please go and see "3,task details". Go to task management list page,click “新增任务” button on the upper right corneron the pop-up window“新增任务”page configure task property and save.learn more info please go and see "3,task details".
#### 4.2 edit task ### 4.2 edit task
Go to task management list page and choose the task you want to edit ,click”编辑”button on the right side of the task,on the pop-up window “编辑任务”page edit task property and save. Go to task management list page and choose the task you want to edit ,click”编辑”button on the right side of the task,on the pop-up window “编辑任务”page edit task property and save.
#### 4.3 edit GLUE source code ### 4.3 edit GLUE source code
Only fit to GLUE task. Only fit to GLUE task.
choose the task you want to edit and click” GLUE”button on the right side of the task, it will go to the Web IDE page of GLUE task,then you can edit task source code on this page.you can read "3.2 GLUE模式(Java)" for more info. choose the task you want to edit and click” GLUE”button on the right side of the task, it will go to the Web IDE page of GLUE task,then you can edit task source code on this page.you can read "3.2 GLUE模式(Java)" for more info.
#### 4.4 pause/recover task ### 4.4 pause/recover task
You can pause or recover task but it just fit to follow up schedule trigger and wont affect scheduled tasks,if you want to stop tasks which has been triggered,please go and see “4.8 stop the running task” You can pause or recover task but it just fit to follow up schedule trigger and wont affect scheduled tasks,if you want to stop tasks which has been triggered,please go and see “4.8 stop the running task”
![输入图片说明](https://static.oschina.net/uploads/img/201607/24130337_ZAhX.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24130337_ZAhX.png "在这里输入图片标题")
#### 4.5 manually trigger ### 4.5 manually trigger
You can trigger a task manually by Click “执行”button,it wont affect original scheduling rules. You can trigger a task manually by Click “执行”button,it wont affect original scheduling rules.
![输入图片说明](https://static.oschina.net/uploads/img/201607/24133348_Z5wp.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24133348_Z5wp.png "在这里输入图片标题")
#### 4.6 view schedule log ### 4.6 view schedule log
You can view tasks history schedule log by click “日志” button,on the history schedule log list page you can view every time of tasks schedule result,execution result and so on,click “执行日志” button can view the tasks full execute log. You can view tasks history schedule log by click “日志” button,on the history schedule log list page you can view every time of tasks schedule result,execution result and so on,click “执行日志” button can view the tasks full execute log.
![输入图片说明](https://static.oschina.net/uploads/img/201607/24133500_9235.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24133500_9235.png "在这里输入图片标题")
@ -461,12 +464,12 @@ You can view tasks history schedule log by click “日志” button,on the h
"执行日志"button:click this button you can view tasks execution detail log,go and see chapter 4.7 “view execution log” for more info; "执行日志"button:click this button you can view tasks execution detail log,go and see chapter 4.7 “view execution log” for more info;
"终止任务"button:click this button you can stop the tasks execution thread on this executor,include bloked task instance which didnt has started; "终止任务"button:click this button you can stop the tasks execution thread on this executor,include bloked task instance which didnt has started;
#### 4.7 view execution log ### 4.7 view execution log
Click the “执行日志” button on the right side of the record,you can go to the execution log page,you can view the full execution log of the logic business code, shown as below: Click the “执行日志” button on the right side of the record,you can go to the execution log page,you can view the full execution log of the logic business code, shown as below:
![输入图片说明](https://static.oschina.net/uploads/img/201703/25124816_tvGI.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/25124816_tvGI.png "在这里输入图片标题")
#### 4.8 stop running tasks ### 4.8 stop running tasks
Just fit to running tasks,on the task log list page,click “终止任务” button on the right side of the record, it will send stop command to the executor where the task was executed,finally the task was killed and the task instance execute queue of this task will be clear. Just fit to running tasks,on the task log list page,click “终止任务” button on the right side of the record, it will send stop command to the executor where the task was executed,finally the task was killed and the task instance execute queue of this task will be clear.
![输入图片说明](https://static.oschina.net/uploads/img/201607/24140048_hIci.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24140048_hIci.png "在这里输入图片标题")
@ -488,26 +491,26 @@ try{
If JobHandler start child thread,child thread also must not catch InterruptedException,and it should throw exception. If JobHandler start child thread,child thread also must not catch InterruptedException,and it should throw exception.
#### 4.9 delete execution log ### 4.9 delete execution log
On the task log list page, after you select executor and task, you can click"删除" button on the right side and it will pop-up "日志清理" window,on the pop-up window you can choose different log delete policy,choose the policy you want to execute and click "确定" button it will delele relative logs: On the task log list page, after you select executor and task, you can click"删除" button on the right side and it will pop-up "日志清理" window,on the pop-up window you can choose different log delete policy,choose the policy you want to execute and click "确定" button it will delele relative logs:
![输入图片说明](https://static.oschina.net/uploads/img/201705/08210711_Ypik.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201705/08210711_Ypik.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201705/08211152_EB65.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201705/08211152_EB65.png "在这里输入图片标题")
#### 4.10 delete task ### 4.10 delete task
Click the delete button on the right side of the task,the task will be deteted. Click the delete button on the right side of the task,the task will be deteted.
![输入图片说明](https://static.oschina.net/uploads/img/201607/24140641_Z9Qr.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24140641_Z9Qr.png "在这里输入图片标题")
## 5. Overall design ## 5. Overall design
#### 5.1 Source directory introduction ### 5.1 Source directory introduction
- /doc :documentation and material - /doc :documentation and material
- /db :db scripts - /db :db scripts
- /xxl-job-admin :schedule and admin center - /xxl-job-admin :schedule and admin center
- /xxl-job-core :common core Jar - /xxl-job-core :common core Jar
   - /xxl-job-executor-samples :executorDemo projectyou can develop on this demo project or adjust your own exist project to executor project)    - /xxl-job-executor-samples :executorDemo projectyou can develop on this demo project or adjust your own exist project to executor project)
#### 5.2 configure database ### 5.2 configure database
XXL-JOB schedule module is implemented based on Quartz cluster,its “database” is extended based on Quartzs 11 mysql tables. XXL-JOB schedule module is implemented based on Quartz cluster,its “database” is extended based on Quartzs 11 mysql tables.
XXL-JOB custom Quartz table structure prefix(XXL_JOB_QRTZ_). XXL-JOB custom Quartz table structure prefix(XXL_JOB_QRTZ_).
@ -523,15 +526,15 @@ The added tables as shown below:
So XXL-JOB database total has 16 tables. So XXL-JOB database total has 16 tables.
#### 5.3 Architecture design ### 5.3 Architecture design
##### 5.3.1 Design target #### 5.3.1 Design target
All schedule behavior has been abstracted into “schedule center” common platform , it dosent include business logic and just responsible for starting schedule requests. All schedule behavior has been abstracted into “schedule center” common platform , it dosent include business logic and just responsible for starting schedule requests.
All tasks was abstracted into separate JobHandler and was managed by executors, executor is responsible for receiving schedule request and execute the relative JobHandler business. All tasks was abstracted into separate JobHandler and was managed by executors, executor is responsible for receiving schedule request and execute the relative JobHandler business.
So schedule and task can be decoupled from each other, by the way it can improve the overall stability and scalability of the system. So schedule and task can be decoupled from each other, by the way it can improve the overall stability and scalability of the system.
##### 5.3.2 System composition #### 5.3.2 System composition
- **Schedule moduleschedule center**: - **Schedule moduleschedule center**:
it is responsible for manage schedule info,send schedule request accord task configuration and it is not include an business code.schedule system decouple with the task, improve the overall stability and scalability of the system, at the same time schedule system performance is no longer limited to task modules. it is responsible for manage schedule info,send schedule request accord task configuration and it is not include an business code.schedule system decouple with the task, improve the overall stability and scalability of the system, at the same time schedule system performance is no longer limited to task modules.
Support visualization, simple and dynamic management schedule information, include create,update,delete, GLUE develop and task alarm and so on, All of the above operations will take effect in real timesupport monitor schedule result and execution log and executor failover. Support visualization, simple and dynamic management schedule information, include create,update,delete, GLUE develop and task alarm and so on, All of the above operations will take effect in real timesupport monitor schedule result and execution log and executor failover.
@ -539,24 +542,24 @@ So schedule and task can be decoupled from each other, by the way it can improve
it is responsible for receive schedule request and execute task logic,task module focuses on the execution of the task, Development and maintenance is simpler and more efficient. it is responsible for receive schedule request and execute task logic,task module focuses on the execution of the task, Development and maintenance is simpler and more efficient.
Receive execution request, end request and log request from schedule center. Receive execution request, end request and log request from schedule center.
##### 5.3.3 Architecture diagram #### 5.3.3 Architecture diagram
![输入图片说明](https://static.oschina.net/uploads/img/201707/17190028_aEE2.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201707/17190028_aEE2.png "在这里输入图片标题")
#### 5.4 Schedule module analysis ### 5.4 Schedule module analysis
##### 5.4.1 Disadvantage of quartz #### 5.4.1 Disadvantage of quartz
Quartz is a good open source project and was often as the first choice for job schedule.Tasks was managed by api in quartz cluster so it can avoid some disadvantages of single quartz instance,but it also has some disadvantage as shown below: Quartz is a good open source project and was often as the first choice for job schedule.Tasks was managed by api in quartz cluster so it can avoid some disadvantages of single quartz instance,but it also has some disadvantage as shown below:
- problem 1:it is not humane while operate task by call apill. - problem 1:it is not humane while operate task by call apill.
- problem 2:it is need to store business QuartzJobBean into database, System Invasion is quite serious. - problem 2:it is need to store business QuartzJobBean into database, System Invasion is quite serious.
- problem 3:schedule logic and couple with QuartzJobBean in the same project,it will lead a problem in case that if schedule tasks gradually increased and task logic gradually increased,under this situation the performance of the schedule system will be greatly limited by business. - problem 3:schedule logic and couple with QuartzJobBean in the same project,it will lead a problem in case that if schedule tasks gradually increased and task logic gradually increased,under this situation the performance of the schedule system will be greatly limited by business.
XXL-JOB solve above problems of quartz. XXL-JOB solve above problems of quartz.
##### 5.4.2 RemoteHttpJobBean #### 5.4.2 RemoteHttpJobBean
Under Quartz develop,task logic often was maintained by QuartzJobBean, couple is very serious.in XXL-JOB"Schedule module" and "task module" are completely decoupled,all scheduled tasks in schedule module use the same QuartzJobBean called RemoteHttpJobBean.the params of the tasks was maintained in the extended tables,when trigger RemoteHttpJobBean,it will parse different params and start remote cal l and it wil call relative remote executor. Under Quartz develop,task logic often was maintained by QuartzJobBean, couple is very serious.in XXL-JOB"Schedule module" and "task module" are completely decoupled,all scheduled tasks in schedule module use the same QuartzJobBean called RemoteHttpJobBean.the params of the tasks was maintained in the extended tables,when trigger RemoteHttpJobBean,it will parse different params and start remote cal l and it wil call relative remote executor.
This call module is like RPC,RemoteHttpJobBean provide call proxy functionality,the executor is provided as remote service. This call module is like RPC,RemoteHttpJobBean provide call proxy functionality,the executor is provided as remote service.
##### 5.4.3 Schedule Center HACluster #### 5.4.3 Schedule Center HACluster
It is based on Quartz clusterdatabse use Mysqlwhile QUARTZ task schedule is used in Clustered Distributed Concurrent Environment,all nodes will report task info and store into database.it will fetch trigger from database while execute task,if trigger name and execute time is the same only one node will execute the task. It is based on Quartz clusterdatabse use Mysqlwhile QUARTZ task schedule is used in Clustered Distributed Concurrent Environment,all nodes will report task info and store into database.it will fetch trigger from database while execute task,if trigger name and execute time is the same only one node will execute the task.
``` ```
@ -568,7 +571,7 @@ org.quartz.jobStore.isClustered: true
org.quartz.jobStore.clusterCheckinInterval: 1000 org.quartz.jobStore.clusterCheckinInterval: 1000
``` ```
##### 5.4.4 Schedule threadpool #### 5.4.4 Schedule threadpool
Default threads in the threadpool is 10 so it can avoid task schedule delay because of single thread block. Default threads in the threadpool is 10 so it can avoid task schedule delay because of single thread block.
``` ```
@ -582,12 +585,12 @@ business logic was executed on remote executor in XXL-JOB,schedule center just s
the logic of task in XXL-JOB schedule center is very light and single job average run time alaways under 100ms,most is network time consume.so it can use limited threads to support a large mount of job run concurrently, 10 threads configured above can support at least 100 JOB normal execution. the logic of task in XXL-JOB schedule center is very light and single job average run time alaways under 100ms,most is network time consume.so it can use limited threads to support a large mount of job run concurrently, 10 threads configured above can support at least 100 JOB normal execution.
##### 5.4.5 @DisallowConcurrentExecution #### 5.4.5 @DisallowConcurrentExecution
This annotation is not used default by the schedule center of XXL-JOB schedule module, it use concurrent policy default,because RemoteHttpJobBean is common QuartzJobBean,so it greatly improve the capacity of schedule system and decrease the blocked chance of schedule module in the case of multi-threaded schedule. This annotation is not used default by the schedule center of XXL-JOB schedule module, it use concurrent policy default,because RemoteHttpJobBean is common QuartzJobBean,so it greatly improve the capacity of schedule system and decrease the blocked chance of schedule module in the case of multi-threaded schedule.
Every schedule module was scheduled and executed parallel in XXL-JOB,but tasks in executor is executed serially and support stop task. Every schedule module was scheduled and executed parallel in XXL-JOB,but tasks in executor is executed serially and support stop task.
##### 5.4.6 misfire #### 5.4.6 misfire
The handle policy when miss the jobs trigger time. The handle policy when miss the jobs trigger time.
he reason may be:restart service,schedule thread was blocked by QuartzJobBean, threads was exhausted,some task enable @DisallowConcurrentExecutionthe last schedule was blocked and next schedule was missed. he reason may be:restart service,schedule thread was blocked by QuartzJobBean, threads was exhausted,some task enable @DisallowConcurrentExecutionthe last schedule was blocked and next schedule was missed.
@ -608,7 +611,7 @@ CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(jobIn
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build(); CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
``` ```
##### 5.4.7 log callback service #### 5.4.7 log callback service
When schedule center of the schedule module was deployed as web service, on one side it play as schedule center, on the other side it also provide api service for executor. When schedule center of the schedule module was deployed as web service, on one side it play as schedule center, on the other side it also provide api service for executor.
The source code location of schedule centers “log callback api service” as shown below: The source code location of schedule centers “log callback api service” as shown below:
@ -618,7 +621,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
Executor will execute task when it receive task execute request.it will notify the task execute result to schedule center when the task is done. Executor will execute task when it receive task execute request.it will notify the task execute result to schedule center when the task is done.
##### 5.4.8 task HAFailover #### 5.4.8 task HAFailover
If executor project was deployed as cluster schedule center will known all online executor nodes,such as:“127.0.0.1:9997, 127.0.0.1:9998, 127.0.0.1:9999”. If executor project was deployed as cluster schedule center will known all online executor nodes,such as:“127.0.0.1:9997, 127.0.0.1:9998, 127.0.0.1:9999”.
When "路由策略" select "故障转移(FAILOVER)",it will send heart beat check request in order while schedule center start schedule request. The first alive checked executor node will be selected and send schedule request to it. When "路由策略" select "故障转移(FAILOVER)",it will send heart beat check request in order while schedule center start schedule request. The first alive checked executor node will be selected and send schedule request to it.
@ -629,7 +632,7 @@ When "路由策略" select "故障转移(FAILOVER)",it will send heart beat chec
“调度备注” will display local schedule route path、executors "注册方式"、"地址列表" and tasks "路由策略"。Under "故障转移(FAILOVER)" policy, schedule center take first address to do heartbeat detection, heat beat fail will automatically skip, the second address heart beat fail…… until the third address “127.0.0.1:9999” heart beat success, it was selected as target executor, then send schedule request to target executor, now the schedule process is end wait for the executors callback execution result. “调度备注” will display local schedule route path、executors "注册方式"、"地址列表" and tasks "路由策略"。Under "故障转移(FAILOVER)" policy, schedule center take first address to do heartbeat detection, heat beat fail will automatically skip, the second address heart beat fail…… until the third address “127.0.0.1:9999” heart beat success, it was selected as target executor, then send schedule request to target executor, now the schedule process is end wait for the executors callback execution result.
##### 5.4.9 schedule log #### 5.4.9 schedule log
Every time when task was scheduled in the schedule center it will record a task log, the task log include three part as shown below: Every time when task was scheduled in the schedule center it will record a task log, the task log include three part as shown below:
- 任务信息:include executor address、JobHandler and executor paramsaccord these parameters it can locate specific machine and task code that the task will be executed. - 任务信息:include executor address、JobHandler and executor paramsaccord these parameters it can locate specific machine and task code that the task will be executed.
@ -650,7 +653,7 @@ Schedule log stands fo single task schedule, attribute description is as follows
- 执行备注:task execute remark info in the executor,such as exception log. - 执行备注:task execute remark info in the executor,such as exception log.
- 执行日志:full execution log of the business code during execution of the task,go and see “4.7 view execution log”. - 执行日志:full execution log of the business code during execution of the task,go and see “4.7 view execution log”.
##### 5.4.10 Task dependency #### 5.4.10 Task dependency
principle:every task has a task key in XXL-JOB, every task can configure property “child task Key”,it can match task dependency relationship through task key. principle:every task has a task key in XXL-JOB, every task can configure property “child task Key”,it can match task dependency relationship through task key.
When parent task end execute and success, it will match child task dependency accord child task key, it will trigger child task execute once if it matched child task. When parent task end execute and success, it will match child task dependency accord child task key, it will trigger child task execute once if it matched child task.
@ -661,12 +664,12 @@ On the task log page ,you can see matched child task and triggered child task
![输入图片说明](https://static.oschina.net/uploads/img/201607/24194212_jOAU.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24194212_jOAU.png "在这里输入图片标题")
#### 5.5 Task "run mode" analysis ### 5.5 Task "run mode" analysis
##### 5.5.1 "Bean模式" task #### 5.5.1 "Bean模式" task
Development steps:go and see "chapter 3" . Development steps:go and see "chapter 3" .
principle: every Bean mode task is a Spring Bean instance and it is maintained in executor projects Spring container. task class nedd to add “@JobHander(value="name")” annotation, because executor identify task bean instance in spring container through annotation. Task class nedd to implements interface IJobHandler, task logic code in method execute(), the task logic in execute() method will be executed when executor received a schedule request from schedule center. principle: every Bean mode task is a Spring Bean instance and it is maintained in executor projects Spring container. task class nedd to add “@JobHander(value="name")” annotation, because executor identify task bean instance in spring container through annotation. Task class nedd to implements interface IJobHandler, task logic code in method execute(), the task logic in execute() method will be executed when executor received a schedule request from schedule center.
##### 5.5.2 "GLUE模式(Java)" task #### 5.5.2 "GLUE模式(Java)" task
Development steps:go and see "chapter 3" . Development steps:go and see "chapter 3" .
Principle : every "GLUE模式(Java)" task code is a class implemets interface IJobHandler, when executor received schedule request from schedule center these code will be loaded by Groovy classloader and instantiate into a Java object and inject spring bean service declared in this code at the same timeplease confirm service and class reference in Glue code exist in executor project, then call the objects execute() method and execute task logic. Principle : every "GLUE模式(Java)" task code is a class implemets interface IJobHandler, when executor received schedule request from schedule center these code will be loaded by Groovy classloader and instantiate into a Java object and inject spring bean service declared in this code at the same timeplease confirm service and class reference in Glue code exist in executor project, then call the objects execute() method and execute task logic.
@ -680,7 +683,7 @@ All supported types of scripts as shown beloes:
- python script: python script task will be enabled when select " GLUE模式(Python)"as task run mode. - python script: python script task will be enabled when select " GLUE模式(Python)"as task run mode.
##### 5.5.4 executor #### 5.5.4 executor
Executor is actually an embedded Jetty server with default port 9999, as shown belowparameter:xxl.job.executor.port. Executor is actually an embedded Jetty server with default port 9999, as shown belowparameter:xxl.job.executor.port.
![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题")
@ -689,7 +692,7 @@ Executor will identify Bean mode task in spring container through @JobHander Whe
When executor received schedule request from schedule center, if task type is “Bean模式” it will match bean mode task in Spring container and call its execute() method and execute task logic. if task type is “GLUE模式”, it will load Glue code, instantiate a Java object and inject other spring servicenotice: the spring service injected in Glue code must exist in the same executor project, then call execute() method and execute task logic. When executor received schedule request from schedule center, if task type is “Bean模式” it will match bean mode task in Spring container and call its execute() method and execute task logic. if task type is “GLUE模式”, it will load Glue code, instantiate a Java object and inject other spring servicenotice: the spring service injected in Glue code must exist in the same executor project, then call execute() method and execute task logic.
##### 5.5.5 task log #### 5.5.5 task log
XXL-JOB will generate a log file for every schedule request, the log info will be recorded by XxlJobLogger.log() method, the log file will be loaded when view log info through schedule center. XXL-JOB will generate a log file for every schedule request, the log info will be recorded by XxlJobLogger.log() method, the log file will be loaded when view log info through schedule center.
(history version is implemented by overriding LOG4Js Appender so it exists dependency restrictions, The way has been discraded in the new version) (history version is implemented by overriding LOG4Js Appender so it exists dependency restrictions, The way has been discraded in the new version)
@ -698,17 +701,17 @@ The location of log file can be specified in executor configuration file, defaul
When start child thread in JobHandler, child thread will print log in parent JobHandler threads execute log in order to trace execute log. When start child thread in JobHandler, child thread will print log in parent JobHandler threads execute log in order to trace execute log.
#### 5.6 Communication module analysis ### 5.6 Communication module analysis
##### 5.6.1 A complete task schedule communication process #### 5.6.1 A complete task schedule communication process
- 1,schedule center send http request to executor, and the service in executor in fact is a jetty server with default port 9999. - 1,schedule center send http request to executor, and the service in executor in fact is a jetty server with default port 9999.
- 2,executor execute task logic. - 2,executor execute task logic.
- 3,executor http callback with schedule center for schedule result, the service in schedule center used to receive callback request from executor is a set of api opended to executor. - 3,executor http callback with schedule center for schedule result, the service in schedule center used to receive callback request from executor is a set of api opended to executor.
##### 5.6.2 Encrypt Communication data #### 5.6.2 Encrypt Communication data
When scheduler center send request to executor, it will use RequestModel and ResponseModel object to encapsulate schedule request parameters and response data, these two object will be serialized before communication, data protocol and time stamp will be checked so that achieve data encryption target. When scheduler center send request to executor, it will use RequestModel and ResponseModel object to encapsulate schedule request parameters and response data, these two object will be serialized before communication, data protocol and time stamp will be checked so that achieve data encryption target.
#### 5.7 task register and task auto discover ### 5.7 task register and task auto discover
Task executor machine property has been canceled from v1.5, instead of task register and auto discovery, get remote machine address dynamic. Task executor machine property has been canceled from v1.5, instead of task register and auto discovery, get remote machine address dynamic.
AppName: unique identify of executor cluster, executor is minimal unite of task register, every task recognize machine addresses under the executor on which it was binded. AppName: unique identify of executor cluster, executor is minimal unite of task register, every task recognize machine addresses under the executor on which it was binded.
@ -717,10 +720,10 @@ Task executor machine property has been canceled from v1.5, instead of task regi
To ensure system lightweight and reduce learning costs, it did not use Zookeeper as register center, Use DB as register center to do task registration. To ensure system lightweight and reduce learning costs, it did not use Zookeeper as register center, Use DB as register center to do task registration.
#### 5.8 task execute result ### 5.8 task execute result
Since v1.6.2, the task execute result is recognized through ReturnT of IJobHandler, it executes success when return value meets the condition "ReturnT.code == ReturnT.SUCCESS_CODE" , or it executes fail, and it can callback error message info to schedule center through ReturnT.msg, so it can control task execute results in the task logic. Since v1.6.2, the task execute result is recognized through ReturnT of IJobHandler, it executes success when return value meets the condition "ReturnT.code == ReturnT.SUCCESS_CODE" , or it executes fail, and it can callback error message info to schedule center through ReturnT.msg, so it can control task execute results in the task logic.
#### 5.9 slice broadcat & dynamic slice ### 5.9 slice broadcat & dynamic slice
When “分片广播” is selected as route policy in executor cluster, one task schedule will broadcast all executor node in cluster to trigger task execute in every executor, pass slice parameter at the same time, so we can develop slice task by slice parameters. When “分片广播” is selected as route policy in executor cluster, one task schedule will broadcast all executor node in cluster to trigger task execute in every executor, pass slice parameter at the same time, so we can develop slice task by slice parameters.
"分片广播" break the task by the dimensions of executor, support dynamic extend executor cluster so that it can add slice number dynamically to do business process, In case of large amount of data process can significantly improve task processing capacity and speed. "分片广播" break the task by the dimensions of executor, support dynamic extend executor cluster so that it can add slice number dynamically to do business process, In case of large amount of data process can significantly improve task processing capacity and speed.
@ -738,7 +741,7 @@ This feature applies to scenes as shown below:
- 1、slice task scene:when 10 executor to handle 10w records, 1w records need to be handled per machine, time-consuming 10 times lower - 1、slice task scene:when 10 executor to handle 10w records, 1w records need to be handled per machine, time-consuming 10 times lower
- 2、Broadcast task scene:broadcast all cluster nodes to execute shell script、broadcast all cluster nodes to update cache. - 2、Broadcast task scene:broadcast all cluster nodes to execute shell script、broadcast all cluster nodes to update cache.
#### 5.10 AccessToken ### 5.10 AccessToken
To improve system security it is need to check security between schedule center and executor, just allow communication between them when AccessToken of each other matched. To improve system security it is need to check security between schedule center and executor, just allow communication between them when AccessToken of each other matched.
The AccessToken of scheduler center and executor can be configured by xxl.job.accessToken. The AccessToken of scheduler center and executor can be configured by xxl.job.accessToken.
@ -750,7 +753,7 @@ There are only two settings when communication between scheduler center and exec
## 6 Version update log ## 6 Version update log
#### 6.1 version V1.1.xNew features [2015-12-05] ### 6.1 version V1.1.xNew features [2015-12-05]
**【since V1.1.xXXL-JOB was used by company hiring mealias Ferrari inner companythe latest version is recommended for new project】** **【since V1.1.xXXL-JOB was used by company hiring mealias Ferrari inner companythe latest version is recommended for new project】**
- 1、simple:support CRUD operation through Web page, simple and one minute to get started; - 1、simple:support CRUD operation through Web page, simple and one minute to get started;
- 2、dynamic:support dynamic update task status,pause/recover task and effective in real time; - 2、dynamic:support dynamic update task status,pause/recover task and effective in real time;
@ -761,7 +764,7 @@ There are only two settings when communication between scheduler center and exec
- 7、support for custom parameters; - 7、support for custom parameters;
- 8、Support pause task execution remotely . - 8、Support pause task execution remotely .
#### 6.2 version V1.2.xNew features [2016-01-17] ### 6.2 version V1.2.xNew features [2016-01-17]
- 1、support task group; - 1、support task group;
- 2、suport local task, remote task; - 2、suport local task, remote task;
- 3、support two types underlying communication ,Servlet or JETTY; - 3、support two types underlying communication ,Servlet or JETTY;
@ -779,7 +782,7 @@ There are only two settings when communication between scheduler center and exec
- High scalability; - High scalability;
- stability; - stability;
#### 6.3 version V1.3.0New features [2016-05-19] ### 6.3 version V1.3.0New features [2016-05-19]
- 1、discard local task module, remote task was recommended, easy to decouple system, the JobHander of task was called executor. - 1、discard local task module, remote task was recommended, easy to decouple system, the JobHander of task was called executor.
- 2、dicard underlying communication type servlet, JETTY was recommended, schedule and callback bidirectional communication, rebuild the communication logic; - 2、dicard underlying communication type servlet, JETTY was recommended, schedule and callback bidirectional communication, rebuild the communication logic;
- 3、UI interactive optimization:optimize left menu expansion and menu item selected status , task list opens the table with compression optimization; - 3、UI interactive optimization:optimize left menu expansion and menu item selected status , task list opens the table with compression optimization;
@ -789,7 +792,7 @@ There are only two settings when communication between scheduler center and exec
- BEAN mode executor:every executor is a Spring Bean instanceit was recognized and scheduled by XXL-JOB through @JobHander annotation; - BEAN mode executor:every executor is a Spring Bean instanceit was recognized and scheduled by XXL-JOB through @JobHander annotation;
-GLUE mode executor:every executor corresponds to a piece of codeedited and maintained online by Web, Dynamic compile and takes effect in real time, executor is responsible for loading GLUE code and executing; -GLUE mode executor:every executor corresponds to a piece of codeedited and maintained online by Web, Dynamic compile and takes effect in real time, executor is responsible for loading GLUE code and executing;
#### 6.4 version V1.3.1New features [2016-05-23] ### 6.4 version V1.3.1New features [2016-05-23]
- 1、Update project directory structure: - 1、Update project directory structure:
- /xxl-job-admin -------------------- 【schedule center】:Responsible for managing schedule informationsend schedule request according to schedule configuration; - /xxl-job-admin -------------------- 【schedule center】:Responsible for managing schedule informationsend schedule request according to schedule configuration;
- /xxl-job-core ----------------------- Public core dependence - /xxl-job-core ----------------------- Public core dependence
@ -799,12 +802,12 @@ There are only two settings when communication between scheduler center and exec
- 2、Upgrade the user manual under the new directory structure; - 2、Upgrade the user manual under the new directory structure;
- 3、Optimize some interactions and UI; - 3、Optimize some interactions and UI;
#### 6.5 version V1.3.2New features [2016-05-28] ### 6.5 version V1.3.2New features [2016-05-28]
- 1、Schedule logic for transactional handle; - 1、Schedule logic for transactional handle;
- 2、executor asynchronous callback execution log; - 2、executor asynchronous callback execution log;
- 3、【important】based on HA support of schedule centerextend executors Failover supportSupport configure multiple execution addresses; - 3、【important】based on HA support of schedule centerextend executors Failover supportSupport configure multiple execution addresses;
#### 6.6 version V1.4.0 New features [2016-07-24] ### 6.6 version V1.4.0 New features [2016-07-24]
- 1、Task dependency: it is implemented by trigger event, it will automatically trigger a child task schedule after Task execute success and callback, multiple child tasks are separated by commas; - 1、Task dependency: it is implemented by trigger event, it will automatically trigger a child task schedule after Task execute success and callback, multiple child tasks are separated by commas;
- 2、executor source code has been reconstructed, optimize underlying db script; - 2、executor source code has been reconstructed, optimize underlying db script;
- 3、optimize task thread group logic of executor, before it is group by executors JobHandler so when multiple task reuse Jobhanlder will cause block with each other. Now it is grouped by task of schedule center so tasks are isolated from task execution. - 3、optimize task thread group logic of executor, before it is group by executors JobHandler so when multiple task reuse Jobhanlder will cause block with each other. Now it is grouped by task of schedule center so tasks are isolated from task execution.
@ -823,7 +826,7 @@ There are only two settings when communication between scheduler center and exec
Tips: V1.3.x release has been published , enter the maintenance phase, branch address is [V1.3](https://github.com/xuxueli/xxl-job/tree/v1.3) .New features will be updated continuously in the master branch. Tips: V1.3.x release has been published , enter the maintenance phase, branch address is [V1.3](https://github.com/xuxueli/xxl-job/tree/v1.3) .New features will be updated continuously in the master branch.
#### 6.7 version V1.4.1 New features [2016-09-06] ### 6.7 version V1.4.1 New features [2016-09-06]
- 1、project successfully pushed to maven central warehouse, Central warehouse address and dependency as shown below: - 1、project successfully pushed to maven central warehouse, Central warehouse address and dependency as shown below:
``` ```
<!-- http://repo1.maven.org/maven2/com/xuxueli/xxl-job-core/ --> <!-- http://repo1.maven.org/maven2/com/xuxueli/xxl-job-core/ -->
@ -841,14 +844,14 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 7、optimize table structure and the table name now is upper case; - 7、optimize table structure and the table name now is upper case;
- 8、modify ContentType of JSON response from exception handler of schedule center to fix the bug that it is could not recognized by browser. - 8、modify ContentType of JSON response from exception handler of schedule center to fix the bug that it is could not recognized by browser.
#### 6.8 version V1.4.2 New features [2016-09-29] ### 6.8 version V1.4.2 New features [2016-09-29]
- 1、push V1.4.2 to maven central warehouse, main version V1.4 enter maintenance phase; - 1、push V1.4.2 to maven central warehouse, main version V1.4 enter maintenance phase;
- 2、fix problem task list offset when add task; - 2、fix problem task list offset when add task;
- 3、fix a style disorder problem that caused by bootstrap does not support the modal frame overlap , the problem occurs when the task is edited; - 3、fix a style disorder problem that caused by bootstrap does not support the modal frame overlap , the problem occurs when the task is edited;
- 4、optimize schedule status when schedule timeout and Handler could not matched; - 4、optimize schedule status when schedule timeout and Handler could not matched;
- 5、the task could not stop problem caused by catch exception has given solution; - 5、the task could not stop problem caused by catch exception has given solution;
#### 6.9 version V1.5.0 New features [2016-11-13] ### 6.9 version V1.5.0 New features [2016-11-13]
- 1、task register: executor registers the task automatically, schedule center will automatically discover the registered task and trigger execution. - 1、task register: executor registers the task automatically, schedule center will automatically discover the registered task and trigger execution.
- 2、add parameter AppName for executor: AppName is the unique identifier of each executor cluster, register periodically and automatically with AppName. - 2、add parameter AppName for executor: AppName is the unique identifier of each executor cluster, register periodically and automatically with AppName.
- 3、add column executor management in schedule center : manage online executors, automatically discover registered executors via the property AppName。Only managed executors are allowed to be used; - 3、add column executor management in schedule center : manage online executors, automatically discover registered executors via the property AppName。Only managed executors are allowed to be used;
@ -858,14 +861,14 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 7、adjust table structure, reconstruct the project; - 7、adjust table structure, reconstruct the project;
- 8、schedule center automatically registered and found, failover: schedule center periodically registered automatically, task callback can recognize all online schedule center addresses, task callback support failover so that it can avoid single point of risk. - 8、schedule center automatically registered and found, failover: schedule center periodically registered automatically, task callback can recognize all online schedule center addresses, task callback support failover so that it can avoid single point of risk.
#### 6.10 version V1.5.1 New features [2016-11-13] ### 6.10 version V1.5.1 New features [2016-11-13]
- 1、Reconstruct the underlying code and optimize logic, clean POM and Clean Code; - 1、Reconstruct the underlying code and optimize logic, clean POM and Clean Code;
- 2、Servlet/JSP Spec selected 3.0/2.2; - 2、Servlet/JSP Spec selected 3.0/2.2;
- 3、Spring updated to 3.2.17.RELEASE version; - 3、Spring updated to 3.2.17.RELEASE version;
- 4、Jetty updated to version 8.2.0.v20160908; - 4、Jetty updated to version 8.2.0.v20160908;
- 5、has push V1.5.0 and V1.5.1 to maven central warehouse; - 5、has push V1.5.0 and V1.5.1 to maven central warehouse;
#### 6.10 version V1.5.2 New features [2017-02-28] ### 6.10 version V1.5.2 New features [2017-02-28]
- 1、optimize IP tools class which used to gets IP addressIP static cache; - 1、optimize IP tools class which used to gets IP addressIP static cache;
- 2、both executor and schedule center support customize registered IP address;Solve problem when machine has multiple network card and get the wrong card; - 2、both executor and schedule center support customize registered IP address;Solve problem when machine has multiple network card and get the wrong card;
- 3、solve the problem that it will generate multiple log files when executed across days; - 3、solve the problem that it will generate multiple log files when executed across days;
@ -875,7 +878,7 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 7、reconstruct underlying code and optimize logic and Clean Code; - 7、reconstruct underlying code and optimize logic and Clean Code;
- 8、optimize Dependency Injection Logic of GLUE, support injected as alias; - 8、optimize Dependency Injection Logic of GLUE, support injected as alias;
#### 6.11 version V1.6.0 New features [2017-03-13] ### 6.11 version V1.6.0 New features [2017-03-13]
- 1、upgrade communication schemethe HEX communication model is adjusted to the B-RPC model based on HTTP; - 1、upgrade communication schemethe HEX communication model is adjusted to the B-RPC model based on HTTP;
- 2、executor supports set execution address list manuallyprovide switch to use automatically registered address or manually set address; - 2、executor supports set execution address list manuallyprovide switch to use automatically registered address or manually set address;
- 3、executor route rules:第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移; - 3、executor route rules:第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移;
@ -886,20 +889,20 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 8、new created task defaults to a non-running state; - 8、new created task defaults to a non-running state;
- 9、optimize update logic of GLUE mode task instance , The original update is based on the timeout value and now is updated according to the version numberversion number plus one while source changed; - 9、optimize update logic of GLUE mode task instance , The original update is based on the timeout value and now is updated according to the version numberversion number plus one while source changed;
#### 6.12 version V1.6.1 New features [2017-03-25] ### 6.12 version V1.6.1 New features [2017-03-25]
- 1、Rolling log; - 1、Rolling log;
- 2、reconstruct WebIDE interactive; - 2、reconstruct WebIDE interactive;
- 3、enhanced communication checkfilter unnormal requests effectively; - 3、enhanced communication checkfilter unnormal requests effectively;
- 4、enhanced permission checkUsing dynamic login TOKENrecommend instead of internal SSO; - 4、enhanced permission checkUsing dynamic login TOKENrecommend instead of internal SSO;
- 5、optimize database configurationsolve garbled problem; - 5、optimize database configurationsolve garbled problem;
#### 6.13 version V1.6.2 New features [2017-04-25] ### 6.13 version V1.6.2 New features [2017-04-25]
- 1、execution report:support view run time data in real time, such as task number, total schedule number, executor number etc., include schedule report , such as scheduled distribution graph on date, scheduled success distribution graph etc; - 1、execution report:support view run time data in real time, such as task number, total schedule number, executor number etc., include schedule report , such as scheduled distribution graph on date, scheduled success distribution graph etc;
- 2、JobHandler support set return value for tasks, it is easy to control task execute result in task logic; - 2、JobHandler support set return value for tasks, it is easy to control task execute result in task logic;
- 3、the problem could not view exception info when resource path include space or chinese word casused resource file could not be loaded; - 3、the problem could not view exception info when resource path include space or chinese word casused resource file could not be loaded;
- 4、optimize route policy:fix problems that Loop and LFU routing policy counters are no limit and first route is focused on the first machine; - 4、optimize route policy:fix problems that Loop and LFU routing policy counters are no limit and first route is focused on the first machine;
#### 6.14 version V1.7.0 New features [2017-05-02] ### 6.14 version V1.7.0 New features [2017-05-02]
- 1、script task:support develop and run script task by GLUE, include script type such as Shell、Python and Groovy; - 1、script task:support develop and run script task by GLUE, include script type such as Shell、Python and Groovy;
- 2、add spring-boot type executor example project; - 2、add spring-boot type executor example project;
- 3、upgrade jetty to version 9.2; - 3、upgrade jetty to version 9.2;
@ -907,7 +910,7 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 5、executor remove GlueLoader dependencyinstead of push modethus GLUE source code load no longer rely on JDBC; - 5、executor remove GlueLoader dependencyinstead of push modethus GLUE source code load no longer rely on JDBC;
- 6、get the project name when login and redirect, solve 404 problem when it is not deployed by the directory; - 6、get the project name when login and redirect, solve 404 problem when it is not deployed by the directory;
#### 6.15 version V1.7.1 New features [2017-05-08] ### 6.15 version V1.7.1 New features [2017-05-08]
- 1、unified write and read code of execute log as UTF-8solve log garbled problem under windows environment; - 1、unified write and read code of execute log as UTF-8solve log garbled problem under windows environment;
- 2、communication timeout period is limited to 10sTo avoid schedule thread is occupied under abnormal situation; - 2、communication timeout period is limited to 10sTo avoid schedule thread is occupied under abnormal situation;
- 3、adjust executor , server stat, destroy and register logic; - 3、adjust executor , server stat, destroy and register logic;
@ -917,7 +920,7 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 7、pop-up component is replaced by layer; - 7、pop-up component is replaced by layer;
- 8、upgrade quartz to version 2.3.0; - 8、upgrade quartz to version 2.3.0;
#### 6.16 version V1.7.2 New features [2017-05-17] ### 6.16 version V1.7.2 New features [2017-05-17]
- 1、block handle policy:the policy when schedule is too frequently and the executor it too late to handle, include multiple strategies:single machine serially executedefault、discard subsequent schedule、override before schedule; - 1、block handle policy:the policy when schedule is too frequently and the executor it too late to handle, include multiple strategies:single machine serially executedefault、discard subsequent schedule、override before schedule;
- 2、fail handle policy:handle policy when scheduled fail, include :failure alarmdefault、failed to retry; - 2、fail handle policy:handle policy when scheduled fail, include :failure alarmdefault、failed to retry;
- 3、The communication timeout is adjusted to 180s; - 3、The communication timeout is adjusted to 180s;
@ -925,7 +928,7 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 5、fix executor parameters lost bug when edit; - 5、fix executor parameters lost bug when edit;
- 6、add task test Demo to make task logic test easier; - 6、add task test Demo to make task logic test easier;
#### 6.17 version V1.8.0 New features [2017-07-17] ### 6.17 version V1.8.0 New features [2017-07-17]
- 1、optimize update logic of task Croninstead of rescheduleJobat the same time preventing set cron repeatedly; - 1、optimize update logic of task Croninstead of rescheduleJobat the same time preventing set cron repeatedly;
- 2、optimize API callback service failed status codefacilitate troubleshooting; - 2、optimize API callback service failed status codefacilitate troubleshooting;
- 3、XxlJobLogger support multi-parameter; - 3、XxlJobLogger support multi-parameter;
@ -938,7 +941,7 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 10、supports filter execute log based on running status; - 10、supports filter execute log based on running status;
- 11、optimize scheduling Center Task Registration Detection Logic; - 11、optimize scheduling Center Task Registration Detection Logic;
#### 6.18 version V1.8.1 New features [2017-07-30] ### 6.18 version V1.8.1 New features [2017-07-30]
- 1、slice broadcast task:When slice broadcast is selected as route policy in executor cluster, one task schedule will broadcast all executor node in cluster to trigger task execute in every executor, pass slice parameter at the same time, so we can develop slice task by slice parameters; - 1、slice broadcast task:When slice broadcast is selected as route policy in executor cluster, one task schedule will broadcast all executor node in cluster to trigger task execute in every executor, pass slice parameter at the same time, so we can develop slice task by slice parameters;
- 2、dynamic slice: break the task by the dimensions of executor, support dynamic extend executor cluster so that it can add slice number dynamically to do business process, In case of large amount of data process can significantly improve task processing capacity and speed; - 2、dynamic slice: break the task by the dimensions of executor, support dynamic extend executor cluster so that it can add slice number dynamically to do business process, In case of large amount of data process can significantly improve task processing capacity and speed;
- 3、executor JobHandler disables name conflicts; - 3、executor JobHandler disables name conflicts;
@ -951,12 +954,12 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
- 10、upgrade springboot version to 1.5.6.RELEASE of executor; - 10、upgrade springboot version to 1.5.6.RELEASE of executor;
- 11、unify maven version dependency management; - 11、unify maven version dependency management;
#### 6.19 version V1.8.2 New features[Coding] ### 6.19 version V1.8.2 New features[Coding]
- 1,support configuring the HTTPS for executor callback URL; - 1,support configuring the HTTPS for executor callback URL;
- 2,Standardize project directory for extend multi executors; - 2,Standardize project directory for extend multi executors;
- 3,add JFinal type executor sample project; - 3,add JFinal type executor sample project;
#### TODO LIST ### TODO LIST
- 1,Task privilege management:control privilege on executor, check privilege on core operations; - 1,Task privilege management:control privilege on executor, check privilege on core operations;
- 2,Task slice routing:using consistent Hash algorithm to calculate slice order as stable as possible, even if there is fluctuation in the registration machine will not cause large fluctuations in the order of slice. Currently using IP natural sorting can meet the demandto be determined; - 2,Task slice routing:using consistent Hash algorithm to calculate slice order as stable as possible, even if there is fluctuation in the registration machine will not cause large fluctuations in the order of slice. Currently using IP natural sorting can meet the demandto be determined;
- 3,Failure retry optimization:The current failure to retry logic is execute the request logic once again after the scheduled request fails。The optimization point is retry for both scheduling and execution failures, retry a full schedule when retryingThis may lead schedule failure to an infinite loopto be determined; - 3,Failure retry optimization:The current failure to retry logic is execute the request logic once again after the scheduled request fails。The optimization point is retry for both scheduling and execution failures, retry a full schedule when retryingThis may lead schedule failure to an infinite loopto be determined;
@ -970,22 +973,22 @@ Tips: V1.3.x release has been published , enter the maintenance phase, branch a
## 7. Other ## 7. Other
#### 7.1 report problem ### 7.1 Contributing
XXL-JOB project is on GithubIf you have any questions, you can ask questions at [ISSUES](https://github.com/xuxueli/xxl-job/issues/) You can also join the above technical exchange group; Contributions are welcome! Open a pull request to fix a bug, or open an [Issue](https://github.com/xuxueli/xxl-job/issues/) to discuss a new feature or change.
#### 7.2 used recordsrecord just for spreadProduct is open source and free of charge ### 7.2 used recordsrecord just for spreadProduct is open source and free of charge
Record for spread product and product is free and open source. Record for spread product and product is free and open source.
Welcome to [check in](https://github.com/xuxueli/xxl-job/issues/1 )on github. Welcome to [check in](https://github.com/xuxueli/xxl-job/issues/1 )on github.
#### 7.3 Open source protocol and version ### 7.3 Copyright and License
Product is open source and free of chargewill provide free community technical support continuously,Personal or company internal free access and use. This product is open source and free, and will continue to provide free community technical support. Individual or enterprise users are free to access and use.
XXL-JOB uses GPLv3 protocol to ensure the user's right of free use. The agreement avoids special risk of patent applications "the GPL assures that patents cannot be used to render the program non-free.From GPLv3". - Licensed under the GNU General Public License (GPL) v3.
Copyright (c) 2015-present, xuxueli. - Copyright (c) 2015-present, xuxueli.
--- ---
#### donation ### Donate
scan it if want to support projectreward a cup of coffee to author: To support the author, donate the author to buy a cup of coffee
webchat:![输入图片说明](https://static.oschina.net/uploads/img/201707/07214300_qhxT.png "在这里输入图片标题") webchat:![输入图片说明](https://static.oschina.net/uploads/img/201707/07214300_qhxT.png "在这里输入图片标题")
Alipay:![输入图片说明](http://images2015.cnblogs.com/blog/554415/201605/554415-20160513183306234-1939652116.png "在这里输入图片标题") Alipay:![输入图片说明](http://images2015.cnblogs.com/blog/554415/201605/554415-20160513183306234-1939652116.png "在这里输入图片标题")

View File

@ -1,4 +1,4 @@
# 《分布式任务调度平台XXL-JOB》 ## 《分布式任务调度平台XXL-JOB》
[![Build Status](https://travis-ci.org/xuxueli/xxl-job.svg?branch=master)](https://travis-ci.org/xuxueli/xxl-job) [![Build Status](https://travis-ci.org/xuxueli/xxl-job.svg?branch=master)](https://travis-ci.org/xuxueli/xxl-job)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.xuxueli/xxl-job/)
@ -48,7 +48,7 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
于2017-05-13在上海举办的 "[第62期开源中国源创会](https://www.oschina.net/event/2236961)" 的 "放码过来" 环节我登台对XXL-JOB做了演讲台下五百位在场观众反响热烈[图文回顾](https://www.oschina.net/question/2686220_2242120) )。 于2017-05-13在上海举办的 "[第62期开源中国源创会](https://www.oschina.net/event/2236961)" 的 "放码过来" 环节我登台对XXL-JOB做了演讲台下五百位在场观众反响热烈[图文回顾](https://www.oschina.net/question/2686220_2242120) )。
#### 我司大众点评目前已接入XXL-JOB内部别名《Ferrari》Ferrari基于XXL-JOB的V1.1版本定制而成,新接入应用推荐升级最新版本)。 > 我司大众点评目前已接入XXL-JOB内部别名《Ferrari》Ferrari基于XXL-JOB的V1.1版本定制而成,新接入应用推荐升级最新版本)。
据最新统计, 自2016-01-21接入至2017-07-07期间该系统已调度约60万余次表现优异。新接入应用推荐使用最新版本因为经过数个大版本的更新系统的任务模型、UI交互模型以及底层调度通讯模型都有了较大的优化和提升核心功能更加稳定高效。 据最新统计, 自2016-01-21接入至2017-07-07期间该系统已调度约60万余次表现优异。新接入应用推荐使用最新版本因为经过数个大版本的更新系统的任务模型、UI交互模型以及底层调度通讯模型都有了较大的优化和提升核心功能更加稳定高效。
至今XXL-JOB已接入多家公司的线上产品线接入场景如电商业务O2O业务和大数据作业等截止2016-07-19为止XXL-JOB已接入的公司包括不限于 至今XXL-JOB已接入多家公司的线上产品线接入场景如电商业务O2O业务和大数据作业等截止2016-07-19为止XXL-JOB已接入的公司包括不限于
@ -91,10 +91,18 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
- 36、增长引擎(北京)信息技术有限公司 - 36、增长引擎(北京)信息技术有限公司
- …… - ……
> 更多接入的公司,欢迎在 [登记地址](https://github.com/xuxueli/xxl-job/issues/1 ) 登记,登记仅仅为了产品推广。
欢迎大家的关注和使用XXL-JOB也将拥抱变化持续发展。 欢迎大家的关注和使用XXL-JOB也将拥抱变化持续发展。
### 1.4 下载 ### 1.4 下载
#### 文档地址
- [中文文档](http://www.xuxueli.com/xxl-job/)
- [English Documentation](http://www.xuxueli.com/xxl-job/en/)
#### 源码仓库地址 #### 源码仓库地址
源码仓库地址 | Release Download 源码仓库地址 | Release Download
@ -114,11 +122,6 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
</dependency> </dependency>
``` ```
#### 博客地址
- [oschina地址](http://my.oschina.net/xuxueli/blog/690978)
- [cnblogs地址](http://www.cnblogs.com/xuxueli/p/5021979.html)
#### 技术交流 #### 技术交流
- 腾讯QQ群6399758605 - 腾讯QQ群6399758605
@ -287,7 +290,7 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
本示例以新建一个 “GLUE模式(Java)” 运行模式的任务为例。更多有关任务的详细配置,请查看“章节三:任务详解”。 本示例以新建一个 “GLUE模式(Java)” 运行模式的任务为例。更多有关任务的详细配置,请查看“章节三:任务详解”。
“GLUE模式(Java)”的执行代码托管到调度中心在线维护相比“Bean模式任务”需要在执行器项目开发部署上线更加简便轻量 “GLUE模式(Java)”的执行代码托管到调度中心在线维护相比“Bean模式任务”需要在执行器项目开发部署上线更加简便轻量
#### 前提:请确认“调度中心”和“执行器”项目已经成功部署并启动; > 前提:请确认“调度中心”和“执行器”项目已经成功部署并启动;
#### 步骤一:新建任务: #### 步骤一:新建任务:
登录调度中心,点击下图所示“新建任务”按钮,新建示例任务。然后,参考下面截图中任务的参数配置,点击保存。 登录调度中心,点击下图所示“新建任务”按钮,新建示例任务。然后,参考下面截图中任务的参数配置,点击保存。
@ -411,7 +414,8 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
## 四、任务管理 ## 四、任务管理
#### 4.0 配置执行器
### 4.0 配置执行器
点击进入"执行器管理"界面, 如下图: 点击进入"执行器管理"界面, 如下图:
![输入图片说明](https://static.oschina.net/uploads/img/201703/12223509_Hr2T.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/12223509_Hr2T.png "在这里输入图片标题")
@ -421,7 +425,7 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
点击按钮 "+新增执行器" 弹框如下图, 可新增执行器配置: 点击按钮 "+新增执行器" 弹框如下图, 可新增执行器配置:
![输入图片说明](https://static.oschina.net/uploads/img/201703/12223617_g3Im.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/12223617_g3Im.png "在这里输入图片标题")
#### 执行器属性说明 ### 执行器属性说明
AppName: 是每个执行器集群的唯一标示AppName, 执行器会周期性以AppName为对象进行自动注册。可通过该配置自动发现注册成功的执行器, 供任务调度时使用; AppName: 是每个执行器集群的唯一标示AppName, 执行器会周期性以AppName为对象进行自动注册。可通过该配置自动发现注册成功的执行器, 供任务调度时使用;
名称: 执行器的名称, 因为AppName限制字母数字等组成,可读性不强, 名称为了提高执行器的可读性; 名称: 执行器的名称, 因为AppName限制字母数字等组成,可读性不强, 名称为了提高执行器的可读性;
@ -431,30 +435,30 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
手动录入:人工手动录入执行器的地址信息,多地址逗号分隔,供调度中心使用; 手动录入:人工手动录入执行器的地址信息,多地址逗号分隔,供调度中心使用;
机器地址:"注册方式"为"手动录入"时有效,支持人工维护执行器的地址信息; 机器地址:"注册方式"为"手动录入"时有效,支持人工维护执行器的地址信息;
#### 4.1 新建任务 ### 4.1 新建任务
进入任务管理界面,点击“新增任务”按钮,在弹出的“新增任务”界面配置任务属性后保存即可。详情页参考章节 "三、任务详解"。 进入任务管理界面,点击“新增任务”按钮,在弹出的“新增任务”界面配置任务属性后保存即可。详情页参考章节 "三、任务详解"。
#### 4.2 编辑任务 ### 4.2 编辑任务
进入任务管理界面,选中指定任务。点击该任务右侧“编辑”按钮,在弹出的“编辑任务”界面更新任务属性后保存即可,可以修改设置的任务属性信息: 进入任务管理界面,选中指定任务。点击该任务右侧“编辑”按钮,在弹出的“编辑任务”界面更新任务属性后保存即可,可以修改设置的任务属性信息:
#### 4.3 编辑GLUE代码 ### 4.3 编辑GLUE代码
该操作仅针对GLUE任务。 该操作仅针对GLUE任务。
选中指定任务点击该任务右侧“GLUE”按钮将会前往GLUE任务的Web IDE界面在该界面支持对任务代码进行开发。可参考章节 "3.2 GLUE模式(Java)"。 选中指定任务点击该任务右侧“GLUE”按钮将会前往GLUE任务的Web IDE界面在该界面支持对任务代码进行开发。可参考章节 "3.2 GLUE模式(Java)"。
#### 4.4 暂停/恢复任务 ### 4.4 暂停/恢复任务
可对任务进行“暂停”和“恢复”操作。 可对任务进行“暂停”和“恢复”操作。
需要注意的是,此处的暂停/恢复仅针对任务的后续调度触发行为不会影响到已经触发的调度任务如需终止已经触发的调度任务可查看“4.8 终止运行中的任务” 需要注意的是,此处的暂停/恢复仅针对任务的后续调度触发行为不会影响到已经触发的调度任务如需终止已经触发的调度任务可查看“4.8 终止运行中的任务”
![输入图片说明](https://static.oschina.net/uploads/img/201607/24130337_ZAhX.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24130337_ZAhX.png "在这里输入图片标题")
#### 4.5 手动触发一次调度 ### 4.5 手动触发一次调度
点击“执行”按钮,可手动触发一次任务调度,不影响原有调度规则。 点击“执行”按钮,可手动触发一次任务调度,不影响原有调度规则。
![输入图片说明](https://static.oschina.net/uploads/img/201607/24133348_Z5wp.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24133348_Z5wp.png "在这里输入图片标题")
#### 4.6 查看调度日志 ### 4.6 查看调度日志
点击“日志”按钮,可以查看任务历史调度日志。在历史调入日志界面可查看每次任务调度的调度结果、执行结果等,点击“执行日志”按钮可查看执行器完整日志。 点击“日志”按钮,可以查看任务历史调度日志。在历史调入日志界面可查看每次任务调度的调度结果、执行结果等,点击“执行日志”按钮可查看执行器完整日志。
![输入图片说明](https://static.oschina.net/uploads/img/201607/24133500_9235.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24133500_9235.png "在这里输入图片标题")
@ -474,12 +478,12 @@ XXL-JOB是一个轻量级分布式任务调度框架其核心设计目标是
"执行日志"按钮点击可查看本地任务执行的详细日志信息详见“4.7 查看执行日志”; "执行日志"按钮点击可查看本地任务执行的详细日志信息详见“4.7 查看执行日志”;
"终止任务"按钮:点击可终止本地调度对应执行器上本任务的执行线程,包括未执行的阻塞任务一并被终止; "终止任务"按钮:点击可终止本地调度对应执行器上本任务的执行线程,包括未执行的阻塞任务一并被终止;
#### 4.7 查看执行日志 ### 4.7 查看执行日志
点击执行日志右侧的 “执行日志” 按钮,可跳转至执行日志界面,可以查看业务代码中打印的完整日志,如下图; 点击执行日志右侧的 “执行日志” 按钮,可跳转至执行日志界面,可以查看业务代码中打印的完整日志,如下图;
![输入图片说明](https://static.oschina.net/uploads/img/201703/25124816_tvGI.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/25124816_tvGI.png "在这里输入图片标题")
#### 4.8 终止运行中的任务 ### 4.8 终止运行中的任务
仅针对执行中的任务。 仅针对执行中的任务。
在任务日志界面,点击右侧的“终止任务”按钮,将会向本次任务对应的执行器发送任务终止请求,将会终止掉本次任务,同时会清空掉整个任务执行队列。 在任务日志界面,点击右侧的“终止任务”按钮,将会向本次任务对应的执行器发送任务终止请求,将会终止掉本次任务,同时会清空掉整个任务执行队列。
@ -502,26 +506,27 @@ try{
而且在JobHandler中开启子线程时子线程也不可catch处理"InterruptedException",应该主动向上抛出。 而且在JobHandler中开启子线程时子线程也不可catch处理"InterruptedException",应该主动向上抛出。
#### 4.9 删除执行日志 ### 4.9 删除执行日志
在任务日志界面,选中执行器和任务之后,点击右侧的"删除"按钮将会出现"日志清理"弹框,弹框中支持选择不同类型的日志清理策略,选中后点击"确定"按钮即可进行日志清理操作; 在任务日志界面,选中执行器和任务之后,点击右侧的"删除"按钮将会出现"日志清理"弹框,弹框中支持选择不同类型的日志清理策略,选中后点击"确定"按钮即可进行日志清理操作;
![输入图片说明](https://static.oschina.net/uploads/img/201705/08210711_Ypik.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201705/08210711_Ypik.png "在这里输入图片标题")
![输入图片说明](https://static.oschina.net/uploads/img/201705/08211152_EB65.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201705/08211152_EB65.png "在这里输入图片标题")
#### 4.10 删除任务 ### 4.10 删除任务
点击删除按钮,可以删除对应任务。 点击删除按钮,可以删除对应任务。
![输入图片说明](https://static.oschina.net/uploads/img/201607/24140641_Z9Qr.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24140641_Z9Qr.png "在这里输入图片标题")
## 五、总体设计 ## 五、总体设计
#### 5.1 源码目录介绍 ### 5.1 源码目录介绍
- /doc :文档资料 - /doc :文档资料
- /db :“调度数据库”建表脚本 - /db :“调度数据库”建表脚本
- /xxl-job-admin :调度中心,项目源码 - /xxl-job-admin :调度中心,项目源码
- /xxl-job-core :公共Jar依赖 - /xxl-job-core :公共Jar依赖
- /xxl-job-executor-samples :执行器Sample示例项目大家可以在该项目上进行开发也可以将现有项目改造生成执行器项目 - /xxl-job-executor-samples :执行器Sample示例项目大家可以在该项目上进行开发也可以将现有项目改造生成执行器项目
#### 5.2 “调度数据库”配置 ### 5.2 “调度数据库”配置
XXL-JOB调度模块基于Quartz集群实现其“调度数据库”是在Quartz的11张集群mysql表基础上扩展而成。 XXL-JOB调度模块基于Quartz集群实现其“调度数据库”是在Quartz的11张集群mysql表基础上扩展而成。
XXL-JOB首先定制了Quartz原生表结构前缀XXL_JOB_QRTZ_ XXL-JOB首先定制了Quartz原生表结构前缀XXL_JOB_QRTZ_
@ -537,15 +542,15 @@ XXL-JOB首先定制了Quartz原生表结构前缀XXL_JOB_QRTZ_
因此XXL-JOB调度数据库共计用于16张数据库表。 因此XXL-JOB调度数据库共计用于16张数据库表。
#### 5.3 架构设计 ### 5.3 架构设计
##### 5.3.1 设计思想 #### 5.3.1 设计思想
将调度行为抽象形成“调度中心”公共平台,而平台自身并不承担业务逻辑,“调度中心”负责发起调度请求。 将调度行为抽象形成“调度中心”公共平台,而平台自身并不承担业务逻辑,“调度中心”负责发起调度请求。
将任务抽象成分散的JobHandler交由“执行器”统一管理“执行器”负责接收调度请求并执行对应的JobHandler中业务逻辑。 将任务抽象成分散的JobHandler交由“执行器”统一管理“执行器”负责接收调度请求并执行对应的JobHandler中业务逻辑。
因此,“调度”和“任务”两部分可以相互解耦,提高系统整体稳定性和扩展性; 因此,“调度”和“任务”两部分可以相互解耦,提高系统整体稳定性和扩展性;
##### 5.3.2 系统组成 #### 5.3.2 系统组成
- **调度模块(调度中心)** - **调度模块(调度中心)**
负责管理调度信息,按照调度配置发出调度请求,自身不承担业务代码。调度系统与任务解耦,提高了系统可用性和稳定性,同时调度系统性能不再受限于任务模块; 负责管理调度信息,按照调度配置发出调度请求,自身不承担业务代码。调度系统与任务解耦,提高了系统可用性和稳定性,同时调度系统性能不再受限于任务模块;
支持可视化、简单且动态的维管理调度信息包括任务新建更新删除GLUE开发和任务报警等所有上述操作都会实时生效同时支持监控调度结果以及执行日志支持执行器Failover。 支持可视化、简单且动态的维管理调度信息包括任务新建更新删除GLUE开发和任务报警等所有上述操作都会实时生效同时支持监控调度结果以及执行日志支持执行器Failover。
@ -553,24 +558,24 @@ XXL-JOB首先定制了Quartz原生表结构前缀XXL_JOB_QRTZ_
负责接收调度请求并执行任务逻辑。任务模块专注于任务的执行等操作,开发和维护更加简单和高效; 负责接收调度请求并执行任务逻辑。任务模块专注于任务的执行等操作,开发和维护更加简单和高效;
接收“调度中心”的执行请求、终止请求和日志请求等。 接收“调度中心”的执行请求、终止请求和日志请求等。
##### 5.3.3 架构图 #### 5.3.3 架构图
![输入图片说明](https://static.oschina.net/uploads/img/201707/17190028_aEE2.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201707/17190028_aEE2.png "在这里输入图片标题")
#### 5.4 调度模块剖析 ### 5.4 调度模块剖析
##### 5.4.1 quartz的不足 #### 5.4.1 quartz的不足
Quartz作为开源作业调度中的佼佼者是作业调度的首选。但是集群环境中Quartz采用API的方式对任务进行管理从而可以避免上述问题但是同样存在以下问题 Quartz作为开源作业调度中的佼佼者是作业调度的首选。但是集群环境中Quartz采用API的方式对任务进行管理从而可以避免上述问题但是同样存在以下问题
- 问题一调用API的的方式操作任务不人性化 - 问题一调用API的的方式操作任务不人性化
- 问题二需要持久化业务QuartzJobBean到底层数据表中系统侵入性相当严重。 - 问题二需要持久化业务QuartzJobBean到底层数据表中系统侵入性相当严重。
- 问题三调度逻辑和QuartzJobBean耦合在同一个项目中这将导致一个问题在调度任务数量逐渐增多同时调度任务逻辑逐渐加重的情况加此时调度系统的性能将大大受限于业务 - 问题三调度逻辑和QuartzJobBean耦合在同一个项目中这将导致一个问题在调度任务数量逐渐增多同时调度任务逻辑逐渐加重的情况加此时调度系统的性能将大大受限于业务
XXL-JOB弥补了quartz的上述不足之处。 XXL-JOB弥补了quartz的上述不足之处。
##### 5.4.2 RemoteHttpJobBean #### 5.4.2 RemoteHttpJobBean
常规Quartz的开发任务逻辑一般维护在QuartzJobBean中耦合很严重。XXL-JOB中“调度模块”和“任务模块”完全解耦调度模块中的所有调度任务使用同一个QuartzJobBean即RemoteHttpJobBean。不同的调度任务将各自参数维护在各自扩展表数据中当触发RemoteHttpJobBean执行时将会解析不同的任务参数发起远程调用调用各自的远程执行器服务。 常规Quartz的开发任务逻辑一般维护在QuartzJobBean中耦合很严重。XXL-JOB中“调度模块”和“任务模块”完全解耦调度模块中的所有调度任务使用同一个QuartzJobBean即RemoteHttpJobBean。不同的调度任务将各自参数维护在各自扩展表数据中当触发RemoteHttpJobBean执行时将会解析不同的任务参数发起远程调用调用各自的远程执行器服务。
这种调用模型类似RPC调用RemoteHttpJobBean提供调用代理的功能而执行器提供远程服务的功能。 这种调用模型类似RPC调用RemoteHttpJobBean提供调用代理的功能而执行器提供远程服务的功能。
##### 5.4.3 调度中心HA集群 #### 5.4.3 调度中心HA集群
基于Quartz的集群方案数据库选用Mysql集群分布式并发环境中使用QUARTZ定时任务调度会在各个节点会上报任务存到数据库中执行时会从数据库中取出触发器来执行如果触发器的名称和执行时间相同则只有一个节点去执行此任务。 基于Quartz的集群方案数据库选用Mysql集群分布式并发环境中使用QUARTZ定时任务调度会在各个节点会上报任务存到数据库中执行时会从数据库中取出触发器来执行如果触发器的名称和执行时间相同则只有一个节点去执行此任务。
``` ```
@ -582,7 +587,7 @@ org.quartz.jobStore.isClustered: true
org.quartz.jobStore.clusterCheckinInterval: 1000 org.quartz.jobStore.clusterCheckinInterval: 1000
``` ```
##### 5.4.4 调度线程池 #### 5.4.4 调度线程池
默认线程池中线程的数量为10个避免单线程因阻塞而引起任务调度延迟。 默认线程池中线程的数量为10个避免单线程因阻塞而引起任务调度延迟。
``` ```
@ -596,12 +601,12 @@ XXL-JOB系统中业务逻辑在远程执行器执行调度中心每次调度
XXL-JOB调度中心中每个JOB逻辑非常 “轻”单个JOB一次运行平均耗时基本在 "100ms" 之内基本是网络开销因此可以保证使用有限的线程支撑大量的JOB并发运行上面配置的10个线程至少可以支撑100个JOB正常运行 XXL-JOB调度中心中每个JOB逻辑非常 “轻”单个JOB一次运行平均耗时基本在 "100ms" 之内基本是网络开销因此可以保证使用有限的线程支撑大量的JOB并发运行上面配置的10个线程至少可以支撑100个JOB正常运行
##### 5.4.5 @DisallowConcurrentExecution #### 5.4.5 @DisallowConcurrentExecution
XXL-JOB调度模块的“调度中心”默认不使用该注解即默认开启并行机制因为RemoteHttpJobBean为公共QuartzJobBean这样在多线程调度的情况下调度模块被阻塞的几率很低大大提高了调度系统的承载量。 XXL-JOB调度模块的“调度中心”默认不使用该注解即默认开启并行机制因为RemoteHttpJobBean为公共QuartzJobBean这样在多线程调度的情况下调度模块被阻塞的几率很低大大提高了调度系统的承载量。
XXL-JOB的每个调度任务虽然在调度模块是并行调度执行的但是任务调度传递到任务模块的“执行器”确实串行执行的同时支持任务终止。 XXL-JOB的每个调度任务虽然在调度模块是并行调度执行的但是任务调度传递到任务模块的“执行器”确实串行执行的同时支持任务终止。
##### 5.4.6 misfire #### 5.4.6 misfire
错过了触发时间,处理规则。 错过了触发时间,处理规则。
可能原因服务重启调度线程被QuartzJobBean阻塞线程被耗尽某个任务启用了@DisallowConcurrentExecution上次调度持续阻塞下次调度被错过 可能原因服务重启调度线程被QuartzJobBean阻塞线程被耗尽某个任务启用了@DisallowConcurrentExecution上次调度持续阻塞下次调度被错过
@ -622,7 +627,7 @@ CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(jobIn
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build(); CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build();
``` ```
##### 5.4.7 日志回调服务 #### 5.4.7 日志回调服务
调度模块的“调度中心”作为Web服务部署时一方面承担调度中心功能另一方面也为执行器提供API服务。 调度模块的“调度中心”作为Web服务部署时一方面承担调度中心功能另一方面也为执行器提供API服务。
调度中心提供的"日志回调服务API服务"代码位置如下: 调度中心提供的"日志回调服务API服务"代码位置如下:
@ -632,7 +637,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
“执行器”在接收到任务执行请求后,执行任务,在执行结束之后会将执行结果回调通知“调度中心”: “执行器”在接收到任务执行请求后,执行任务,在执行结束之后会将执行结果回调通知“调度中心”:
##### 5.4.8 任务HAFailover #### 5.4.8 任务HAFailover
执行器如若集群部署调度中心将会感知到在线的所有执行器如“127.0.0.1:9997, 127.0.0.1:9998, 127.0.0.1:9999”。 执行器如若集群部署调度中心将会感知到在线的所有执行器如“127.0.0.1:9997, 127.0.0.1:9998, 127.0.0.1:9999”。
当任务"路由策略"选择"故障转移(FAILOVER)"时,当调度中心每次发起调度请求时,会按照顺序对执行器发出心跳检测请求,第一个检测为存活状态的执行器将会被选定并发送调度请求。 当任务"路由策略"选择"故障转移(FAILOVER)"时,当调度中心每次发起调度请求时,会按照顺序对执行器发出心跳检测请求,第一个检测为存活状态的执行器将会被选定并发送调度请求。
@ -644,7 +649,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
“调度备注”可以看出本地调度运行轨迹,执行器的"注册方式"、"地址列表"和任务的"路由策略"。"故障转移(FAILOVER)"路由策略下,调度中心首先对第一个地址进行心跳检测,心跳失败因此自动跳过,第二个依然心跳检测失败…… “调度备注”可以看出本地调度运行轨迹,执行器的"注册方式"、"地址列表"和任务的"路由策略"。"故障转移(FAILOVER)"路由策略下,调度中心首先对第一个地址进行心跳检测,心跳失败因此自动跳过,第二个依然心跳检测失败……
直至心跳检测第三个地址“127.0.0.1:9999”成功选定为“目标执行器”然后对“目标执行器”发送调度请求调度流程结束等待执行器回调执行结果。 直至心跳检测第三个地址“127.0.0.1:9999”成功选定为“目标执行器”然后对“目标执行器”发送调度请求调度流程结束等待执行器回调执行结果。
##### 5.4.9 调度日志 #### 5.4.9 调度日志
调度中心每次进行任务调度,都会记录一条任务日志,任务日志主要包括以下三部分内容: 调度中心每次进行任务调度,都会记录一条任务日志,任务日志主要包括以下三部分内容:
- 任务信息包括“执行器地址”、“JobHandler”和“执行参数”等属性根据这些参数可以精确的定位任务执行的具体机器和任务代码 - 任务信息包括“执行器地址”、“JobHandler”和“执行参数”等属性根据这些参数可以精确的定位任务执行的具体机器和任务代码
@ -665,7 +670,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
- 执行备注:执行器,任务执行的备注信息,如异常日志等; - 执行备注:执行器,任务执行的备注信息,如异常日志等;
- 执行日志任务执行过程中业务代码中打印的完整执行日志见“4.7 查看执行日志”; - 执行日志任务执行过程中业务代码中打印的完整执行日志见“4.7 查看执行日志”;
##### 5.4.10 任务依赖 #### 5.4.10 任务依赖
原理XXL-JOB中每个任务都对应有一个任务Key同时每个任务支持设置属性“子任务Key”因此通过“任务Key”可以匹配任务依赖关系。 原理XXL-JOB中每个任务都对应有一个任务Key同时每个任务支持设置属性“子任务Key”因此通过“任务Key”可以匹配任务依赖关系。
当父任务执行结束并且执行成功时将会根据“子任务Key”匹配子任务依赖如果匹配到子任务将会主动触发一次子任务的执行。 当父任务执行结束并且执行成功时将会根据“子任务Key”匹配子任务依赖如果匹配到子任务将会主动触发一次子任务的执行。
@ -676,12 +681,12 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
![输入图片说明](https://static.oschina.net/uploads/img/201607/24194212_jOAU.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201607/24194212_jOAU.png "在这里输入图片标题")
#### 5.5 任务 "运行模式" 剖析 ### 5.5 任务 "运行模式" 剖析
##### 5.5.1 "Bean模式" 任务 #### 5.5.1 "Bean模式" 任务
开发步骤:可参考 "章节三" 开发步骤:可参考 "章节三"
原理每个Bean模式任务都是一个Spring的Bean类实例它被维护在“执行器”项目的Spring容器中。任务类需要加“@JobHander(value="名称")”注解因为“执行器”会根据该注解识别Spring容器中的任务。任务类需要继承统一接口“IJobHandler”任务逻辑在execute方法中开发因为“执行器”在接收到调度中心的调度请求时将会调用“IJobHandler”的execute方法执行任务逻辑。 原理每个Bean模式任务都是一个Spring的Bean类实例它被维护在“执行器”项目的Spring容器中。任务类需要加“@JobHander(value="名称")”注解因为“执行器”会根据该注解识别Spring容器中的任务。任务类需要继承统一接口“IJobHandler”任务逻辑在execute方法中开发因为“执行器”在接收到调度中心的调度请求时将会调用“IJobHandler”的execute方法执行任务逻辑。
##### 5.5.2 "GLUE模式(Java)" 任务 #### 5.5.2 "GLUE模式(Java)" 任务
开发步骤:可参考 "章节三" 开发步骤:可参考 "章节三"
原理:每个 "GLUE模式(Java)" 任务的代码实际上是“一个继承自“IJobHandler”的实现类的类代码”“执行器”接收到“调度中心”的调度请求时会通过Groovy类加载器加载此代码实例化成Java对象同时注入此代码中声明的Spring服务请确保Glue代码中的服务和类引用在“执行器”项目中存在然后调用该对象的execute方法执行任务逻辑。 原理:每个 "GLUE模式(Java)" 任务的代码实际上是“一个继承自“IJobHandler”的实现类的类代码”“执行器”接收到“调度中心”的调度请求时会通过Groovy类加载器加载此代码实例化成Java对象同时注入此代码中声明的Spring服务请确保Glue代码中的服务和类引用在“执行器”项目中存在然后调用该对象的execute方法执行任务逻辑。
@ -695,7 +700,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
- python脚本任务运行模式选择为 "GLUE模式(Python)"时支持 "python" 脚本任务; - python脚本任务运行模式选择为 "GLUE模式(Python)"时支持 "python" 脚本任务;
##### 5.5.4 执行器 #### 5.5.4 执行器
执行器实际上是一个内嵌的Jetty服务器默认端口9999如下图配置文件所示参数xxl.job.executor.port 执行器实际上是一个内嵌的Jetty服务器默认端口9999如下图配置文件所示参数xxl.job.executor.port
![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201703/10174923_TgNO.png "在这里输入图片标题")
@ -704,7 +709,7 @@ xxl-job-admin#com.xxl.job.admin.controller.JobApiController.callback
“执行器”接收到“调度中心”的调度请求时如果任务类型为“Bean模式”将会匹配Spring容器中的“Bean模式任务”然后调用其execute方法执行任务逻辑。如果任务类型为“GLUE模式”将会加载GLue代码实例化Java对象注入依赖的Spring服务注意Glue代码中注入的Spring服务必须存在与该“执行器”项目的Spring容器中然后调用execute方法执行任务逻辑。 “执行器”接收到“调度中心”的调度请求时如果任务类型为“Bean模式”将会匹配Spring容器中的“Bean模式任务”然后调用其execute方法执行任务逻辑。如果任务类型为“GLUE模式”将会加载GLue代码实例化Java对象注入依赖的Spring服务注意Glue代码中注入的Spring服务必须存在与该“执行器”项目的Spring容器中然后调用execute方法执行任务逻辑。
##### 5.5.5 任务日志 #### 5.5.5 任务日志
XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过 "XxlJobLogger.log" 打印执行日志,“调度中心”查看执行日志时将会加载对应的日志文件。 XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过 "XxlJobLogger.log" 打印执行日志,“调度中心”查看执行日志时将会加载对应的日志文件。
(历史版本通过重写LOG4J的Appender实现存在依赖限制该方式在新版本已经被抛弃) (历史版本通过重写LOG4J的Appender实现存在依赖限制该方式在新版本已经被抛弃)
@ -713,17 +718,17 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
在JobHandler中开启子线程时子线程将会将会把日志打印在父线程即JobHandler的执行日志中方便日志追踪。 在JobHandler中开启子线程时子线程将会将会把日志打印在父线程即JobHandler的执行日志中方便日志追踪。
#### 5.6 通讯模块剖析 ### 5.6 通讯模块剖析
##### 5.6.1 一次完整的任务调度通讯流程 #### 5.6.1 一次完整的任务调度通讯流程
- 1、“调度中心”向“执行器”发送http调度请求: “执行器”中接收请求的服务实际上是一台内嵌jetty服务器默认端口9999; - 1、“调度中心”向“执行器”发送http调度请求: “执行器”中接收请求的服务实际上是一台内嵌jetty服务器默认端口9999;
- 2、“执行器”执行任务逻辑 - 2、“执行器”执行任务逻辑
- 3、“执行器”http回调“调度中心”调度结果: “调度中心”中接收回调的服务是针对执行器开放一套API服务; - 3、“执行器”http回调“调度中心”调度结果: “调度中心”中接收回调的服务是针对执行器开放一套API服务;
##### 5.6.2 通讯数据加密 #### 5.6.2 通讯数据加密
调度中心向执行器发送的调度请求时使用RequestModel和ResponseModel两个对象封装调度请求参数和响应数据, 在进行通讯之前底层会将上述两个对象对象序列化,并进行数据协议以及时间戳检验,从而达到数据加密的功能; 调度中心向执行器发送的调度请求时使用RequestModel和ResponseModel两个对象封装调度请求参数和响应数据, 在进行通讯之前底层会将上述两个对象对象序列化,并进行数据协议以及时间戳检验,从而达到数据加密的功能;
#### 5.7 任务注册, 任务自动发现 ### 5.7 任务注册, 任务自动发现
自v1.5版本之后, 任务取消了"任务执行机器"属性, 改为通过任务注册和自动发现的方式, 动态获取远程执行器地址并执行。 自v1.5版本之后, 任务取消了"任务执行机器"属性, 改为通过任务注册和自动发现的方式, 动态获取远程执行器地址并执行。
AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表; AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表;
@ -732,12 +737,12 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
为保证系统"轻量级"并且降低学习部署成本没有采用Zookeeper作为注册中心采用DB方式进行任务注册发现 为保证系统"轻量级"并且降低学习部署成本没有采用Zookeeper作为注册中心采用DB方式进行任务注册发现
#### 5.8 任务执行结果 ### 5.8 任务执行结果
自v1.6.2之后,任务执行结果通过 "IJobHandler" 的返回值 "ReturnT" 进行判断; 自v1.6.2之后,任务执行结果通过 "IJobHandler" 的返回值 "ReturnT" 进行判断;
当返回值符合 "ReturnT.code == ReturnT.SUCCESS_CODE" 时表示任务执行成功,否则表示任务执行失败,而且可以通过 "ReturnT.msg" 回调错误信息给调度中心; 当返回值符合 "ReturnT.code == ReturnT.SUCCESS_CODE" 时表示任务执行成功,否则表示任务执行失败,而且可以通过 "ReturnT.msg" 回调错误信息给调度中心;
从而,在任务逻辑中可以方便的控制任务执行结果; 从而,在任务逻辑中可以方便的控制任务执行结果;
#### 5.9 分片广播 & 动态分片 ### 5.9 分片广播 & 动态分片
执行器集群部署时,任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发对应集群中所有执行器执行一次任务,同时传递分片参数;可根据分片参数开发分片任务; 执行器集群部署时,任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发对应集群中所有执行器执行一次任务,同时传递分片参数;可根据分片参数开发分片任务;
"分片广播" 以执行器为维度进行分片,支持动态扩容执行器集群从而动态增加分片数量,协同进行业务处理;在进行大数据量业务操作时可显著提升任务处理能力和速度。 "分片广播" 以执行器为维度进行分片,支持动态扩容执行器集群从而动态增加分片数量,协同进行业务处理;在进行大数据量业务操作时可显著提升任务处理能力和速度。
@ -755,7 +760,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
- 1、分片任务场景10个执行器的集群来处理10w条数据每台机器只需要处理1w条数据耗时降低10倍 - 1、分片任务场景10个执行器的集群来处理10w条数据每台机器只需要处理1w条数据耗时降低10倍
- 2、广播任务场景广播执行器机器运行shell脚本、广播集群节点进行缓存更新等 - 2、广播任务场景广播执行器机器运行shell脚本、广播集群节点进行缓存更新等
#### 5、10 访问令牌AccessToken ### 5.10 访问令牌AccessToken
为提升系统安全性调度中心和执行器进行安全性校验双方AccessToken匹配才允许通讯 为提升系统安全性调度中心和执行器进行安全性校验双方AccessToken匹配才允许通讯
调度中心和执行器,可通过配置项 "xxl.job.accessToken" 进行AccessToken的设置。 调度中心和执行器,可通过配置项 "xxl.job.accessToken" 进行AccessToken的设置。
@ -767,7 +772,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
## 六、版本更新日志 ## 六、版本更新日志
#### 6.1 版本 V1.1.x新特性[2015-12-05] ### 6.1 版本 V1.1.x新特性[2015-12-05]
**【于V1.1.x版本XXL-JOB正式应用于我司内部定制别名为 “Ferrari”新接入应用推荐使用最新版本】** **【于V1.1.x版本XXL-JOB正式应用于我司内部定制别名为 “Ferrari”新接入应用推荐使用最新版本】**
- 1、简单支持通过Web页面对任务进行CRUD操作操作简单一分钟上手 - 1、简单支持通过Web页面对任务进行CRUD操作操作简单一分钟上手
- 2、动态支持动态修改任务状态动态暂停/恢复任务,即时生效; - 2、动态支持动态修改任务状态动态暂停/恢复任务,即时生效;
@ -778,7 +783,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
- 7、支持自定义参数 - 7、支持自定义参数
- 8、支持远程任务执行终止 - 8、支持远程任务执行终止
#### 6.2 版本 V1.2.x新特性[2016-01-17] ### 6.2 版本 V1.2.x新特性[2016-01-17]
- 1、支持任务分组 - 1、支持任务分组
- 2、支持“本地任务”、“远程任务” - 2、支持“本地任务”、“远程任务”
- 3、底层通讯支持两种方式Servlet方式 + JETTY方式 - 3、底层通讯支持两种方式Servlet方式 + JETTY方式
@ -796,7 +801,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
- 高扩展性; - 高扩展性;
- 稳定性; - 稳定性;
#### 6.3 版本 V1.3.0,新特性[2016-05-19] ### 6.3 版本 V1.3.0,新特性[2016-05-19]
- 1、遗弃“本地任务”模式推荐使用“远程任务”易于系统解耦任务对应的JobHander统称为“执行器” - 1、遗弃“本地任务”模式推荐使用“远程任务”易于系统解耦任务对应的JobHander统称为“执行器”
- 2、遗弃“servlet”方式底层系统通讯推荐使用JETTY方式调度+回调双向通讯,重构通讯逻辑; - 2、遗弃“servlet”方式底层系统通讯推荐使用JETTY方式调度+回调双向通讯,重构通讯逻辑;
- 3、UI交互优化左侧菜单展开状态优化菜单项选中状态优化任务列表打开表格有压缩优化 - 3、UI交互优化左侧菜单展开状态优化菜单项选中状态优化任务列表打开表格有压缩优化
@ -806,7 +811,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
- BEAN模式执行器每个执行器都是Spring的一个Bean实例XXL-JOB通过注解@JobHander识别和调度执行器 - BEAN模式执行器每个执行器都是Spring的一个Bean实例XXL-JOB通过注解@JobHander识别和调度执行器
-GLUE模式执行器每个执行器对应一段代码在线Web编辑和维护动态编译生效执行器负责加载GLUE代码和执行 -GLUE模式执行器每个执行器对应一段代码在线Web编辑和维护动态编译生效执行器负责加载GLUE代码和执行
#### 6.4 版本 V1.3.1,新特性[2016-05-23] ### 6.4 版本 V1.3.1,新特性[2016-05-23]
- 1、更新项目目录结构 - 1、更新项目目录结构
- /xxl-job-admin -------------------- 【调度中心】:负责管理调度信息,按照调度配置发出调度请求; - /xxl-job-admin -------------------- 【调度中心】:负责管理调度信息,按照调度配置发出调度请求;
- /xxl-job-core ----------------------- 公共依赖 - /xxl-job-core ----------------------- 公共依赖
@ -816,12 +821,12 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
- 2、在新的目录结构上升级了用户手册 - 2、在新的目录结构上升级了用户手册
- 3、优化了一些交互和UI - 3、优化了一些交互和UI
#### 6.5 版本 V1.3.2,新特性[2016-05-28] ### 6.5 版本 V1.3.2,新特性[2016-05-28]
- 1、调度逻辑进行事务包裹 - 1、调度逻辑进行事务包裹
- 2、执行器异步回调执行日志 - 2、执行器异步回调执行日志
- 3、【重要】在 “调度中心” 支持HA的基础上扩展执行器的Failover支持支持配置多执行期地址 - 3、【重要】在 “调度中心” 支持HA的基础上扩展执行器的Failover支持支持配置多执行期地址
#### 6.6 版本 V1.4.0 新特性[2016-07-24] ### 6.6 版本 V1.4.0 新特性[2016-07-24]
- 1、任务依赖: 通过事件触发方式实现, 任务执行成功并回调时会主动触发一次子任务的调度, 多个子任务用逗号分隔; - 1、任务依赖: 通过事件触发方式实现, 任务执行成功并回调时会主动触发一次子任务的调度, 多个子任务用逗号分隔;
- 2、执行器底层实现代码进行重度重构, 优化底层建表脚本; - 2、执行器底层实现代码进行重度重构, 优化底层建表脚本;
- 3、执行器中任务线程分组逻辑优化: 之前根据执行器JobHandler进行线程分组,当多个任务复用Jobhanlder会导致相互阻塞。现改为根据调度中心任务进行任务线程分组,任务与任务执行相互隔离; - 3、执行器中任务线程分组逻辑优化: 之前根据执行器JobHandler进行线程分组,当多个任务复用Jobhanlder会导致相互阻塞。现改为根据调度中心任务进行任务线程分组,任务与任务执行相互隔离;
@ -840,7 +845,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段, 地址见分支 [V1.3](https://github.com/xuxueli/xxl-job/tree/v1.3) 。新特性将会在master分支持续更新。 Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段, 地址见分支 [V1.3](https://github.com/xuxueli/xxl-job/tree/v1.3) 。新特性将会在master分支持续更新。
#### 6.7 版本 V1.4.1 新特性[2016-09-06] ### 6.7 版本 V1.4.1 新特性[2016-09-06]
- 1、项目成功推送maven中央仓库, 中央仓库地址以及依赖如下: - 1、项目成功推送maven中央仓库, 中央仓库地址以及依赖如下:
``` ```
<!-- http://repo1.maven.org/maven2/com/xuxueli/xxl-job-core/ --> <!-- http://repo1.maven.org/maven2/com/xuxueli/xxl-job-core/ -->
@ -858,14 +863,14 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 7、底层表结构,表明统一大写; - 7、底层表结构,表明统一大写;
- 8、调度中心,异常处理器JSON响应的ContentType修改,修复浏览器不识别的问题; - 8、调度中心,异常处理器JSON响应的ContentType修改,修复浏览器不识别的问题;
#### 6.8 版本 V1.4.2 新特性[2016-09-29] ### 6.8 版本 V1.4.2 新特性[2016-09-29]
- 1、推送新版本 V1.4.2 至中央仓库, 大版本 V1.4 进入维护阶段; - 1、推送新版本 V1.4.2 至中央仓库, 大版本 V1.4 进入维护阶段;
- 2、任务新增时,任务列表偏移问题修复; - 2、任务新增时,任务列表偏移问题修复;
- 3、修复一处因bootstrap不支持模态框重叠而导致的样式错乱的问题, 在任务编辑时会出现该问题; - 3、修复一处因bootstrap不支持模态框重叠而导致的样式错乱的问题, 在任务编辑时会出现该问题;
- 4、调度超时和Handler匹配不到时,调度状态优化; - 4、调度超时和Handler匹配不到时,调度状态优化;
- 5、因catch异常,导致任务不可终止的问题,给出解决方案, 见文档; - 5、因catch异常,导致任务不可终止的问题,给出解决方案, 见文档;
#### 6.9 版本 V1.5.0 特性[2016-11-13] ### 6.9 版本 V1.5.0 特性[2016-11-13]
- 1、任务注册: 执行器会周期性自动注册任务, 调度中心将会自动发现注册的任务并触发执行。 - 1、任务注册: 执行器会周期性自动注册任务, 调度中心将会自动发现注册的任务并触发执行。
- 2、"执行器" 新增参数 "AppName" : 是每个执行器集群的唯一标示AppName, 并周期性以AppName为对象进行自动注册。 - 2、"执行器" 新增参数 "AppName" : 是每个执行器集群的唯一标示AppName, 并周期性以AppName为对象进行自动注册。
- 3、调度中心新增栏目 "执行器管理" : 管理在线的执行器, 通过属性AppName自动发现注册的执行器。只有被管理的执行器才允许被使用; - 3、调度中心新增栏目 "执行器管理" : 管理在线的执行器, 通过属性AppName自动发现注册的执行器。只有被管理的执行器才允许被使用;
@ -875,14 +880,14 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 7、表结构调整,底层重构优化; - 7、表结构调整,底层重构优化;
- 8、"调度中心"自动注册和发现,failover: 调度中心周期性自动注册, 任务回调时可以感知在线的所有调度中心地址, 通过failover的方式进行任务回调,避免回调单点风险。 - 8、"调度中心"自动注册和发现,failover: 调度中心周期性自动注册, 任务回调时可以感知在线的所有调度中心地址, 通过failover的方式进行任务回调,避免回调单点风险。
#### 6.10 版本 V1.5.1 特性[2016-11-13] ### 6.10 版本 V1.5.1 特性[2016-11-13]
- 1、底层代码重构和逻辑优化POM清理以及CleanCode - 1、底层代码重构和逻辑优化POM清理以及CleanCode
- 2、Servlet/JSP Spec设定为3.0/2.2 - 2、Servlet/JSP Spec设定为3.0/2.2
- 3、Spring升级至3.2.17.RELEASE版本 - 3、Spring升级至3.2.17.RELEASE版本
- 4、Jetty升级版本至8.2.0.v20160908 - 4、Jetty升级版本至8.2.0.v20160908
- 5、已推送V1.5.0和V1.5.1至Maven中央仓库 - 5、已推送V1.5.0和V1.5.1至Maven中央仓库
#### 6.10 版本 V1.5.2 特性[2017-02-28] ### 6.10 版本 V1.5.2 特性[2017-02-28]
- 1、IP工具类获取IP逻辑优化IP静态缓存 - 1、IP工具类获取IP逻辑优化IP静态缓存
- 2、执行器、调度中心均支持自定义注册IP地址解决机器多网卡时错误网卡注册的情况 - 2、执行器、调度中心均支持自定义注册IP地址解决机器多网卡时错误网卡注册的情况
- 3、任务跨天执行时生成多份日志文件的问题修复 - 3、任务跨天执行时生成多份日志文件的问题修复
@ -892,7 +897,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 7、底层代码重构和逻辑优化以及CleanCode - 7、底层代码重构和逻辑优化以及CleanCode
- 8、GLUE依赖注入逻辑优化支持别名注入 - 8、GLUE依赖注入逻辑优化支持别名注入
#### 6.11 版本 V1.6.0 特性[2017-03-13] ### 6.11 版本 V1.6.0 特性[2017-03-13]
- 1、通讯方案升级原基于HEX的通讯模型调整为基于HTTP的B-RPC的通讯模型 - 1、通讯方案升级原基于HEX的通讯模型调整为基于HTTP的B-RPC的通讯模型
- 2、执行器支持手动设置执行地址列表提供开关切换使用注册地址还是手动设置的地址 - 2、执行器支持手动设置执行地址列表提供开关切换使用注册地址还是手动设置的地址
- 3、执行器路由规则第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移 - 3、执行器路由规则第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移
@ -903,20 +908,20 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 8、新建任务默认为非运行状态 - 8、新建任务默认为非运行状态
- 9、GLUE模式任务实例更新逻辑优化原根据超时时间更新改为根据版本号更新源码变动版本号加一 - 9、GLUE模式任务实例更新逻辑优化原根据超时时间更新改为根据版本号更新源码变动版本号加一
#### 6.12 版本 V1.6.1 特性[2017-03-25] ### 6.12 版本 V1.6.1 特性[2017-03-25]
- 1、Rolling日志 - 1、Rolling日志
- 2、WebIDE交互重构 - 2、WebIDE交互重构
- 3、通讯增强校验有效过滤非正常请求 - 3、通讯增强校验有效过滤非正常请求
- 4、权限增强校验采用动态登录TOKEN推荐接入内部SSO - 4、权限增强校验采用动态登录TOKEN推荐接入内部SSO
- 5、数据库配置优化解决乱码问题 - 5、数据库配置优化解决乱码问题
#### 6.13 版本 V1.6.2 特性[2017-04-25] ### 6.13 版本 V1.6.2 特性[2017-04-25]
- 1、运行报表支持实时查看运行数据如任务数量、调度次数、执行器数量等以及调度报表如调度日期分布图调度成功分布图等 - 1、运行报表支持实时查看运行数据如任务数量、调度次数、执行器数量等以及调度报表如调度日期分布图调度成功分布图等
- 2、JobHandler支持设置任务返回值在任务逻辑中可以方便的控制任务执行结果 - 2、JobHandler支持设置任务返回值在任务逻辑中可以方便的控制任务执行结果
- 3、资源路径包含空格或中文时资源文件无法加载时无法准确查看异常信息的问题处理。 - 3、资源路径包含空格或中文时资源文件无法加载时无法准确查看异常信息的问题处理。
- 4、路由策越优化循环和LFU路由策略计数器自增无上限问题和首次路由压力集中在首台机器的问题修复 - 4、路由策越优化循环和LFU路由策略计数器自增无上限问题和首次路由压力集中在首台机器的问题修复
#### 6.14 版本 V1.7.0 特性[2017-05-02] ### 6.14 版本 V1.7.0 特性[2017-05-02]
- 1、脚本任务支持以GLUE模式开发和运行脚本任务包括Shell、Python和Groovy等类型脚本; - 1、脚本任务支持以GLUE模式开发和运行脚本任务包括Shell、Python和Groovy等类型脚本;
- 2、新增spring-boot类型执行器example项目 - 2、新增spring-boot类型执行器example项目
- 3、升级jetty版本至9.2 - 3、升级jetty版本至9.2
@ -924,7 +929,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 5、执行器移除GlueLoader依赖改为推送方式实现从而GLUE源码加载不再依赖JDBC - 5、执行器移除GlueLoader依赖改为推送方式实现从而GLUE源码加载不再依赖JDBC
- 6、登录拦截Redirect时获取项目名解决非根据目录发布时跳转404问题 - 6、登录拦截Redirect时获取项目名解决非根据目录发布时跳转404问题
#### 6.15 版本 V1.7.1 特性[2017-05-08] ### 6.15 版本 V1.7.1 特性[2017-05-08]
- 1、运行日志读写编码统一为UTF-8解决windows环境下日志乱码问题 - 1、运行日志读写编码统一为UTF-8解决windows环境下日志乱码问题
- 2、通讯超时时间限定为10s避免异常情况下调度线程占用 - 2、通讯超时时间限定为10s避免异常情况下调度线程占用
- 3、执行器server启动、销毁和注册逻辑调整 - 3、执行器server启动、销毁和注册逻辑调整
@ -934,7 +939,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 7、弹框组件统一替换为layer - 7、弹框组件统一替换为layer
- 8、升级quartz版本至2.3.0 - 8、升级quartz版本至2.3.0
#### 6.16 版本 V1.7.2 特性[2017-05-17] ### 6.16 版本 V1.7.2 特性[2017-05-17]
- 1、阻塞处理策略调度过于密集执行器来不及处理时的处理策略策略包括单机串行默认、丢弃后续调度、覆盖之前调度 - 1、阻塞处理策略调度过于密集执行器来不及处理时的处理策略策略包括单机串行默认、丢弃后续调度、覆盖之前调度
- 2、失败处理策略调度失败时的处理策略策略包括失败告警默认、失败重试 - 2、失败处理策略调度失败时的处理策略策略包括失败告警默认、失败重试
- 3、通讯时间戳超时时间调整为180s - 3、通讯时间戳超时时间调整为180s
@ -942,7 +947,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 5、执行参数编辑时丢失问题修复 - 5、执行参数编辑时丢失问题修复
- 6、新增任务测试Demo方便在开发时进行任务逻辑测试 - 6、新增任务测试Demo方便在开发时进行任务逻辑测试
#### 6.17 版本 V1.8.0 特性[2017-07-17] ### 6.17 版本 V1.8.0 特性[2017-07-17]
- 1、任务Cron更新逻辑优化改为rescheduleJob同时防止cron重复设置 - 1、任务Cron更新逻辑优化改为rescheduleJob同时防止cron重复设置
- 2、API回调服务失败状态码优化方便问题排查 - 2、API回调服务失败状态码优化方便问题排查
- 3、XxlJobLogger的日志多参数支持 - 3、XxlJobLogger的日志多参数支持
@ -955,7 +960,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 10、执行日志支持根据运行 "状态" 筛选日志; - 10、执行日志支持根据运行 "状态" 筛选日志;
- 11、调度中心任务注册检测逻辑优化 - 11、调度中心任务注册检测逻辑优化
#### 6.18 版本 V1.8.1 特性[2017-07-30] ### 6.18 版本 V1.8.1 特性[2017-07-30]
- 1、分片广播任务执行器集群部署时任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数处理分片任务; - 1、分片广播任务执行器集群部署时任务路由策略选择"分片广播"情况下,一次任务调度将会广播触发集群中所有执行器执行一次任务,可根据分片参数处理分片任务;
- 2、动态分片分片广播任务以执行器为维度进行分片支持动态扩容执行器集群从而动态增加分片数量协同进行业务处理在进行大数据量业务操作时可显著提升任务处理能力和速度。 - 2、动态分片分片广播任务以执行器为维度进行分片支持动态扩容执行器集群从而动态增加分片数量协同进行业务处理在进行大数据量业务操作时可显著提升任务处理能力和速度。
- 3、执行器JobHandler禁止命名冲突 - 3、执行器JobHandler禁止命名冲突
@ -968,12 +973,12 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
- 10、springboot版本执行器升级至1.5.6.RELEASE版本 - 10、springboot版本执行器升级至1.5.6.RELEASE版本
- 11、统一maven依赖版本管理 - 11、统一maven依赖版本管理
#### 6.18 版本 V1.8.2 特性[Coding] ### 6.18 版本 V1.8.2 特性[Coding]
- 1、解决执行器回调URL不支持配置HTTPS时问题 - 1、解决执行器回调URL不支持配置HTTPS时问题
- 2、规范项目目录方便扩展多执行器 - 2、规范项目目录方便扩展多执行器
- 3、新增JFinal类型执行器sample示例项目 - 3、新增JFinal类型执行器sample示例项目
#### TODO LIST ### TODO LIST
- 1、任务权限管理执行器为粒度分配权限核心操作校验权限 - 1、任务权限管理执行器为粒度分配权限核心操作校验权限
- 2、任务分片路由分片采用一致性Hash算法计算出尽量稳定的分片顺序即使注册机器存在波动也不会引起分批分片顺序大的波动目前采用IP自然排序可以满足需求待定 - 2、任务分片路由分片采用一致性Hash算法计算出尽量稳定的分片顺序即使注册机器存在波动也不会引起分批分片顺序大的波动目前采用IP自然排序可以满足需求待定
- 3、失败重试优化目前失败重试逻辑为在本次调度请求失败后重新执行一次请求逻辑。优化点为针对调度和执行失败时均做失败重试重试时重新触发一次完整调度这将可能导致失败是调度死循环待定。 - 3、失败重试优化目前失败重试逻辑为在本次调度请求失败后重新执行一次请求逻辑。优化点为针对调度和执行失败时均做失败重试重试时重新触发一次完整调度这将可能导致失败是调度死循环待定。
@ -987,21 +992,20 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
## 七、其他 ## 七、其他
#### 7.1 报告问题 ### 7.1 项目贡献
XXL-JOB托管在Github上如有问题可在 [ISSUES](https://github.com/xuxueli/xxl-job/issues/) 上提问,也可以加入上文技术交流群; 欢迎参与项目贡献比如提交PR修复一个bug或者新建 [Issue](https://github.com/xuxueli/xxl-job/issues/) 讨论新特性或者变更。
#### 7.2 用户接入登记 ### 7.2 用户接入登记
登记仅为了产品推广,产品开源免费。 更多接入的公司,欢迎在 [登记地址](https://github.com/xuxueli/xxl-job/issues/1 ) 登记,登记仅仅为了产品推广。
请接入使用的公司或个人进行用户登记 [登记地址](https://github.com/xuxueli/xxl-job/issues/1 ) 。
#### 7.3 开源协议和版权 ### 7.3 开源协议和版权
产品开源免费,并且将持续提供免费的社区技术支持。个人或企业内部可自由的接入和使用。 产品开源免费,并且将持续提供免费的社区技术支持。个人或企业内部可自由的接入和使用。
XXL-JOB采用GPLv3协议目的是为了保证用户的自由使用权利。协议可避免专利申请的特殊危险 "the GPL assures that patents cannot be used to render the program non-free.摘自GPLv3"。 - Licensed under the GNU General Public License (GPL) v3.
Copyright (c) 2015-present, xuxueli. - Copyright (c) 2015-present, xuxueli.
--- ---
#### 捐赠 ### 捐赠
支持的话可以扫一扫,请作者喝杯咖啡吧:) 支持的话可以扫一扫,请作者喝杯咖啡吧:)
微信:![输入图片说明](https://static.oschina.net/uploads/img/201707/07214300_qhxT.png "在这里输入图片标题") 微信:![输入图片说明](https://static.oschina.net/uploads/img/201707/07214300_qhxT.png "在这里输入图片标题")

View File

@ -36,7 +36,7 @@
<a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp;
<iframe src="https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px" style="margin-bottom:-5px;"></iframe> <iframe src="https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px" style="margin-bottom:-5px;"></iframe>
<br><br> <br><br>
<a target="_blank" href="http://my.oschina.net/xuxueli/blog/690978">oschina文档中有交流群</a> <a target="_blank" href="http://www.xuxueli.com/xxl-job/">文档地址</a>
<br><br> <br><br>
</p> </p>