Distributed System Lock Implementation using Redis and JAVA

The purpose of a lock is to ensure that among several application nodes that might try to do the same piece of work, only one actually does it (at least only one at a time).

Md Sajedul Karim
5 min readMar 20, 2021
Photo by Emile Perron on Unsplash

In current days I worked on Redis lock-in distributed system. In distributed system Locking/concurrency management is a very important thing. Without prior knowledge, many unwanted problems may occur.

What we will learn here

  1. Create a simple wallet backend with buggy architecture and code
  2. Create the Race condition and identify the problem
  3. Solve the problem using new architecture and implementation
  4. Share the codebase with file descriptions

Here I am sharing an application architecture. Suppose this is a bank wallet application backend. Its architecture is very simple. It has a single app server, single app node, single Redis server, and a single database

Application general architecture

--

--

Md Sajedul Karim

Back-end developer, Spring, JAVA, Distributed system, AWS, Google Cloud, Docker, CD/CI, Kubernetes, databases. https://www.linkedin.com/in/sajedulkarim/