Over the last few years, I worked mostly on building microservices using Spring Boot, but I never really had a chance to work directly with distributed locking systems like Redis, ZooKeeper, or etcd.
Still, I kept coming across these topics whenever I read about system design, schedulers, or how large systems avoid inconsistent updates. I always wanted to understand how distributed locks actually work and what could go wrong when multiple service instances try to modify the same shared resource.
In microservice architectures, things don’t always fail cleanly. Sometimes a service goes down, but more often it just gets slow, times out, or behaves inconsistently.
If we don’t handle these failures properly, a small outage in one service can quickly turn into a cascading failure across the whole system. That’s where timeouts, retries, backoff, and circuit breakers come in — four reliability patterns that make microservices resilient instead of fragile.
For the last few years, I have been working on building Java microservices using Spring Boot.
In day-to-day development, I often come across terms like retries, transactions, and duplicate requests, especially when building APIs that interact with other services or databases.
While working on one such service recently, I came across the concept of idempotency.
It’s one of those ideas that look simple on the surface but play a big role in making systems reliable.
I decided to explore it in a bit more detail and write down what I learned here.
I have been working as a backend developer for a while now, mostly building Java microservices using Spring Boot.
In day-to-day work, I often come across terms like consistency, availability, and replication while designing APIs or integrating with databases.
Even though I’ve used distributed systems like Kafka, Redis, and MongoDB in projects, I realized I never really understood why they behave the way they do under network failures.
So, I decided to spend some time reading about these two important concepts — CAP and PACELC — and document my understanding here.