Library / SDK
apache/shardingsphere-elasticjob avatar
apache/shardingsphere-elasticjob

ElasticJob: A Decentralized Sharding Scheduler for Java Distributed Jobs

Distributed scheduled job. ElasticJob became an Apache ShardingSphere Sub-project on May 28 2020.

8,208 stars3,246 forksJavaApache-2.0

At a glance

What is it?
Apache ShardingSphere's ElasticJob brings sharding, failover, and misfire handling to Java scheduled jobs via ZooKeeper. It targets teams that need to scale batch work across many nodes without a central scheduler.
Who is it for?
Adopt ElasticJob if you run Java 8+ batch jobs that need sharding across multiple nodes, high availability, and failover, and you already operate ZooKeeper. Skip it if you want a lightweight cron replacement, need DAG dependencies (still marked TODO), or cannot accept the operational overhead of a ZooKeeper cluster.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 5 days ago.
What is it written in?
Mainly Java, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

What ElasticJob Solves and Who Needs It

ElasticJob addresses a specific pain: running scheduled jobs in a distributed environment where a single node can fail, jobs must scale horizontally, and duplicate execution is unacceptable. The README positions it as a lightweight, decentralized solution for distributed task sharding. It targets Java developers who want to avoid writing their own coordination logic for job distribution. The typical user is a team running many batch processes across a cluster, such as data synchronization, report generation, or file processing. The project lifts non-functional concerns like scale-out and high availability off the developer, letting them focus on business code. It also reduces operator burden by automating failover and resource allocation. If your jobs are simple and run on one node, ElasticJob is overkill. But for multi-node deployments, it offers a structured way to split work into shards and ensure each shard runs exactly once.

The Sharding Mechanism and ZooKeeper's Role

ElasticJob's core is decentralized sharding. Unlike a central scheduler that assigns work to nodes, each ElasticJob instance coordinates with others through ZooKeeper. The README lists ZooKeeper 3.6.0 or above as a required environment, and the registry center is a core component. When a job is triggered, ElasticJob divides the job into shards, and each shard is assigned to a specific job executor. The assignment is dynamic: if a node goes down, its shards are redistributed to surviving nodes. The README mentions 'self diagnose and recover when distribute environment unstable', which suggests the system detects and recovers from network or node failures. The 'Aggregation same job to same job executor' feature implies that shards of the same job are grouped on the same executor to reduce overhead. This design avoids a single point of failure because there is no master scheduler. However, it introduces a dependency on ZooKeeper as the coordination backbone. If ZooKeeper is down, ElasticJob cannot manage shards or failover, so your jobs may not run. That is a trade-off: decentralization at the cost of an external infrastructure dependency.

Getting Started: Commands and Configuration

The README gives minimal setup instructions, but the requirements are clear. You need Java 8 or above, Maven 3.5.0 or above, and ZooKeeper 3.6.0 or above. To use ElasticJob, you add the Maven dependency from Maven Central, likely 'org.apache.shardingsphere.elasticjob:elasticjob'. The exact artifact is visible in the Maven badge URL. After adding the dependency, you configure a job by implementing a job type interface, such as a simple job or dataflow job. The README mentions a unified job API and support for job types like dataflow, script, HTTP, file, and big data. You then register the job with the ElasticJob scheduler and point it to your ZooKeeper connection string. The configuration typically includes the job name, sharding total count, cron expression, and ZooKeeper address. The README does not provide a code sample, so you would need to consult the official documentation at the website. The admin console, a separate project, provides a UI for job administration and event trace query. For a quick start, you would clone the repo, build with Maven, and run the examples if they exist in the repository. The actual commands are not in the README, but the environment requirements are explicit.

Job Governance: Failover, Misfired, and Self-Recovery

ElasticJob's job governance features are its main selling point. The README lists failover, misfired, and self-diagnosis as core capabilities. Failover means if one node crashes mid-execution, another node picks up the shard and continues. Misfired handling deals with jobs that were supposed to run but missed their trigger, often due to node overload or network issues. The exact behavior is not detailed in the README, but typical implementations either execute the missed job immediately or discard it depending on configuration. Self-diagnosis and recovery suggest that ElasticJob monitors the health of the distributed environment and takes corrective action without human intervention. These features are essential for production batch systems where a missed job can cause data inconsistency. However, the README does not specify how these are configured or tuned. You would need to read the official docs to understand parameters like misfire threshold or failover timeout. This is a limitation: the README is high-level, so you cannot assess the robustness of these mechanisms without deeper documentation.

Limitations and Cases Where It Is the Wrong Tool

ElasticJob is not a general-purpose scheduler. The README marks 'Job Dependency' as TODO, meaning DAG-based job dependencies are not yet implemented. If your workflow requires job A to complete before job B starts, ElasticJob will not handle that out of the box. You would need to orchestrate dependencies externally. Another limitation is the mandatory ZooKeeper dependency. For small deployments, running a ZooKeeper ensemble adds significant operational overhead. If you only have a handful of jobs running on a single node, ElasticJob is over-engineered. The project also seems to have a slow release cadence: 3.0.3 in March 2023, 3.0.4 in October 2023, and 3.0.5 in February 2026. That gap suggests either stability or limited active development. The README's claim of 'lightweight' is relative; the dependency on ZooKeeper and the need for a separate admin console make it heavier than a simple cron library. For teams without existing ZooKeeper infrastructure, the learning curve is real.

Alternatives and How They Differ

The most direct alternative is Quartz with clustering. Quartz is a Java job scheduler that can run in a clustered mode using a database for persistence. The key difference is that Quartz uses a database to coordinate job locks, whereas ElasticJob uses ZooKeeper for sharding and failover. Quartz is more mature and has a smaller footprint if you already have a database. However, Quartz's clustering typically provides high availability but not sharding: it ensures one node runs a job, but it does not split a job into parallel shards across nodes. ElasticJob's sharding model allows a single job to be split into N shards and executed on multiple nodes simultaneously, which can improve throughput. Another alternative is the Spring Batch framework, which provides partitioning but requires more manual configuration. For cloud-native environments, you might consider Kubernetes CronJobs, but those do not handle cross-node sharding within a single job. The choice depends on whether you need sharding or just failover. If you need parallel processing of a large job, ElasticJob's sharding is a clear advantage. If you only need to ensure a job runs once, Quartz is simpler.

Maintenance, Upgrade Cost, and License

ElasticJob is an Apache-2.0 licensed project, which means you can use it commercially without restrictive obligations, though you must retain license notices. The project is an Apache ShardingSphere sub-project, which gives it a governance structure and a mailing list for support. The maintenance cost is tied to ZooKeeper: you must monitor and maintain the ZooKeeper cluster as part of your infrastructure. The upgrade path from 3.0.4 to 3.0.5 took over two years, so you should expect infrequent releases. That can be a benefit if you prefer stability, but it also means bug fixes and new features arrive slowly. The README does not provide a migration guide or upgrade notes, so you would need to review the release notes manually. The admin console is a separate project, which adds another component to deploy and keep in sync. Overall, the operational cost is moderate: you need to manage ZooKeeper, the ElasticJob library in your applications, and optionally the admin console. The license is permissive, which lowers the legal barrier for adoption.

Editorial conclusion

Adopt ElasticJob if you run Java 8+ batch jobs that need sharding across multiple nodes, high availability, and failover, and you already operate ZooKeeper. Skip it if you want a lightweight cron replacement, need DAG dependencies (still marked TODO), or cannot accept the operational overhead of a ZooKeeper cluster. Before adopting, verify ZooKeeper 3.6.0+ compatibility, test failover and misfire behavior under your network partition scenarios, and confirm the 3.0.5 release notes match your expectations since the project's release cadence has been slow.

Official sources

  1. Official README
  2. Project repository
  3. Release notes
Community notes

Community notes