Monday, September 11, 2023

Microservice Architecture

 The diagram below shows a typical microservice architecture.



🔹Load Balancer: This distributes incoming traffic across multiple backend services.

🔹CDN (Content Delivery Network): CDN is a group of geographically distributed servers that hold static content for faster delivery. The clients look for content in CDN first, then progress to backend services.

🔹API Gateway: This handles incoming requests and routes them to the relevant services. It talks to the identity provider and service discovery.

🔹Identity Provider: This handles authentication and authorization for users.

🔹Service Registry & Discovery: Microservice registration and discovery happen in this component, and the API gateway looks for relevant services in this component to talk to.

🔹Management: This component is responsible for monitoring the services.

🔹Microservices: Microservices are designed and deployed in different domains. Each domain has its own database. The API gateway talks to the microservices via REST API or other protocols, and the microservices within the same domain talk to each other using RPC (Remote Procedure Call).

Benefits of microservices:
- They can be quickly designed, deployed, and horizontally scaled.
- Each domain can be independently maintained by a dedicated team.
- Business requirements can be customized in each domain and better supported, as a result.

 What are the drawbacks of the microservice architecture?

Complexity: Managing multiple services, especially when they are high in number, can add significant complexity to the system.

Service Coordination: Ensuring that services work harmoniously can be challenging, especially when considering transactional operations spanning multiple services.

Network Latency: Since microservices communicate over a network, there can be a latency overhead compared to in-process calls in monolithic architectures.

Data Consistency: Ensuring data consistency across services, which might have their databases, can be complex, especially without distributed transactions.

Operational Overhead: Multiple services mean more deployments, monitoring endpoints, and more potential points of failure.

Distributed System Challenges: Issues like network partitioning and ensuring high availability come with distributed systems.

Versioning: As services evolve, ensuring backwards and forward compatibility becomes critical.

Security Concerns: More exposure points can lead to more potential security vulnerabilities.

Initial Development Overhead: Microservices setup is initially time-intensive due to foundational needs.

No comments:

Post a Comment