Quick Overview of Cloud Patterns in Microservices Architecture - Part 2

Quick Overview of Cloud Patterns in Microservices Architecture – Part 2

The Microservice architecture implementation with cloud patterns is explained in this article. Usually, the request will send from Client side to gateway and the gateway will pass the request to particular service interface (Repository Pattern). Then the interface will pass the request to CQRS pattern, which will return the data from database. Before accessing the database it will check the data is available in Cache or not. If data is available in Cache, the client request will return from cache.

The below mentioned are the cloud patterns from Azure:

  • Repository Pattern
  • CQRS Pattern
  • Cache Pattern

Microservice architecture

What is repository Pattern?

The repository pattern is intended to create an abstraction layer between the data access layer and the business logic layer of an application. It is a data access pattern that prompts a more loosely coupled approach to data access. The data access logic is created in a separate class, or set of classes called a repository with the responsibility of persisting the application’s business model.

What is repository Pattern

Using the Repository Pattern has many advantages:

  • The business logic can be unit tested without data access logic.
  • The database access code can be reused, centrally managed, and easily implemented
  • Access policies, like caching
  • The domain entities or business entities are strongly typed with annotations; and more.

What is CQRS design pattern?

Command Query Responsibility Segregation (CQRS) is another architectural design pattern used in micro services architecture which will have a separate service, model, and database for insert operations in the database. This acts as a command layer that performs an action or a Query that returns data

Command: It is a method that either changes the state of an object, has side-effects, or fulfills both criteria at the same time. However, a command deliberately does not return a return value, which is why it cannot return any information about the state of an object.

Query: It is a method that returns information about the state of an object, but must not influence this state or have any other side effects.

What is CQRS design pattern

What is Cache Aside Pattern?

What is Cache Aside Pattern

The Cache Aside pattern improves the performance by utilizing caches while reading data from the data store. This pattern can be used for read and update operations of data to and from the data store. The different types of caches are

  • In-Memory Cache is used for when implementing cache in a single process. When the process dies, the cache dies with it. If the same process needs to run on several servers, a separate cache needs to be used for each server.
  • Persistent in-process Cache is used when there is a requirement of cache backup outside of process memory. The backup can be in form of file, or in a database. However, in case of process restart, the cache will be lost.
  • Distributed Cache is used when there is requirement of shared cache for several machines such as servers. With a distributed cache, it is stored in an external service. This means if one server saved a cache item, other servers can use it as well.

Talk to our Microsoft Expert Team

Related Posts

Free Consulting