Load balancer and API Gateway confusion

API Gateway and Load Balancer are 2 different things.

Load Balancer -> Its a software which works at protocol or socket level (eg. tcp, http, or port 3306 etc.) Its job is to balance the incoming traffic by distributing it to the destinations with various logics (eg. Round robin).
I doesn’t offer features such as authorisation checks, authentication of requests etc.

Whereas

API Gateway -> Its a managed service provided by various hosting companies to manage API operations to seamlessly scale the API infra.
It takes cares of the access control, response caching, response types, authorisation, authentication, request throttling, data handling, identifying the right destinations based on custom rules, and seamless scaling the backend.
Generally Managed API gateways by default comes with scalable infra, so putting them behind load balancer might not make sense.

About resolving the Domain, most likely always the DNS resolves to the load balancer, which in turn fetches the response from the API gateway service.

DNS -> Load Balancer -> API gateway -> Backend service

Hope I could explain and clear your confusion.

Leave a Comment