If you have missed out on the previous two links about Microservices, you can check out this link before reading this article: Microservice – Introduction
What is API Gateway?
An API gateway is between clients and services, acting as a reverse proxy, routing requests from clients to services. It also performs various cross-functional tasks, including an authentication, SSL termination, and rate limiting. If API gateway is not deployed, clients must send requests directly to front-end services. In doing this, there are some potential problems with exposing services directly to clients, including:
- It can result in complex client code. The client must keep track of multiple endpoints, and handle failures in a resilient way.
- It creates coupling between the client and the “back-end”. The client needs to know how the individual services are decomposed. That makes it harder to maintain the client and also harder to refactor services.
- Each public-facing service must handle concerns such as authentication, SSL, and client rate limiting.
- A single operation might require calls to multiple services. That can result in multiple network round trips between the client and the server, adding significant latency.
- Services must expose a client-friendly protocol such as HTTP or WebSocket. This limits the choice of communication protocols. Services with public endpoints are a potential attack surface, and must be cautious.
You can also check on Apigee to search and identify questions regarding API knowledge (Link: https://docs.apigee.com/api-platform/fundamentals/understanding-apis-and-api-proxies)
What is an API?
An API is an interface that makes it easy for one application to “gather” capabilities or information/data from another application. APIs enable developers to easily access and reuse application logic built by other developers. API Web is bit different in that logic and data is exposed over the network. (Source: https://en.wikipedia.org/wiki/API_management)
Since applications that consume APIs are sensitive to changes, APIs also imply a contract. The contract provides some level of assurance the API will change in a predictable manner overtime.
How does API & Microservices related?
Microservices provide fine-grained #APIs based on client needs. Each client needs to interact with multiple services to collect relevant information. For example, a payment client needs to fetch data from several services such as product, customer, and billing.
API Gateway takes care of the external traffic of coordinating with different service. The API Gateway encapsulates the internal system architecture and provides an API that is tailored to each client.
The API Gateway is liable for Protocol translation, Composition, and Request Routing.
If you are trying to connect several hundreds of applications and communicate with each others, you can utilize API Gateways (Example – It allows to increase efficiency, reduce latency (slowing down of application capability), reroute power, aggregates responses from the server and transform the services into something useful.)
Fun Facts about API & Netflix
Netflix has created a cloud-based IT architecture that helps developers to release huge numbers of software changes daily. The Netflix architecture includes an API Gateway that handles approximately 2 billion API edge requests daily, which are handled by about 600+ microservices.
Keywords: #APIGateway #Microservices #APIedge #API #Application #InformationTechnology #APIGatewayandMicroservice #Netflix