System Design Fundamentals

0% completed

Introduction to API Gateway

Difference between an API gateway and a load balancer

An API Gateway is a server-side architectural component in a software system that acts as an intermediary between clients (such as web browsers, mobile apps, or other services) and backend services, microservices, or APIs.

Its main purpose is to provide a single entry point for external consumers to access the services and functionalities of the backend system. It receives client requests, forwards them to the appropriate microservice, and then returns the server’s response to the client.

The API gateway is responsible for tasks such as routing, authentication, and rate limiting. This enables microservices to focus on their individual tasks and improves the overall performance and scalability of the system.

Image

Difference between an API gateway and a load balancer

An API gateway is focused on routing requests to the appropriate microservice, while a load balancer is focused on distributing requests evenly across a group of backend servers.

Image

Another difference between the two is the type of requests that they typically handle. An API gateway is typically used to handle requests for APIs, which are web-based interfaces that allow applications to interact with each other over the internet. These requests typically have a specific URL that identifies the API that the client is trying to access, and the API gateway routes the request to the appropriate microservice based on this URL. A load balancer, on the other hand, is typically used to handle requests that are sent to a single, well-known IP address, and then routes them to one of many possible backend servers based on factors such as server performance and availability.

Mark as Completed
Syed Mohammad Hassan

Syed Mohammad Hassan

· 3 months ago

My understanding is that:

A load balancer operates at the network level. Its only job is to distribute incoming traffic across multiple servers so no single server gets overwhelmed. It knows nothing about your API. it just sees "a request came in, which server should get it?" It uses strategies like round-robin, least-connections, or IP hashing.

An API gateway operates at the application level. It understands your API. It handles things like authentication/authorization, rate limiting, request routing to the correct microservice, SSL termination, request transformation, logging, and caching. Think of it as the "smart front door" for your API.

Show 1 reply
Sandeep Verma

Sandeep Verma

· 2 years ago

In some design there is gateway before API gateway . API gateway also has capability to load balance. What is recommended? .

Show 3 replies

On This Page

Difference between an API gateway and a load balancer