Concepts of API Gateway

API Gateway

API Gateway is a special service that hides the internal architecture of the application. It ensures a single entry to the application world from outside.

API Gateway responsibilities

Responsibilities of the API gateway are as follow

  • Routing
  • Authorization and Authentication
  • Monitoring
  • Protocol Translation
  • Request logging
  • Response caching
  • API composition
  • Rate limiting

Service APIs Clients

Types of the client communicate with service APIs

  • Webservers
  • Clients: Browser
  • Clients: Mobile Based
  • Third-party clients

Issues without API gateway

Without an API gateway, clients have to communicate directly with the services.

  • Clients have to handle the complex composition logic and multiple API calls to the server results in the performance impact as well.
  • It’s challenging to update clients as they are tightly coupled with the services.
  • Services are bound to utilize the communication protocols that can be consumed by the clients.
  • Authentication
  • Authorization
  • Rate limiting
  • Caching
  • Metrics Collection
  • Request logging
  • At each backend service [ Impact: Need to implement edge function in each service]
  • At edge service which is upstream to the API gateway [ Advantage: Separation of concern. Impact: Add latency due to extra network hop]
  • At API gateway
  • It hides the architecture of the application.
  • Extra management efforts for the lifecycle of the API gateway component e.g. deployment, development, testing and management
  • Impact on Scalability and Performance of the application with sync vs async IO operations
  • Reactive programming
  • Handling of the partial failures (Multiple instances of the API gateway, Timeout of the requests, Circuit breaker, Fault tolerance)

API Gateway Implementation

Numerous ways to implement the API gateway.

  • Use an existent API gateway product/service
  • Devising your own API gateway

Use an existent API gateway product/service

  • API Gateway (AWS)
  • ALB (AWS)
  • Open Source API Gateway: Kong or Traefik

DIY API Gateway

API gateway is a straightforward service that proxies the request to other services.

  • Simplified the mechanism for routing rules
  • Accurate proxying behavior for HTTP requests
  • Netflix Zuul
  • Spring Cloud Gateway

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ajay Yadav

Ajay Yadav

Believer of Distributed Systems