Cloud Load Balancing in Google Cloud: Sharing Traffic Fairly, Safely and Everywhere
A complete, plain-English guide to Google Cloud's load balancers: what they do, how the different types work, how traffic flows from a visitor to a healthy server, and how to choose, secure, monitor and pay for them wisely.
Picture a very busy airport with a hundred check-in desks. Hundreds of travellers arrive every minute. If everyone rushed to desk number one, a huge queue would form while ninety-nine desks sat idle. So the airport employs a friendly guide at the entrance. The guide looks at which desks are open, which are quick, and which are closed for a break, and then points each traveller to a good desk. If a desk suddenly closes, the guide simply stops sending people there. If the airport opens another hall overnight, the guide starts using it automatically. Cloud Load Balancing is that guide for your applications.
In this guide we begin from zero. We assume you have never heard of a load balancer, a proxy, a health check or a network endpoint group. Every new term is explained with what it is, why it exists, where it is used, an everyday comparison and a practical example. By the end you will understand how the different load balancers work, how requests travel through them, how to keep them secure and fast, how to choose the right one, and which mistakes to avoid.
1What Is Cloud Load Balancing?
Cloud Load Balancing is Google Cloud’s managed service for spreading incoming traffic across many servers, so that applications stay fast, available and able to grow.
The Short Definition
A load balancer sits in front of a group of servers and shares incoming requests among them. The servers behind it are called backends. Visitors never talk to a backend directly. They talk to the load balancer, which decides where each request goes. Cloud Load Balancing is a fully managed, software-defined service. That means there is no box for you to buy, no virtual machine for you to patch, and no capacity to pre-order. Google runs the machinery and scales it for you.
The Problem It Solves
One server can fail, get overloaded, or need maintenance. If your whole application lives on one server, then any of these events makes your service unavailable. Several servers solve the problem, but then something must decide which server handles which request, notice when one stops working, and add or remove servers as demand changes. That “something” is the load balancer. It gives you three gifts: availability because a failed server is skipped, scalability because you can add servers behind it, and performance because work is spread evenly and, in the global types, handled near the visitor.
Where It Is Used
Almost every serious website, mobile app back end and internal business system uses load balancing: online shops during sales, streaming services, banking portals, game servers, internal APIs used by other services, and databases or caches reached over private networks.
A taxi dispatcher. Customers call one phone number. The dispatcher knows which cars are free, which are near, and which have broken down, and sends the best one. The customer never needs to know how many cars the company owns, and the company can add cars without changing the phone number.
Cloud Load Balancing is not one single product with one behaviour. It is a family of load balancer types, each designed for a different kind of traffic and a different location. Choosing the right type is the most important decision you will make, and most of this guide helps you make it well.
2Network Basics You Need First
A few ideas about how computers talk will make every later chapter easier.
Layers of Communication
Computer communication is described in layers. Two matter most here. Layer 4, the transport layer, deals with connections and packets: it knows about addresses, ports and protocols such as TCP and UDP, but does not understand what is inside the message. Layer 7, the application layer, understands the actual content, such as a web address, a header or a cookie in an HTTP request.
A postal sorting office. Layer 4 is a clerk who reads only the street address on the envelope and sends it to the right van. Layer 7 is a clerk who opens the envelope, reads the letter, and decides which department should handle it based on what it says.
Proxy versus Passthrough
A proxy load balancer ends the visitor’s connection and opens a separate, new connection to the backend. It stands in the middle as a go-between. This lets it do clever things such as reading web addresses, decrypting secure traffic and reusing connections. A passthrough load balancer does not end the connection. It forwards the packets as they are, so the backend sees the original visitor address and answers the visitor directly.
| Question | Proxy load balancer | Passthrough load balancer |
|---|---|---|
| What happens to the visitor’s connection? | Ends at the load balancer, a new one is opened to the backend | Continues unchanged to the backend |
| Does the backend see the visitor’s real IP address? | Not by default, the proxy’s address is seen | Yes, the original source address is preserved |
| Can it understand web content? | Yes for Application types | No, it works with packets and ports |
| How do backends reply? | Back through the load balancer | Directly to the visitor |
| Typical strength | Smart routing, security features, TLS handling | Raw speed, any protocol, preserved addresses |
External versus Internal
An external load balancer receives traffic from the internet and delivers it into your Virtual Private Cloud network, which is your private, isolated network in Google Cloud. An internal load balancer receives traffic only from inside your network, or from networks connected to it through peering, VPN or interconnect. Internal load balancers are used between the layers of an application, such as a web tier talking to a private service tier.
Global versus Regional
A regional load balancer lives in one Google Cloud region and serves backends in that region. A global load balancer can serve backends spread across many regions behind a single address. Only external load balancers can be truly global. For internal use, a related idea called a cross-region internal load balancer can spread traffic across regions, using a regional internal address.
Every load balancer type is a combination of four choices: what kind of traffic (web, TCP, or packets), proxy or passthrough, external or internal, and global or regional. Keep these four questions in your pocket.
3The Families and Types of Load Balancers
Google Cloud groups its load balancers into families, and each family comes in several deployment modes.
The Three Families
Application Load Balancers
Layer 7, proxy-based, for HTTP and HTTPS traffic. They understand web addresses, headers and cookies and can route by content.
Proxy Network Load Balancers
Layer 4, proxy-based, for TCP traffic. They can end the connection and optionally handle TLS encryption on behalf of backends.
Passthrough Network Load Balancers
Layer 4, no proxy. They forward packets directly, preserve the visitor’s source address, and support protocols such as TCP, UDP and several others.
Deployment Modes
Within each family, you choose where the load balancer lives and who can reach it. The table below shows the modes that exist today, as described in Google Cloud’s overview. Names and previews change, so always confirm in the current documentation.
| Family | External modes | Internal modes |
|---|---|---|
| Application | Global external, regional external, classic | Cross-region internal, regional internal |
| Proxy Network | Global external, regional external, classic | Cross-region internal, regional internal |
| Passthrough Network | Regional external, and a global external mode that was in Preview at the time of writing | Internal, which is always regional |
Protocols Each Family Handles
| Family | Protocols |
|---|---|
| Application | HTTP and HTTPS |
| Proxy Network | TCP, with optional TLS offload on some modes |
| Passthrough Network | TCP, UDP, ESP, GRE, ICMP and ICMPv6, with the internal type also supporting SCTP and AH |
Three kinds of reception staff in a large hotel. The concierge, who reads each guest’s request and sends them to the right department, is the Application load balancer. The doorman who checks tickets and sends each guest to the right door, without reading their luggage, is the Proxy Network load balancer. The porter who simply carries each guest’s bags straight to their room, keeping their original name tag on, is the Passthrough load balancer.
Treating “classic” load balancers as the default for new projects. The classic modes are the older generation. For new designs, look first at the newer global or regional modes, and read the current documentation about what each mode supports.
4Core Concepts and Vocabulary
Eight words unlock almost every document and conversation about Cloud Load Balancing.
Frontend and Forwarding Rule
The visitor-facing side. A forwarding rule ties an IP address, a port and a protocol to the load balancer, so traffic aimed at that address reaches it.
Target Proxy
The component that receives the visitor’s connection in proxy-based types. For web traffic it is where certificates are attached.
URL Map
The routing table for web load balancers. It decides which backend handles which web address or path.
Backend Service
A group of backends together with the rules for sharing traffic among them: health checks, balancing mode, session affinity and timeouts.
Backend
The actual group of servers or endpoints that receive traffic, such as a group of virtual machines or a set of containers.
Health Check
A regular test that asks each backend “are you working?” so the load balancer can stop sending traffic to unhealthy ones.
Instance Group
A set of virtual machines managed as one unit. Managed instance groups can add and remove machines automatically.
Network Endpoint Group
A set of endpoints, such as container addresses, serverless services or even addresses outside Google Cloud, that a load balancer can use as a backend.
A restaurant. The forwarding rule is the street address and front door. The target proxy is the host who greets you and checks your reservation. The URL map is the seating chart that says starters go to this section and desserts to that one. A backend service is the rules for a section: how many tables, how to rotate guests. Backends are the tables themselves. The health check is the manager who walks around checking each table is usable.
How the Pieces Fit Together
A visitor aims at an IP address and port. A forwarding rule catches that traffic and hands it to a target proxy (or, for passthrough types, straight to the backend service). For web traffic, the URL map examines the request and selects a backend service. The backend service picks a healthy backend according to its balancing rules, and the request is delivered. The reply returns along the reverse path.
flowchart LR
V["Visitor"] --> FR["Forwarding rule: IP, port, protocol"]
FR --> TP["Target proxy: certificates"]
TP --> UM["URL map: routing rules"]
UM --> BS1["Backend service A"]
UM --> BS2["Backend service B"]
BS1 --> B1["Backend: instance group"]
BS2 --> B2["Backend: network endpoint group"]
HC["Health checks"] -.-> B1
HC -.-> B2
5Architecture and Internal Working
There are no load balancer machines for you to see, but understanding how Google builds the service explains its behaviour.
Software-Defined and Distributed
Traditional load balancers were boxes or virtual machines with a fixed capacity. You had to guess how big to make them, and a failure of the box was a failure of your front door. Cloud Load Balancing is software-defined and distributed. Its work is spread across a large fleet of machines inside Google’s network, so there is no single box that can run out of capacity or break and take your service with it.
Front Ends at the Edge
For global proxy-based load balancers, visitors connect to Google front end servers placed in many locations around the world, in more than eighty places according to Google’s overview. Because a single anycast address is announced from many places, a visitor’s traffic enters Google’s network at a point near them, and then travels across Google’s private backbone to the best healthy backend. This shortens the slowest and least reliable part of the journey: the public internet.
A courier company with collection points in every town. You hand your parcel to the nearest point, then it rides the company’s own fast motorway to the destination city. You skip most of the crowded public roads.
Autoscaling Without Pre-Warming
Because the service is distributed, it can absorb sudden growth in traffic without a warm-up phase that you have to request in advance. If a campaign suddenly sends a hundred times the usual visitors, the load balancer layer keeps up. For global setups, traffic can also be shifted to other regions when one fills up. Your backends still need to be able to scale, of course, and that is why managed instance groups and autoscalers are good partners.
flowchart TD
U1["Visitor in Asia"] --> E1["Google front end near Asia"]
U2["Visitor in Europe"] --> E2["Google front end near Europe"]
U3["Visitor in America"] --> E3["Google front end near America"]
E1 --> BB["Google private backbone"]
E2 --> BB
E3 --> BB
BB --> R1["Backends in region 1"]
BB --> R2["Backends in region 2"]
BB --> R3["Backends in region 3"]
Where Passthrough Differs
Passthrough load balancers work at the packet level and do not terminate connections. Backends receive packets that still carry the visitor’s address, and they send their replies directly to the visitor. Because there is no proxy in the return path, this design is very efficient and suits protocols and workloads that a web proxy cannot handle.
The load balancer layer is not a bottleneck you must size. The limiting factors in a design are almost always your backends, your quotas and your configuration, not the load balancer itself.
6Application Load Balancers in Depth
For websites and APIs, the Application Load Balancer is the most capable and most commonly used choice.
What Makes It Smart
Because it understands HTTP and HTTPS, an Application Load Balancer can look inside each request and make decisions based on the host name, the path, headers, query values or cookies. This lets one public address serve many different services.
Content-Based Routing
Host-Based Routing
Requests for one site name go to one set of backends, and requests for another site name go to a different set, all behind the same address.
Path-Based Routing
Requests for the image path go to an image service, requests for the checkout path go to a checkout service, and everything else goes to the main site.
Header and Cookie Routing
Requests carrying a special header, such as one set by a mobile app, can be sent to a dedicated backend, or a small percentage can be sent to a new version for testing.
Redirects and Rewrites
The load balancer can send visitors from an old address to a new one, force secure connections, or adjust the path before passing the request along.
Traffic Splitting
A chosen share of traffic can go to a new version of a service, enabling gradual rollouts and safe experiments.
flowchart TD
REQ["HTTPS request"] --> LB["Application Load Balancer"]
LB --> M{"Match host and path"}
M -->|"shop.example.com/images"| IMG["Image backends"]
M -->|"shop.example.com/checkout"| CHK["Checkout backends"]
M -->|"api.example.com"| API["API backends"]
M -->|"default"| WEB["Main site backends"]
A hospital reception desk. A person arrives and says what is wrong. Reception reads the situation and sends them to emergency, the children’s ward or the dental clinic, all through one front door.
Modern Web Features
Application Load Balancers support secure connections, modern web protocols, long-lived connections such as WebSockets, IPv6 addresses and weighted distribution of traffic. They can sit in front of virtual machines, containers on Google Kubernetes Engine, serverless services, storage buckets and even services running outside Google Cloud.
Global, Regional and Internal Variants
| Variant | Reach | Typical use |
|---|---|---|
| Global external Application | Internet visitors, backends in many regions | Public websites and APIs with a worldwide audience |
| Regional external Application | Internet visitors, backends in one region | Workloads that must stay in one region for legal or latency reasons |
| Regional internal Application | Clients inside your network, backends in one region | Private microservice traffic between application tiers |
| Cross-region internal Application | Clients inside your network, backends in several regions | Private services that need multi-region resilience |
| Classic Application | Older generation external mode | Existing deployments; check documentation before starting new ones |
Choosing a regional load balancer for a worldwide audience without realising it. A regional load balancer serves backends in one region, so visitors far away travel a long way. If your audience is global and there are no residency rules, look at the global mode.
7Network Load Balancers in Depth
When your traffic is not web traffic, or when you need raw speed and preserved addresses, the Network Load Balancer family is the answer.
Proxy Network Load Balancers
A proxy Network Load Balancer ends a TCP connection and opens a new one to the backend. Some modes can also handle TLS encryption on behalf of the backends, so the backend servers do not each have to manage certificates. These are a good fit for non-web TCP services that benefit from a global front door, such as certain messaging, gaming or database protocol gateways.
Passthrough Network Load Balancers
A passthrough load balancer hands packets straight to a backend, with the original source address intact. It supports TCP and UDP and a number of other protocols. Backends reply directly to the visitor, a pattern sometimes called direct server return.
Preserve the Source Address
When your backend needs the true visitor address for logging, rules or licensing.
Non-Web Protocols
When you need UDP, ESP, GRE, ICMP and similar traffic that a web proxy does not carry.
Avoid Proxy Overhead
When every microsecond counts and the backend can handle encryption itself.
Pass Encrypted Traffic Untouched
When security rules require that the encryption stays end to end between the visitor and the backend.
A switchboard operator who connects your phone call straight to the right extension, so the person at the extension hears your real number on the display. A proxy operator, in contrast, would answer you, then phone the extension and relay the conversation in the middle.
Internal Network Load Balancers
Internal Network Load Balancers serve clients inside your network. The internal passthrough type is always regional. It is commonly used for private services such as database proxies, DNS servers, caches or any internal TCP or UDP service that needs a stable internal address and automatic failover.
Practical Example: A Private Game Server Fleet
A studio runs game servers that speak a custom UDP protocol. A passthrough Network Load Balancer gives players a single address, keeps each player’s real address visible to the game server, and removes servers that fail their health checks.
Practical Example: An Internal Database Gateway
A company places an internal passthrough load balancer in front of two database proxy servers. Applications always connect to one internal address, and if one proxy fails, traffic moves to the other.
If a service is plain HTTP or HTTPS, an Application Load Balancer almost always gives you more features. Use a Network Load Balancer when you have a clear reason, such as a non-web protocol, a need to preserve the source address, or end-to-end encryption.
8Choosing the Right Load Balancer
Four questions, asked in order, lead you to the right type almost every time.
What kind of traffic is it?
HTTP or HTTPS points to an Application Load Balancer. Other TCP traffic points to a proxy Network Load Balancer. Traffic that needs UDP or other protocols, or a preserved source address, points to a passthrough Network Load Balancer.
Who are the clients?
Internet visitors need an external load balancer. Clients inside your network, or in networks connected to it, need an internal one.
Where are the backends?
Backends in several regions point to a global external or cross-region internal mode. Backends in one region, or rules that require traffic to be handled in a specific region, point to a regional mode.
Which network tier do you want?
Premium Tier carries traffic on Google’s backbone for lower delay. Standard Tier is cheaper and routes over the public internet. Some global modes require Premium Tier.
flowchart TD
S["Start: what traffic?"] --> Q1{"HTTP or HTTPS?"}
Q1 -->|"Yes"| APP["Application Load Balancer"]
Q1 -->|"No"| Q2{"Need UDP, other protocols or source IP kept?"}
Q2 -->|"Yes"| PT["Passthrough Network Load Balancer"]
Q2 -->|"No"| PX["Proxy Network Load Balancer"]
APP --> Q3{"Internet or internal clients?"}
PX --> Q3
PT --> Q3
Q3 --> Q4{"Backends in many regions?"}
Q4 -->|"Yes"| GL["Global or cross-region mode"]
Q4 -->|"No"| RG["Regional mode"]
Matching Needs to Types
| Your need | Natural choice |
|---|---|
| Worldwide public website with caching and security | Global external Application Load Balancer |
| Public website that must be handled in one region only | Regional external Application Load Balancer |
| Private microservice-to-microservice web traffic | Regional internal Application Load Balancer |
| Public non-web TCP service, global, with TLS handling | Global external proxy Network Load Balancer |
| Public UDP game or voice service | Regional external passthrough Network Load Balancer |
| Private TCP or UDP service inside the network | Internal passthrough Network Load Balancer |
Choosing transport for a trip. You ask: what am I carrying, who is travelling, how far is the journey, and what is my budget. Once you have answered, the choice between bicycle, car, train or plane becomes almost obvious.
Picking a load balancer by name familiarity instead of by these four questions. Moving later can mean changing addresses, certificates and routing, so a few minutes of careful choice saves days of rework.
9Backends: Instance Groups and Network Endpoint Groups
A load balancer is only as useful as the servers behind it. Google Cloud offers several kinds of backends.
Instance Groups
An instance group is a collection of virtual machines treated as a single unit. A managed instance group is created from a template and can automatically add machines when load rises, remove them when it falls, replace unhealthy machines and update them in a rolling way. An unmanaged instance group is simply a hand-picked set of machines that you maintain yourself.
Network Endpoint Groups
A network endpoint group, usually called a NEG, is a collection of endpoints. An endpoint is simply a destination, such as an address and port. Different kinds of NEGs let the load balancer reach very different things.
Zonal NEG
Endpoints such as virtual machine addresses or container addresses inside one zone. Commonly used with containers on Kubernetes.
Serverless NEG
Points to a serverless service such as a container or function platform, so you can place a full load balancer in front of it.
Internet NEG
Points to a destination outside Google Cloud, such as a service hosted elsewhere, allowing you to put Google’s edge in front of it.
Hybrid NEG
Points to endpoints in your own data centre or another cloud, reached over private connectivity, for gradual migrations.
Private Service Connect NEG
Points to a published service reached through a private connection, useful for consuming partner or internal services.
Backend Buckets
Cloud Storage buckets can act as backends for static content such as images and scripts in web load balancers.
A manager with different kinds of staff on the books. Some are permanent employees on a team (instance groups). Some are freelancers or agency workers (endpoint groups). Some are on a different site entirely (hybrid and internet endpoints). The manager can assign work to any of them using the same dispatch board.
Practical Example: Gradual Cloud Migration
A company keeps part of its application in its own data centre while moving the rest to Google Cloud. A hybrid NEG lets one load balancer send some requests to the old servers and some to the new ones, and the share moving to the cloud can be raised step by step.
Which backend types a given load balancer mode supports differs, so confirm compatibility in the current documentation before designing around an unusual backend.
10Health Checks: How the Load Balancer Knows
The load balancer cannot send traffic only to healthy servers unless it can tell which servers are healthy. Health checks are how it finds out.
What a Health Check Does
A health check is a small, regular test sent to each backend. For example, every few seconds the checker may request a particular web page or open a connection to a port. If the backend answers correctly and quickly enough, it is counted as healthy. If it fails several times in a row, it is counted as unhealthy and the load balancer stops sending it new traffic. When it later passes several checks, it is welcomed back.
A supervisor who taps each cashier on the shoulder every few seconds and asks “all well?” If a cashier does not answer after a few taps, the supervisor closes that till and sends customers elsewhere. When the cashier returns and answers properly, the till reopens.
Key Settings
| Setting | Meaning | Effect of choosing it too tight or too loose |
|---|---|---|
| Check interval | How often each backend is tested | Too frequent adds load, too rare delays failure detection |
| Timeout | How long to wait for an answer | Too short marks slow servers as dead, too long delays detection |
| Healthy threshold | Passes needed to count as healthy again | Too low lets flapping servers in and out |
| Unhealthy threshold | Failures needed to count as unhealthy | Too low causes false alarms, too high keeps sending traffic to broken servers |
| Protocol and path or port | What exactly is tested | A trivial check may pass while the application is broken |
Make the Check Meaningful
A health check that only tests whether a port is open can pass even when the application behind it is stuck. A better design is a small dedicated health page in your application that checks the things that matter, such as whether it can reach its database, and answers quickly. Keep it light: a heavy health page run every few seconds by many checkers can itself become a load.
Firewall Rules for Health Checks
Health check probes come from specific Google address ranges. Your network firewall must allow those ranges to reach your backends, otherwise every backend looks unhealthy and the load balancer sends no traffic at all. This is one of the most common reasons a new setup does not work.
Forgetting to allow health check traffic through the firewall. The symptom is a perfectly healthy server that the load balancer reports as unhealthy. Always check firewall rules first when all backends are marked down.
sequenceDiagram
participant H as Health checker
participant B1 as Backend 1
participant B2 as Backend 2
participant LB as Load balancer
H->>B1: Probe
B1-->>H: Healthy
H->>B2: Probe
B2--xH: No answer
H->>B2: Probe again
B2--xH: No answer
H->>LB: Mark Backend 2 unhealthy
LB->>B1: Send new requests only here
11How Traffic Is Distributed
Choosing a healthy backend is only half the job. The other half is choosing a fair and sensible one.
Balancing Modes
A backend service has a balancing mode that defines how full a backend may get before traffic moves elsewhere. Different modes measure fullness differently: by the share of capacity in use, by requests per second, or by number of connections. You set a target for each backend group, and the load balancer fills groups up to that target, preferring groups that are closer to the visitor when capacity allows.
Locality and Overflow
In global setups, the load balancer prefers to send visitors to the nearest region that has capacity. If that region is full or unhealthy, traffic overflows to the next nearest region. This gives the best speed in normal times and graceful failover in bad times.
flowchart TD
U["Visitor in Mumbai"] --> LB["Global load balancer"]
LB --> D{"Nearest region healthy and below target?"}
D -->|"Yes"| N["Send to nearest region"]
D -->|"No"| O["Overflow to next nearest region"]
O --> F["Serve from the next healthy region"]
Session Affinity
Sometimes a visitor’s later requests should go to the same backend as their earlier ones, for example when the server keeps a shopping cart in its own memory. This is called session affinity or stickiness. It can be based on the visitor’s address, a cookie or a header. It is useful but has a cost: it can make load uneven, and when the chosen backend disappears the visitor’s session is lost. A better long-term design stores session data in a shared place such as a cache or database so that any backend can serve any visitor.
Connection Draining
When a backend is being removed, for example during an update, a sudden cut would break requests in progress. Connection draining gives existing requests time to finish while sending no new requests to that backend. Setting a sensible drain period makes rolling updates smooth for users.
Timeouts and Retries
The load balancer waits a set time for backends to respond before giving up. Setting this correctly matters. Too short and slow but valid requests, such as large uploads, fail. Too long and failures hang visitors. Application Load Balancers can also retry a failed request on another backend in some conditions, which hides short-lived failures from users.
A supermarket manager directing shoppers to checkouts. Normally shoppers go to the nearest open till. If it is full, they are sent to the next. A returning shopper who prefers their favourite cashier is session affinity. When a till is closing, the cashier finishes the current customer, which is draining.
Aim for stateless backends. When no single server holds special information about a visitor, you can add, remove and replace servers at will, and you rarely need session affinity at all.
12Network Service Tiers: Premium and Standard
The route your traffic takes affects both speed and cost. Google offers two tiers to match.
The Two Tiers
Premium Tier
- Traffic rides Google’s own global backbone for most of the journey
- Lower and more consistent delay for distant visitors
- Default choice for many load balancers
- Required by some global load balancer modes
- Costs more than Standard Tier
Standard Tier
- Traffic travels over the public internet for most of the journey
- Lower price
- Suits workloads without strict latency needs
- Some features and modes are not available
- Classic load balancers behave as regional in this tier
Tier is chosen per resource, so you can mix tiers inside one project. Internal load balancers always use Premium Tier because their traffic stays on Google’s network. Global external Application and Network load balancers that rely on the global front ends require Premium Tier.
Shipping a parcel by a private express motorway versus ordinary public roads. The express route is quicker and more predictable but costs more. The public road is cheaper and fine for non-urgent parcels.
Choosing Standard Tier purely for cost on a latency-sensitive global service, then wondering why distant visitors have slow and inconsistent experience. Match the tier to what your users need.
13Security: TLS, Cloud Armor and Identity
Because the load balancer is the front door, it is the best place to put locks.
Encryption in Transit
Secure web traffic uses TLS, a protocol that scrambles data between the visitor and the server so eavesdroppers cannot read it. Proxy-based load balancers can end TLS at the front door, using certificates that you attach to the target proxy. Certificates can be Google-managed, where Google obtains and renews them for you, or self-managed, where you supply and renew them. SSL policies let you control which protocol versions and cipher suites are accepted, so old, weak options can be disabled.
Encrypting to the Backend Too
Ending TLS at the load balancer and sending plain traffic to backends is simple but leaves the last hop unencrypted inside the network. Many regulated organisations prefer to re-encrypt traffic from the load balancer to the backend. Alternatively, passthrough load balancers keep encryption end to end because they never open the traffic.
Cloud Armor
Cloud Armor is Google’s web application and network security service. Attached to supported load balancers, it can filter traffic by address, country, request pattern and known attack signatures, apply rate limits, and help absorb large floods of traffic known as distributed denial-of-service attacks. Because filtering happens at Google’s edge, harmful traffic is stopped before it reaches your servers.
Identity-Aware Proxy
Identity-Aware Proxy puts a sign-in check in front of an application. Instead of relying on network location, it asks who the user is and whether they are allowed. Google’s guidance mentions it as an option for authentication when client addresses are not visible because of a proxy. It suits internal tools that you want to expose safely to staff without a traditional VPN.
Network Firewall Rules
Allow only the traffic you intend: visitors to the load balancer, and the load balancer and health checkers to the backends.
TLS and SSL Policy
Use modern protocol versions, strong ciphers and managed certificates that renew automatically.
Cloud Armor Policies
Block known attacks, limit abusive request rates and restrict traffic by source where appropriate.
Identity Checks
Require sign-in for internal or sensitive applications through Identity-Aware Proxy or your own authentication.
Private Backends
Keep backends without public addresses so that the only way in is through the load balancer.
Logging and Audit
Record requests and administrative changes so you can investigate incidents and prove compliance.
A bank branch entrance. There is a guard checking who comes in, a metal detector looking for dangerous items, a queue marshal limiting how many enter at once, and an appointment desk checking identity for the vault. Each layer catches something the others might miss.
Leaving backends with public addresses and open firewall rules, so attackers can bypass the load balancer and its protections by connecting to the servers directly. Allow only the load balancer and health checkers to reach the backends.
14Performance: Caching and Cloud CDN
The fastest request is one that never reaches your servers at all.
What Cloud CDN Is
CDN stands for content delivery network. Cloud CDN stores copies of your content, such as images, scripts and videos, at Google’s edge locations close to visitors. When a visitor asks for something that is already stored nearby, it is served immediately from the edge, without a trip to your backend. This cuts delay for the visitor and reduces load and cost for you. Cloud CDN works with supported Application Load Balancer modes, such as the global external and classic ones.
A publisher who keeps boxes of popular books in shops in every city. Readers pick up a copy locally instead of waiting for delivery from the central warehouse. Only rare titles need the long trip.
Making Caching Work
Separate static from dynamic
Serve images, styles and scripts from paths or buckets that are cacheable, and keep personal pages separate.
Set cache lifetimes
Tell the cache how long a copy may be reused using standard cache headers, and give updated files new names so old copies do not linger.
Watch the hit ratio
The share of requests answered from cache shows whether caching is helping. A low ratio suggests that content is not cacheable or lifetimes are too short.
Plan for invalidation
Know how to remove a cached item quickly if wrong content is published.
Other Performance Habits
Modern Protocols
Supported load balancers can speak newer web protocols that reduce delay by reusing connections and sending several requests at once.
Compression
Sending compressed text content shrinks downloads, especially on mobile networks.
Backends Near Users
In multi-region designs, place backends in the regions where most visitors live.
Right-Sized Timeouts
Balance patience for slow operations against quick failure for broken ones.
Before adding more servers to cope with load, check how much of your traffic could be served from cache. Caching is usually the cheapest capacity you can add.
15Availability, Failover and Resilience
The point of a load balancer is to keep your application available when things go wrong.
What Can Fail
A Single Server
Handled by health checks and instance group repair. Traffic simply avoids the failed server.
A Whole Zone
Handled by spreading backends across several zones in a region, so the load balancer keeps using the surviving zones.
A Whole Region
Handled by global or cross-region load balancing with backends in more than one region, so traffic fails over elsewhere.
A Bad Release
Handled by gradual rollout, traffic splitting and quick rollback, not by the load balancer alone.
Resilience Needs Redundant Backends
A global load balancer can survive the loss of a region only if there are healthy backends elsewhere with enough capacity to take over. A regional load balancer is affected by an outage of its region. So resilience depends on both the load balancer type and how redundantly you place and size your backends.
flowchart LR
U["Visitors"] --> G["Global load balancer: one IP"]
G --> R1["Region 1: zones A, B, C"]
G --> R2["Region 2: zones A, B, C"]
R1 -.->|"Region 1 fails"| X["Traffic shifts to Region 2"]
R2 --> X
A chain of restaurants with branches in several cities and several kitchens in each branch. If one cook is ill, another covers. If a kitchen floods, the branch uses its other kitchens. If a whole city is closed by a storm, customers are sent to the next city, provided those branches have enough staff and food.
Having backends in two regions but sizing each only for half the traffic. When one region fails, the survivor is overwhelmed. Plan failover capacity, not just failover routes.
16Monitoring, Logging and Troubleshooting
A front door needs a camera. Good observability tells you what is happening before users do.
What to Watch
| Signal | Question it answers | Typical action |
|---|---|---|
| Request rate | How much traffic is arriving? | Spot spikes, attacks or drops |
| Response codes | Are users seeing errors? | Investigate rising server errors or client errors |
| Latency | How long do requests take? | Find slow backends or overloaded regions |
| Backend health | How many backends are healthy? | Fix failing servers or health check settings |
| Cache hit ratio | Is caching effective? | Adjust cache lifetimes and content structure |
| Security policy hits | What is being blocked? | Tune rules and investigate attacks |
| Capacity use | How full are backend groups? | Adjust autoscaling and balancing targets |
Logging
Load balancers can write logs of requests, showing details such as the requested address, the response code, how long it took, which backend served it and the visitor’s location. Logging every request on very busy services can be costly, so many teams sample a fraction of requests. Logs go into Cloud Logging where they can be searched, charted and exported for analysis.
Troubleshooting Checklist
Is the load balancer reachable?
Check that the forwarding rule, address and port are correct and that DNS points to the right address.
Are backends healthy?
Look at backend health. If all are unhealthy, check the health check settings and firewall rules for the health checker ranges.
Is routing matching?
Check the routing rules. A request that matches nothing falls to the default, which may not be what you expect.
Is a security policy blocking?
Review security policy logs for requests that were denied.
Is the certificate valid?
Check that managed certificates have finished provisioning and that the domain points to the load balancer.
Are timeouts too short?
Gateway-style errors on long operations often indicate timeouts that need adjusting.
Record a baseline of normal request rate, error rate and latency. Alerts built on a known baseline are quieter and far more useful than guessed thresholds.
17Cost and Pricing
Load balancing costs are usually modest next to compute, but they have a shape worth understanding.
What You Pay For
In general, you are charged for the number of forwarding rules you run, for the amount of data the load balancer processes, and for network traffic leaving Google Cloud, which depends on the network tier. Optional services such as Cloud CDN and Cloud Armor have their own charges. Exact prices vary by mode, region and tier and change over time, so always use the current pricing page for estimates.
Ways to Keep Cost Sensible
Share Load Balancers
One Application Load Balancer can serve many sites and services through host and path routing, rather than one load balancer per service.
Cache Aggressively
Content served from the edge cache reduces both backend load and egress from your servers.
Choose the Tier Deliberately
Use Standard Tier only where it matches your performance needs, and Premium Tier where speed matters.
Sample Logs on Busy Services
Log a fraction of requests on very high-volume services, and raise the sample rate temporarily when debugging.
Remove Unused Resources
Delete forwarding rules and reserved addresses that no longer serve traffic, as reserved but unused addresses can still be billed.
Keep Traffic Close
Where possible, keep clients and backends in the same region to avoid cross-region transfer charges.
Creating a separate load balancer for every small service by habit. Each has a cost, and many can be combined behind one smart Application Load Balancer using routing rules.
18Integration with Kubernetes, Serverless and Hybrid Environments
Modern applications rarely run only on plain virtual machines. Load balancers adapt to each environment.
Containers on Google Kubernetes Engine
Kubernetes is a system for running many containers across a cluster of machines. Google Kubernetes Engine can create and manage load balancers automatically from simple declarations about your services, sending traffic directly to container addresses through network endpoint groups. Sending traffic straight to containers avoids an extra hop and spreads load more evenly than sending it to nodes first.
Serverless Services
Serverless platforms run your code without you managing servers. A serverless NEG lets a full Application Load Balancer sit in front of such a service. This gives you your own domain, a global address, caching, security policies and routing, features that a serverless service on its own may not provide.
Hybrid and Multi-Cloud
With hybrid and internet NEGs, a load balancer can send traffic to endpoints in your own data centre, another cloud, or any reachable address. This is a powerful tool for gradual migration and for putting Google’s edge, caching and security in front of services that live elsewhere.
flowchart TD
LB["Application Load Balancer"] --> A["Instance group: virtual machines"]
LB --> B["Zonal NEG: containers on GKE"]
LB --> C["Serverless NEG: managed service"]
LB --> D["Hybrid NEG: on-premises servers"]
LB --> E["Internet NEG: external service"]
LB --> F["Backend bucket: static files"]
A shopping centre with a single main entrance and signs pointing to shops that may be in the building, in an annexe across the road, or in a rented stall at another site. Visitors use one entrance and one map no matter where each shop sits.
Use weighted traffic splitting across old and new backends to move users gradually from an old environment to a new one, with an instant way back if something goes wrong.
19Advantages, Disadvantages and Trade-offs
Every design has a price. Here is an honest balance sheet.
Advantages
- Fully managed and software-defined, nothing to patch or size
- A single anycast address can serve users worldwide in global modes
- Automatic failover across zones and regions
- Rich routing, security and caching features at the edge
- Works with virtual machines, containers, serverless and hybrid backends
- Scales with traffic spikes without pre-warming
Disadvantages / Trade-offs
- Many types and modes make choosing and learning harder
- Proxy types do not preserve client addresses by default
- Some features and tiers differ by mode, requiring careful reading
- Misconfigured health checks or firewalls can cause total outages
- Costs add up when many separate load balancers are created
- Resilience still depends on your own redundant backends
The Decision in One Sentence
Use Cloud Load Balancing whenever more than one backend serves an application, choose the type by traffic, audience, location and tier, and remember that availability is a team effort between the load balancer and your backends.
20Comparing Load Balancing with Related Services
Several services sit near load balancers and are often confused with them.
| Service | What it does | How it differs from a load balancer |
|---|---|---|
| Cloud Load Balancing | Distributes live traffic to healthy backends | The main traffic distribution service |
| Cloud DNS | Translates names to addresses | Points visitors at an address but does not watch backend health per request |
| Cloud CDN | Caches content at the edge | Works together with Application Load Balancers rather than replacing them |
| Cloud Armor | Filters and protects against attacks | A security layer attached to the load balancer |
| Managed instance groups with autoscaling | Add and remove virtual machines automatically | Changes how many backends exist, not how traffic is shared |
| Service mesh | Manages traffic between services inside a cluster or fleet | Focuses on service-to-service traffic with fine-grained policies |
| Cloud NAT | Lets private machines reach the internet | Handles outbound traffic, not inbound distribution |
Better Together
A typical resilient design combines several of these. DNS points the site name at the load balancer’s address. The load balancer terminates TLS and routes by path. Cloud CDN caches static content. Cloud Armor filters attacks. Managed instance groups behind the load balancer scale up and down with demand, and health checks remove failing servers.
A theme park. The signpost on the road is DNS. The ticket gate is the load balancer. The security guards are Cloud Armor. The stalls near the entrance, selling popular souvenirs without a trip to the main store, are the CDN. The park managers who open more rides when crowds grow are the autoscalers.
Features and limits change as Google updates its services. Before committing to a design, compare current capabilities, supported combinations and pricing in the official documentation.
21Design Patterns That Work
A pattern is a proven shape for a solution. These recur in healthy load-balanced systems.
Pattern: One Front Door, Many Services
Use a single Application Load Balancer with host and path routing to serve many services, reducing cost and giving one place to apply certificates and security.
Pattern: Multi-Zone Backends
Spread each backend group across several zones so the loss of a zone is a non-event.
Pattern: Multi-Region Active-Active
Run full backends in two or more regions behind a global load balancer so that traffic is served nearby and fails over automatically.
Pattern: Edge Caching for Static Content
Serve static assets from a backend bucket through Cloud CDN, and send only dynamic requests to compute backends.
Pattern: Layered Security at the Edge
Combine managed certificates, a strict SSL policy, Cloud Armor rules and private backends so attacks are stopped long before they reach servers.
Pattern: Canary Releases by Traffic Splitting
Send a small percentage of traffic to a new version, watch the error rate and latency, then increase gradually or roll back instantly.
Pattern: Internal Load Balancer Between Tiers
Place an internal load balancer between the web tier and the service tier so each tier scales and fails independently behind a stable private address.
Pattern: Stateless Backends with Shared State
Keep session and cart data in a shared cache or database so any backend can serve any request and affinity is unnecessary.
flowchart TD
DNS["DNS name"] --> GLB["Global external Application Load Balancer"]
GLB --> ARM["Cloud Armor policy"]
ARM --> CDN["Cloud CDN cache"]
CDN --> BKT["Backend bucket: static files"]
GLB --> W1["Web tier region 1"]
GLB --> W2["Web tier region 2"]
W1 --> ILB1["Internal load balancer"]
W2 --> ILB2["Internal load balancer"]
ILB1 --> S1["Service tier region 1"]
ILB2 --> S2["Service tier region 2"]
22Anti-Patterns to Avoid
An anti-pattern looks like a good idea but quietly causes trouble. These are the most common.
Problem
All backends in a single zone behind a load balancer.
Why It’s Harmful
The load balancer cannot protect you from the loss of a zone, so a single zone problem causes a full outage.
Correct Approach
Spread backends across at least two, preferably three, zones, and use regional managed instance groups.
Problem
Health checks that test only whether a port is open.
Why It’s Harmful
An application can be stuck or disconnected from its database while the port still answers, so traffic keeps flowing to a broken server.
Correct Approach
Use a light health endpoint that confirms the application’s key dependencies, with sensible intervals and thresholds.
Problem
Backends open to the internet with public addresses.
Why It’s Harmful
Attackers can bypass the load balancer, Cloud Armor and TLS policies by connecting directly to servers.
Correct Approach
Remove public addresses and allow only the load balancer and health checker ranges through the firewall.
Problem
Relying on session affinity instead of shared session storage.
Why It’s Harmful
Load becomes uneven, and when a backend dies or is replaced, users lose their sessions and carts.
Correct Approach
Make backends stateless and keep session data in a shared cache or database.
Problem
Multi-region backends that cannot absorb a failover.
Why It’s Harmful
When a region fails, the remaining region is overwhelmed and the outage spreads.
Correct Approach
Size each region to carry the needed share of the load alone, or ensure autoscaling and quotas can grow fast enough.
Problem
One load balancer per small service.
Why It’s Harmful
Costs multiply, certificates and policies are scattered, and operational work grows with each addition.
Correct Approach
Consolidate services behind one Application Load Balancer using host and path rules where they share an audience.
Problem
Using the wrong type, such as a proxy load balancer when the backend needs the real client address, or a regional one for a global audience.
Why It’s Harmful
Features are missing or behave unexpectedly, and changing the type later can mean new addresses, certificates and downtime.
Correct Approach
Work through the four questions of traffic, audience, location and tier before creating anything.
23Best Practices and Common Mistakes
A checklist of habits shared by teams that run load-balanced systems calmly.
Do This
- Choose the type by traffic, audience, location and tier
- Spread backends across zones and, where needed, regions
- Use meaningful, light health checks and allow their ranges
- Use Google-managed certificates and strong SSL policies
- Attach Cloud Armor and keep backends private
- Cache static content with Cloud CDN
- Use autoscaling and connection draining
- Monitor error rate, latency, health and capacity with alerts
Avoid This
- Putting all backends in one zone
- Leaving servers reachable directly from the internet
- Depending on session stickiness
- Forgetting firewall rules for health checks
- Setting timeouts without thinking about real workloads
- Creating one load balancer per tiny service
- Choosing a tier or type without checking requirements
Test Failure on Purpose
Do not wait for a real outage to learn how your system behaves. In a test environment, stop a server, block a zone, or fail a health check, and watch what the load balancer does. Confirm that alerts fire, that traffic shifts, and that users see little or no impact.
Keep Configuration as Code
Describe load balancers, health checks, policies and certificates in infrastructure-as-code files stored in version control. Reviews catch risky changes, and rebuilding an environment becomes repeatable instead of a memory exercise.
Plan Certificates and Domains Early
Managed certificates need the domain to point at the load balancer before they finish provisioning. Plan the order of changes when moving a domain so that visitors are not served errors during the switch.
Review Quotas
Projects have limits on resources such as forwarding rules, backend services and addresses. Check them before large rollouts, and request increases ahead of time.
Treating the load balancer as a set-and-forget item. Traffic patterns, features, threats and your own application change. Review configuration, certificates, security policies and capacity on a regular schedule.
24Real-World and Industry Scenarios
These are illustrative scenarios showing how organisations typically use load balancing, not claims about specific companies.
E-commerce During a Sale
A global Application Load Balancer fronts web and checkout services. Autoscaling backends grow with demand, Cloud CDN serves product images from the edge, and Cloud Armor rate-limits abusive bots during the sale.
Streaming and Media
Video segments are served from cache close to viewers, while personalisation and sign-in requests go to regional backends. A global address keeps the viewer experience consistent worldwide.
Banking and Financial Services
Regional load balancers keep traffic inside required regions, TLS policies enforce modern encryption, private backends and strict security policies reduce exposure, and audit logs support compliance.
Online Gaming
A passthrough Network Load Balancer carries UDP game traffic with players’ real addresses preserved, while a separate Application Load Balancer serves the web store and account APIs.
Software-as-a-Service Platforms
One Application Load Balancer routes by customer host name to different backend pools, and canary releases are rolled out through traffic splitting.
Internal Enterprise Applications
Internal load balancers sit between the layers of a private application, and Identity-Aware Proxy protects staff-facing tools without a traditional VPN.
Gradual Cloud Migration
A company places a load balancer in front of old on-premises servers and new cloud services through hybrid and regular backends, and shifts traffic by percentage over several weeks.
Healthcare Portals
Patient-facing portals use managed certificates, web attack filtering and multi-zone backends, while internal clinical systems stay behind internal load balancers reachable only from the hospital network.
25Frequently Asked Questions
No. Cloud Load Balancing is a managed, software-defined service. Google runs and scales it, so you configure it rather than operate it.
An Application Load Balancer works with HTTP and HTTPS and understands web content, so it can route by host, path and headers. Network Load Balancers work at the connection and packet level for TCP, UDP and other protocols.
A proxy load balancer ends the visitor’s connection and opens a new one to the backend. A passthrough load balancer forwards packets directly, preserves the source address, and lets backends reply directly to the visitor.
Yes, with global external modes that use an anycast address and Google’s edge locations. Visitors enter Google’s network near them, and traffic goes to the best healthy backend.
The most common cause is a firewall that blocks the health check ranges. Other causes are a wrong port or path in the health check, or an application that is slow to answer.
With passthrough load balancers, yes. With proxy load balancers, the backend normally sees the proxy’s address, and the original address is usually passed along in a header for web traffic.
Premium Tier carries traffic on Google’s global backbone for lower delay and is required by some global modes. Standard Tier uses the public internet for much of the journey and costs less.
Attach Cloud Armor to supported load balancers, use strong SSL policies and managed certificates, keep backends private, and allow only the load balancer and health checkers through your firewall.
Yes, through hybrid and internet network endpoint groups for supported load balancer modes. This helps with migration and with putting Google’s edge in front of external services.
Yes. The load balancer scales on its own, but your backends do not. Managed instance groups with autoscaling add and remove servers as demand changes.
No. DNS can return different addresses, but it does not track backend health per request and answers can be cached for a while. A load balancer makes decisions on each connection or request.
Only when you must. It can unbalance load and loses sessions when a backend disappears. Prefer stateless backends with shared session storage.
Combine services behind a shared Application Load Balancer, cache content with Cloud CDN, choose the right network tier, sample logs on very busy services, and remove unused rules and addresses.
Choosing a type without answering the four questions, and forgetting the firewall rules for health checks. Spend a few minutes planning type, tier, backends and security before creating resources.
26Summary and Key Takeaways
Cloud Load Balancing is Google Cloud’s managed way of sharing traffic across backends so that applications stay available, fast and ready to grow. It is a family, not a single product: Application Load Balancers for web traffic with smart routing, proxy Network Load Balancers for TCP with optional TLS handling, and passthrough Network Load Balancers for raw packets and preserved client addresses. Each comes in external or internal and global or regional modes, and the right choice follows from four questions about traffic, audience, location and network tier.
Around the load balancer sit the partners that make a design complete: health checks that keep traffic away from failed servers, managed instance groups and endpoint groups as backends, Cloud CDN for caching, Cloud Armor and TLS policies for protection, and monitoring for visibility. The best systems keep backends stateless and private, spread across zones and regions, test failure on purpose, and review their configuration regularly.
Key Takeaways
- A managed family, not one product — Application, proxy Network and passthrough Network load balancers each come in external or internal and global or regional modes.
- Choose with four questions — traffic type, who the clients are, where the backends are, and which network tier fits your latency and cost needs.
- Proxy or passthrough matters — proxies terminate connections and enable smart routing and TLS handling, while passthrough preserves source addresses and supports non-web protocols.
- Health checks are the safety net — keep them meaningful and light, and allow the health check ranges through your firewall.
- Security belongs at the front door — use managed certificates, strong SSL policies, Cloud Armor, identity checks and private backends.
- Performance and cost come from caching and consolidation — use Cloud CDN, share Application Load Balancers across services, and pick the tier deliberately.
- Resilience is shared — spread backends across zones and regions, size for failover, keep them stateless, and rehearse failure before it happens.