API Components
What is an API?
Proxy​
A proxy is something that acts on behalf of something else. Sitting between your application and your backend, API proxies provide an interface to developers for accessing backend services.
An API proxy is a simple "connector" between two APIs. It provides a conversion of the API itself (message formats) and sometimes limited data conversion, but it adds no security, scalability or resilience features to the API.
an API Proxy decouples the frontend of the API from the backend services and filters all incoming and outgoing traffic. The decoupling of front-end and back-end services allows for changes to be made to backend services without disrupting the production API. The filtering of incoming and outgoing traffic allows for monitoring, basic forms of security, request routing, and protocol translation.
the server has no idea which client requested
Reverse Proxy​
A reverse proxy accepts a request from a client, forwards it to a server that can fulfill it, and returns the server’s response to the client.
client has no idea which servers send response
Load Balancer​
A load balancer distributes incoming client requests among a group of servers, in each case returning the response from the selected server to the appropriate client.
API Gateway*​
Each microservice develops more and more service dependencies over time. once services begin to grow and start affecting the number of instances, locations, and protocols.
API gateways help avoid problems that arise from these changes. And this is how it works: An API gateway takes all API requests and then routes every single one to the most appropriate microservice.
API Gateways function in a similar way but have a much more robust set of features. Gateways perform the same functions as API Proxies, decoupling the frontend and backend of the API, monitoring, basic security, request routing, and protocol translation, but can also provide:
-
Advanced Security
-
Composition
-
Custom API
-
Load Balancing
-
Caching
-
Request Shaping and Management
-
Static Response Handling (Static response handling in API Gateway is a feature that allows you to define a fixed response for a particular API request directly within the API Gateway, without forwarding the request to a backend service. )
-
Throttling (Throttling in API Gateway refers to the process of limiting the number of API calls a user can make within a given time frame. This is a crucial aspect of managing an API's performance and availability.)
If you have different microservices with a set of shared common features, such as authentication, API Gateways can centralize that service so that it doesn’t have to validate each individual microservice.