Skip to the content.

33. Background Job Processing

Date: 2024-04-13

Status

Accepted

Context

The need for efficient background job processing arises from requirements such as handling big data operations, managing long-running tasks, and automating push notifications, report generation, and email/newsletter dispatches. Additionally, caching strategies like invalidation, hot-cache management, and pre-caching require reliable scheduling and execution mechanisms.

Decision

To address these needs, the following options have been considered for implementing background jobs:

Consequences

Technology Benefits Challenges
Standard Cron Simple and reliable for scheduled tasks. Limited to single-node setups, lacks fault tolerance.
Kubernetes CronJob Scales well with Kubernetes, handles cluster-wide tasks. More complex setup, requires Kubernetes management.
Temporal Provides robust handling of complex workflows, retries, and failures. Higher learning curve, more resource-intensive.
Go Ticker/Timer High precision, integrated directly in Go applications. Requires custom setup for distributed tasks, more manual management of task state.