Openjob: best distributed task scheduling framework
Tags: java, php, go, python
Published: 2023-06-18 14:28:00

### What is Openjob?
Openjob is a new  distributed task scheduling framework based on Akka. Supports a variety of cronjob, delayed jobs, and workflow. Uses a consistency sharding algorithm and supports unlimited horizontal scaling.

![dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87v75yh2x5wr9ioa3fp0.png)

### Feature
Openjob not only supports basic cronjob, but also provides delayed jobs, distributed computing, and workflow

#### Cronjob
* **Cronjob，**support Unix Crontab expression
* **Second，**execution cycle less than 60 seconds
* **Fixed rate，**execute tasks at a fixed frequency with minute unit

![cronjob](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9aslskg77ncluvi0jqrv.png)

##### Delay Task
* Distributed, high-performance delay task  based on Redis, and providing rich reports and statistics

##### Distributed Computing
* **Standalone，** execute on a worker client

* **Broadcast，** execute on all worker clients

* **Map，**a map function can distribute big data to multiple machines for execution, like Hadoop map

* **MapReduce，** MapReduce is an extension of the Map.After all map sub-tasks are completed, the Reduce method is executed, which can process the results and data of the task execution in the Reduce method.

* **Sharding，** like Elastic-Job model, configure sharding numbers on the management, which can be scheduled to different client by sharding, and supports multiple languages.

![delay](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jpajucksidhjdnwmimwb.png)

##### Processor
- **Processor**, execute by function or class(support Java/Golang/PH)
- **HTTP**, http request, used to periodically request an HTTP
- **Shell**,shell script

##### Visual operations
* **Dashboard**，rich task statistics and reports
* **Task history**，task execution history records
* **Task log**，complete task log, and suppport storage (H2/Mysql/Elasticsearch).
* **Task running stack**，detailed recording of task execution stack information

![log](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lv6chhpot3nlsfkbd8u0.png)

##### Alarms and permissions
* Provides task event monitoring alarms,  detailed alarm histories, and support notifications with WeChat, Feishu, and webhook triggers. 
* Designed with namespace, support button-level access  and easy to manage complex project.

##### Multiple languages
- **Java** java and its frameworks, with native support.
- **Go** golang support use `go mod` install
- **PHP** PHP support use Golang agent to execute task by shell mode 。Swoole frameworks support composer install.
- **Python** python support use Golang agent to execute task by shell mode

### Use cases
Openjob is well-suited for business scenarios that have task schedule and delay task. such as every day to clean data and report generation. It is also suitable for lightweight computing, and Map/MapReduce can process big data computing. For complex task flows or workflow, it can design workflow with UI

## Open source
|**Item**|**Quartz**|**Elastic-Job**|**XXL-JOB**|**Openjob**|
| ----- | ----- | ----- | ----- | ----- |
|Cronjob|Cron|Cron|Cron|* Cronjob<br>* second<br>* Onetime<br>* Fixed rate|
|Delay task|No|No|No|Distributed, high-performance delay task  based on Redis|
|Workflow|No|No|No|Workflow design with UI|
|Distributed Computing|No|Sharding|Sharding|* Broadcast<br>* Map/MapReduce<br>* Sharding|
|Multiple languages|Java|* Java<br>* Shell|* Java<br>* Shell|* Java<br>* Go(Gin、beego)<br>* PHP(Swoft)<br>* Python(Agent)<br>* Shell<br>* HTTP<br>* Kettle|
|Visualization|No|Weak|* Task history<br>* Task log（Not support storage）<br>* Dashboard|* Task history<br><br>* Task log（support H2/Mysql/Elasticsearch）<br>* Dashboard<br>* Full permissions<br>* Task log stack|
|Manageable|No|enable、disable task|* enable、disable task<br>* execute once<br>* stop|* enable、disable task<br>* execute once<br>* kill<br>* stop|
|Alarms|No|email|email|* custom event<br>* email<br>* webhook|
|Performance|Every task scheduling try to acquire a lock through the database, causes a high pressure on the database|ZooKeeper  is performance bottleneck|Task scheduling is only by master, causes a high pressure on master|Uses sharding algorithm, each node can be scheduled without lock, supports unlimited horizontal scaling, and supports big task scheduling|

## More
* Official website: [https://openjob.io](https://openjob.io/)

* Github: [https://github.com/open-job/openjob](https://github.com/open-job/openjob)
* Live demo: [https://demo.openjob.io](https://demo.openjob.io/)