API Gateway

Advantages of API Gateway


ProxySingle point of entry - client doesn’t need to know what is the IP address or microservice they only know the API gateway domain IP.

API composition - client can ask for product details in one API end point that can have catalog info, likes, comments, pictures in different services which collate as one response and send it. 

Security - Inorder to use each microservice they need to authenticate and authorize that logic can hardwire in gateway or contact a service for Authentication and authorization and decide to call the API or not.

Service discovery - If auto scaled up or down we need a way to know the services available hence API gateway will talk to service registry to get those details and route call. If it tracks different version of the services and API’s.

Service partition hidden - suppose we can common service for comments and likes we use the same API in client to get the comments and likes together. Later we split it the client doesnt need to change to two APIs they use the same API so it composition is handled in gateway. 

Hiding microservice - User doesnt know the details or communication protocol of each service they use API.

Circuit breaking - While doing API composition we can have one service down which can timeout and try after it some time. If its still down we avoid calling it for some more time. We can have priority based on use case if that service is must e.g product service is down then no point in calling comments or likes.

Comments

Popular posts from this blog

Decorators in python - Part 1

Class Decorator practical uses - Part 2

Public key cryptogrphy - How certificate validation works using certificate chain