Distributed Spring Batch

Eliminate the Broker by Making Your Database the Coordination Plane

Distributed Spring Batch partitioning already needs a shared, persistent job repository.

3 min readInfoQ
Eliminate the Broker by Making Your Database the Coordination Plane

The database isn't just storing job metadata anymore, it's running the show. Janardhan Reddy Chejarla's proposal to eliminate the message broker in distributed Spring Batch partitioning and make the shared job repository the sole coordination plane is a pragmatic shift that deserves serious attention from anyone managing batch workloads. This isn't about chasing architectural purity; it's about removing a moving part that often introduces latency, serialization overhead, and a separate failure domain. For teams already maintaining a persistent job store, this approach turns an existing asset into a control center, and that has real consequences for reliability and operational complexity.

The core insight is elegant: if every node already reads from and writes to the same database to track job steps, why route coordination through an external broker? Chejarla's design sizes work dynamically to the live node count, uses a per-job master instead of a standing coordinator, and relies on compare-and-set operations to prevent double-execution. Two-phase heartbeat failover handles node loss without a separate health-check service. This pattern directly addresses the friction Uber faced when giving multiple orchestrators safe control over scaling, as detailed in How Uber Gives Multiple Orchestrators Control Over Scaling Without Conflict. Both approaches trust the database to mediate concurrent state changes, but Chejarla's goes further by removing the broker entirely, betting that the database's transactional guarantees are sufficient for both storage and signaling. That bet pays off when your broker becomes a bottleneck or a single point of failure, but it demands a database that can handle the increased write volume and contention.

This is not a universal replacement for brokers. Chejarla acknowledges scenarios where a broker remains the right choice: high-throughput event streaming, pub-sub patterns with many subscribers, or systems already deeply integrated with Kafka or RabbitMQ. The decision hinges on whether your coordination needs are primarily state-based (claim a job, update its status) or event-based (trigger a cascade of downstream actions). For state-based coordination, the database is a natural fit. For event-based workflows, forcing everything through a job table adds polling overhead and latency that a broker handles natively. This distinction echoes the layout trade-offs explored in Four Workloads, Three Layouts: A Practical Guide to Lakehouse Data Decisions, where the right physical data structure depends on whether your workload is read-heavy, write-heavy, or mixed. Both articles remind us that architectural choices should follow workload patterns, not fashion.

The concrete takeaway: if your Spring Batch jobs already use a shared database for persistence and you are fighting broker latency or operational overhead, Chejarla's pattern offers a clear path to reduce complexity without sacrificing fault tolerance. The key detail to watch is your database's handling of compare-and-set contention under load. If your jobs are short-lived and numerous, the row-locking overhead could offset the broker removal gains. Teams should prototype with their actual job mix before committing to production.

From InfoQ

Distributed Spring Batch partitioning already needs a shared, persistent job repository. This article makes that database the whole coordination plane and drops the message broker, sizing work to the live node count, a per-job master with no standing coordinator, compare-and-set claiming that prevents double-execution, two-phase heartbeat failover, and where a broker is still the right choice.

Read the original at InfoQ