What is an API Gateway?

API Gateways have become a critical component in the current Microservices based architectures, providing common functionalities required by APIs such as routing, API authentication, access control, rate limiting, billing, capturing analytics, monitoring and providing much needed decoupling between a client and the backend services. To understand further onto what an API gateway is, it is best to start from how it has evolved to exist.


There are two clearly identifiable categories of API gateways in the market;

  • Reverse proxy products that revolved into becoming API gateways, adding features to the core product eg. Nginx
  • API Manager vendors who broke their monolithic application into microservices which let one of those to be API gateway.


Starting from the first category is best to understand the initial requirements. Reverse proxies were already in the market, addressing the need of hiding the internal details of a system and providing an abstract interface for the external parties, interacting with the system. This made reverse proxy a central component which is commonly used by various backend services. Each of these backend services also has the requirements to monitor, secure, control access and limit consumption rates. This is when engineers started to explore how to move those functions to a central point, similar to reverse proxy, rather than implementing the same set of functions in each backend service, which is a repetitive effort without a gain. While this innovation is progressing API Management vendors also realized the need to embrace microservice architecture in their own architecture.


Monolithic API Managers provided both API lifecycle management and API gateway functionalities. From these two functions gateway responsibilities are the most critical and most demanding set of functions which has the scaling requirements. As all the backend service calls go through the API gateway it can easily become a bottleneck. Any negative impact from the gateway such as added latency, can escalate quickly, affecting a vast amount of services. So these vendors separated out the responsibilities to dedicated components making the API gateway an individually scalable entity. Finally, coming from either path, a conventional API gateway in the current market can be defined as below in the diagram.


API Gateway Overview


What API gateway is not?


As any technology, API gateway is also not a silver bullet. Ability to scale for high demands and minimum impact on service calls are critical features for an API gateway. When pushing responsibilities to the API gateway at system design phase, those core values need to be honoured, in order to enjoy the full benefits of using an API gateway and allocated infrastructure.

  • Not a mediator of heavy API payloads : If there are large payload conversion logics placed in the API gateway it will start consuming a considerable amount of memory and CPU causing delays to other services. When such heavy mediations are needed it’s best to delegate the task to a separate mediator component.

  • Not an API orchestrator : If there are transactional API calls to be made in a chained manner, API gateway may not be the ideal solution. Having to keep track of transactional states implies a need to become stateful which can negatively impact scalability of the gateway deployment.

  • Not a firefall : While the rate limiting functionality of API gateways can provide security against Distributed Denial of Service(DDoS) attacks, they are not firewalls. Unless the API gateway is providing special features for proactive security measures, those need to be calculated and addressed.


When applied correctly, API gateways can reduce a large amount of effort and drastically simplify the system designs, in the modern microservices based architectures.


Comments

Popular posts from this blog

Sign into Dokuwiki with Google

Single Sign On Integrations - Intro

Shibboleth based SSO for SAP