Load Balancer and API Gateway

Load Balancer

Load Balancer

Load balancing is the technique which helps network traffic to be routed to different network nodes based on available bandwidth and routing rules so that performance and availability should be achieved optimally.

Modern high usability application must serve thousands of million concurrent requests from users or clients and return the correct response in the form of text, images, video, or application data, all in a fast and reliable manner. For cost effectively scale to meet these high volumes, modern computing best practice generally requires adding more machines or server, as there are several server in behind serving client request so there would certainly a need for a traffic regulator who can decide and direct request to the appropriate server.

To regulate traffic what load balancer does it that – If a server goes down, the load balancer redirects traffic to the remaining available or online servers likewise whenever a new server node is added to the server group, the load balancer automatically starts to send requests to it.

Load Balancer

API Gateway

An API Gateway is a software program which manages the API traffic between client and backend services, it acts like a reverse proxy to accept all application programming interface calls, aggregate various services to perform specific action and return the response back. For an example an online shopping site might use an API gateway to provide mobile clients with an endpoint for retrieving all product details with a single request. It then invokes various services, like product info and reviews, and aggregates the results.

Note that an API Gateway can work like Load Balancer, however Load balancers have been one of the most common ways to expose a backend API to the server but API Gateways appear to provide the same functionality: map and connect HTTP requests to a backend service.

Difference between Load Balancer and API Gateway

1. API Gateway only supports SSL (HTTPS protocol), whereas ALB can also support HTTP – however HTTP support is becoming mostly irrelevant as the entire web continues its transition to HTTPS-only.

2.As per AWS API Gateway offers features that just aren’t available in ALB

Authentication and Authorization : API Gateway has a robust set of features surrounding auth and auth. For example:

Token-based authentication

Resource-based permissions

Integration with IAM for controlling access to the API

Custom authorizers that handle authorization and define custom IAM policies that the API function will run with

Request and Response Mapping : API Gateway supports integration with legacy systems by being able to map requests and responses to the format required by the backend system.

However that is rarely needed for server-less stacks because if you’re using APIGW with Lambda, its likely new code – not legacy code that needs mapping – and you’re able to use the API Gateway “proxy” integration for Lambda.

3.As per AWS – One of the biggest reasons we use API gateway in front of our lambda functions instead of using an ALB is the native IAM (Identity and Access Management) integration that API GW has. We don’t have to do any of the identity work ourselves, it’s all delegated to IAM, and in addition to that, API GW has built-in request validation including validation of query string parameters and headers. In a nutshell, there are so many out of the box integrations what come with API GW, you wind up having to do a lot more work if you go the route of using an ALB.

4.In the case of AWS – API Gateway charges only for requests received. The price depends on what type of API service is used where as ALB charges based on two dimensions: time and resource usage.

Leave a Reply

Your email address will not be published. Required fields are marked *