imelamory - Fotolia

What's the role of an application load balancer vs. API gateway?

Application load balancers and API gateways both manage network traffic, but in their own ways. Learn the differences between them and how to use them together in a modern IT deployment.

Load balancers and API gateways both handle network traffic, but the services function and support enterprise networks differently.

Load balancers direct traffic

When it comes to an application load balancer vs. API gateway, the former commands traffic flow.

A load balancer distributes incoming network traffic across two or more servers. An enterprise network sees high volumes of traffic, and an application that runs on a single server sometimes lacks sufficient network or compute power to handle all of the traffic requests it receives.

An enterprise must run two or more application instances concurrently -- often on two or more physical servers. This provides applications with the capacity to handle all of the traffic, while redundancy helps ensure high availability: If one server fails, the load balancer redirects traffic to the remaining instances on other servers.

Load balancers direct incoming network traffic to each respective server via algorithms. A round robin algorithm distributes traffic basically evenly -- for example, in a two-server configuration, this algorithm assigns 50% of traffic to each server. A least connections algorithm directs traffic to the server with the fewest active connections, which is propitious when an environment's servers vary in capabilities. An IP hash algorithm directs network traffic to servers based on the traffic request's origin. This algorithm is ideal for IT environments in which servers reside in different geographic regions; traffic is routed to the closest physical server for the lowest application latency.

An organization can deploy a load balancer as a dedicated physical device or as software that runs on virtual servers.

How load balancing works

API gateways complete the puzzle

To further distinguish between an application load balancer vs. API gateway, think of the gateway as an organizer and translator that connects various -- often unrelated -- pieces of software.

An API gateway also manages network traffic, but in a different way. Today's software relies increasingly on APIs to integrate disparate components of an application and enable those components to communicate. An API gateway takes API requests from a client -- which is the software that makes an API call -- and sorts out the destination applications or services necessary to handle those calls. API gateways also manage all of the translations and protocols between different pieces of software.

API gateways are often associated with microservices application design and deployment. Enterprises increasingly envision and create modern applications as a series of independent services, rather than a single monolithic application. Those services communicate via APIs; the API gateway ensures that those services interoperate properly in an overall deployment.

Organizations implement gateways as a service, and most frequently deploy them as a software instance on a VM.

The conversation around network traffic management shouldn't focus exclusively on application load balancers vs. API gateways: enterprises can use the two together, but one doesn't require the other. As an example, an API gateway connects microservices, while load balancers redirect multiple instances of the same microservice components as they scale out.

Next Steps

Pick a load balancer: Azure Front Door vs. Application Gateway

Service mesh vs. API gateway: Where, why and how to use them

Dig Deeper on IT systems management and monitoring

Software Quality
App Architecture
Cloud Computing
Data Center