How a typical Microservice looks like.

·

3 min read

The diagram at the end shows a simplified version of what a Microservice looks like. A Microservice Architecture is made up of several components:

  1. Load Balancers - This distributes incoming traffic across multiple backend services.

    Benefits:

    • Traffic distribution.

    • Health Checks.

    • High Availability.

    • Scalability.

  2. CDN(Content Delivery Network) - CDN is a group of geographically distributed servers that hold static content for faster delivery. Upon establishing connections, the clients normally look for content from the CDNs first before trying to look for the services in the backend.

    Benefits of CDN:

    • Improves read latency.

    • Improves the read scalability.

    • Improves the System's reliability.

    • Makes the System resilient against DDOS attacks.

  3. API Gateway- This handles incoming requests and routes them to the relevant services. It communicates to the identity providers and the service discovery. Think of it as a specialized type of Reverse proxy.

    Benefits:

    • Request Routing.

    • API management.

    • Authorization.

    • Rate limiting.

    • Caching.

  4. Identity providers- This handles the authorization and authentication for users. It abstracts this task to below crucial services:

    • Authentication.

    • Authorization.

    • Access control.

  5. Service registry & Discovery- Microservice registration and discovery happen in this component, and the API gateway looks for relevant services in the component to talk to. It contains a list of IP addresses of all the healthy instances of the Microservices. When a new request is made, the API gateway reads the information from the service registry, gets the list of available service instances and picks one particular instance to send a request to.

  6. Management- This component is responsible for monitoring the services.

  7. Microservices- Microservices are designed and deployed in different domains. Each domain has its database. The API gateway talks to the Microservices via the REST API or other protocols, and the Microservices within the same domain talk to each other via RPC(Remote Procedure call). Each Service is owned and maintained by its team and can be hosted in their separate domain.

    Benefits:

    • Modularity.

    • Scalability.

    • Autonomy and flexibility.

    • 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.

Image

  1. Reverse proxy - This is a server sitting in front of one or more application servers. It keeps original servers hidden and protects servers from malicious client requests.

    Benefits:

    • Privacy and protection of backend services.

    • Security.

    • Load balancing.

  2. Cache- This is an in-memory storage component, for faster access to frequently requested resources/APIs.

    Benefits:

    • Improved performance.

    • Reduced latency.

    • Enhanced user experience.

That is it for today. I appreciate your time.

Credits to @happydecod on X(formerly Twitter).