Blog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2025 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Spring
Springmedium

`@Scheduled` in a cluster — what can go wrong and how do you avoid it?

Tags
#scheduled#cluster#distributed-lock#jobs
Back to categoryPractice quiz

Answer

If you run multiple instances, each one will execute the scheduled job, causing duplicates. Avoid it with leader election, a distributed lock (carefully), a single dedicated scheduler instance, or moving scheduling to an external system.

Related questions

PostgreSQL
What are advisory locks in PostgreSQL and when do they help?
#postgres#locking#advisory-locks
Monoliths
How do you run background jobs in a monolith reliably?
#jobs#queue#worker
Microservices
Distributed locks — when do you need them and what are the risks?
#distributed-lock#coordination#reliability