Search This Blog

Wednesday, July 2, 2025

Q21-Q25

Q21: Define Event Sourcing Architecture Design pattern? [Microservice Architecture Design patterns -- Database per Microservice, Event Sourcing, CQRS, Saga, BFF, API Gateway, Strangler, Circuit Breaker, Externalized Configuration, Consumer-Driven Contract Tracing]
Q22: Define Saga Architecture Design pattern
Q23: What is BFF ( Backend for Frontend) Architecture Design pattern?
Q24: What is API GateWay Architecture Design pattern?
Q25: Difference between Reverse proxy and Forward Proxy service/ Layer?
----------------------------------------------------------------------------------------------------------------------------
Q21: Define Event Sourcing Architecture Design pattern

Answer:
Here in this pattern Instead of storing the current state/ Final state of an object in database, Event Sourcing persists all events that occur in the application, allowing the state of the object to be reconstructed at any point in time.

In this pattern, every state change in the application is captured as an event and stored as a log of events. The state of the application can be reconstructed by replaying these events. This means that Event Sourcing provides an audit log of all changes that occur in the application.
For example, consider an e-commerce application. When a user places an order, an OrderPlaced event is generated and stored in the log. When the order is shipped, a ShipmentMade event is generated and stored in the log.
If the order is canceled, a OrderCanceled event is generated and stored in the log. By replaying the events, the current state of the order can be determined.


----------------------------------------------------------------------------------------------------------------------------
Q22: Define Saga Architecture Design pattern

Answer:
The Saga pattern provides a way to manage transactions that involve multiple microservices. It is used to ensure that a series of transactions across multiple services are completed successfully, and if not, to roll back or undo all changes that have been made up to that point.

Advantage of using SAGA 
1. Can be used to maintain the data consistency across multiple services without tight coupling.

The disadvantage of using SAGA
Complexity of the SAGA design pattern is high from the programmer's point of view and developers are not well accustomed to writing sagas as traditional transactions.
----------------------------------------------------------------------------------------------------------------------------
Q23: What is BFF ( Backend for Frontend) Architecture Design pattern?

Answer:
Backends for Frontends (BFF) is a design pattern used in microservice architecture to handle the complexity of client-server communication in the context of multiple user interfaces. It suggests having a separate back-end service for each frontend to handle the specific needs of that interface.
This allows developers to optimize the data flow, caching, and authentication mechanisms for the unique needs of the front-end while keeping the back-end services modular and decoupled.
For example, suppose you have a web application and a mobile application that need to access the same set of services. In this case, you can create separate back-end services for each application, each optimized for the specific platform.
The web application back-end can handle large amounts of data for faster loading, while the mobile application back-end can optimize for lower latency and network usage.

----------------------------------------------------------------------------------------------------------------------------
Q24: What is API GateWay Architecture Design pattern?

Answer:
The API Gateway Pattern is another common design pattern used in microservices architecture that involves an API gateway, which acts as an entry point for all incoming API requests. It provides a single point of entry for all the microservices and acts as a proxy between the clients and the microservices, routing requests to the appropriate service.
The main purpose of an API gateway is to decouple the clients from the microservices, abstracting the complexity of the system behind a simplified and consistent API. This also means that you don’t need to find and remember address of 100+ Microservice REST APIs.

----------------------------------------------------------------------------------------------------------------------------
Q25: Difference between Reverse proxy and Forward Proxy service/ Layer?

Answer:
Diagram

Description automatically generated
----------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Q31-Q35

Q31: What is pods and how it is related to Docker images and Docker containers? Q32: What is the use of Compose Docker file? Q33. What are t...