Tuesday, March 29, 2022

Microservices Distributed Caching | Udemy course | Mehmet Özkaya

 Here is the link. 

Microservices Distributed Caching

In this article, we are going to talk about Microservices Distributed Caching for Microservices Architectures. As you know that we learned practices and patterns and add them into our design toolbox. And we will use these pattern and practices when designing e-commerce microservice architecture.




By the end of the article, you will learn where and when to use Microservices Distributed Caching into Microservices Architecture with designing e-commerce application system.

Microservices Distributed Caching

We are going to talk about Microservices Caching. Caching is one of the important topic when you want your application faster.

Caching can increase performancescalability, and availability for microservices. The main idea is reducing latency with cache and makes application faster. When the number of requests are increased, caching will be really important for accommodating whole requests with high availability.

Reading data more than writing data | Caching | Julia's notes

If application request mostly comes for reading data that is not changes so frequently, then Caching will be so efficient. For example reading product catalog from e-commerce application can be cached in the architecture.

Caching also provide to avoid re-calculation processes. If one operations calculate by one server, then other application can consume calculated data from cache. In Microservices architectures are typically implement a distributed caching architecture.


Look at the above image. You can see that this is similar our microservice architecture. An API Gateway accommodate requests and invoke several internal backend microservices and aggregate them into 1 response.

So how we can increase the speed of this use case?

Of Course we should use The distributed cache. The distributed cache increases system responsiveness by returning cached data.

Separating the cache server from the microservices, cache services can be scaled up independently. <- read again

Additionally, separating the cache server from the microservices, gives ability to independently scale up cache services. This can be very useful when increased traffic of requests.

You can also use in-memory cache in our microservices, but it is not efficiency like distributed cache due to scalability issues. So now we can use distributed cache in our e-commerce design.

Design the Architecture — Microservices Distributed Caching

We are going to design our e-commerce application with the Microservices Distributed Caching. We will iterate the architecture design one by one as per requirements.




As you can see that now we have used Distributed Caching in our e-commerce architecture. Now lets decide to Technology Stack in this architecture.

Of course we should pick: Redis.

Redis, which stands for Remote Dictionary Server, is a fast, open-source, in-memory key-value data store for use as a database, cache, message broker, and queue. Redis is Fast, open source in-memory data store for use mostly as a database and cache. So its good to use Redis in our architecture.

So we should evolve our architecture with applying other Microservices Data Patterns in order to accommodate business adaptations faster time-to-market and handle larger requests.


No comments:

Post a Comment