System Design Basics: API Gateway
Thanks to the original article: https://medium.com/geekculture/system-design-basics-api-gateway-6e3387698f92
API Gateway
An API gateway is an API management tool that sits between a client and a collection of backend services.
According to Nginx, an API gateway takes all API calls from clients, then routes them to the appropriate microservice with request routing, composition, and protocol translation. Typically it handles a request by invoking multiple microservices and aggregating the results, to determine the best path. It can translate between web protocols and web?unfriendly protocols that are used internally.
An API gateway is a conductor that organizes the requests being processed by the microservices architecture to create a simplified experience for the user. It’s a translator, taking a client’s many requests and turning them into just one, to reduce the number of round trips between the client and the application. An API gateway is set up in front of the microservices and becomes the entry point for every new request being executed by the app. It simplifies both the client implementations and the microservices app.
Why is an API Gateway used?
An API Gateway serves the following functions:
API Management System
According to RedHat, API management refers to the processes for distributing, controlling, and analyzing the APIs that connect applications and data across the enterprise and across clouds. The goal of API management is to allow organizations that create APIs or use others’ APIs to monitor activity and ensure the needs of the developers and applications using the API are being met.
领英推荐
It generally has the following capabilities:
Disadvantages of API Gateway
Kong vs Amazon API Gateway
Kong and Amazon API Gateway are two of the most popular API Gateways in the market.
AWS describes?Amazon API Gateway?as “Create, publish, maintain, monitor, and secure APIs at any scale”. Amazon API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, authorization, access control, monitoring, and API version management.
Kong?is detailed as an “Open Source Microservice & API Management Layer”. Kong is a scalable, open-source API Layer (also known as an API Gateway, or API Middleware) & is built on top of NGINX. Kong controls layer 4 and 7 traffic and is extended through Plugins, which provide extra functionality and services beyond the core platform.
Amazon API Gateway has an edge in terms of a learning curve as it’s a fully managed service. It also fits very elegantly if you’re in the AWS ecosystem. Kong on the other hand is more open to customization as it’s open source and is easily integrated into plugins and additional layers both on L4 and L7. Both are very highly and closely rated on Gartner’s collection of reviews.
Conclusion
API Gateway is a valuable part of any architecture that has multiple microservices, different kinds of users, and functionalities exposed to the outer world. It is vital in scaling your system, but can also act as a bottleneck and single point of failure if not utilized correctly.
Senior Software Engineer ? Full Stack ? JavaScript ? PHP ? MySQL ? AWS
2 年We need?an API gateway because?it provides a unified entry point across internal APIs.