Skip to content

Cloudflare Load Balancing — Pools, Monitors & Steering Policies Explained

DodaTech Updated 2026-06-23 5 min read

In this tutorial, you'll learn about Cloudflare Load Balancing. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

Cloudflare Load Balancing distributes incoming traffic across multiple origin servers using configurable pools, health monitors, and steering policies to maximize uptime and performance. In this tutorial you will learn how to set up a load balancer, configure origin pools, attach health monitors, and choose the right steering policy for your architecture.

Why Load Balancing Matters

A single server is a single point of failure. If it goes down, your entire application goes offline. Load Balancing solves this by spreading traffic across multiple servers so that if one fails, others take over. Cloudflare load balancers operate at the edge, meaning traffic is routed before it ever reaches your origin, reducing latency and shielding your infrastructure from spikes.

Real-world use: DodaZIP serves file compression tools to users worldwide. With Cloudflare Load Balancing across three data centers in US, EU, and Asia, the service maintains 99.99% uptime even when one region experiences an outage.

How Cloudflare Load Balancing Works

flowchart TD
  U[User request] --> E[Cloudflare edge]
  E --> LB[Load Balancer]
  LB --> P1[Pool US - Healthy]
  LB --> P2[Pool EU - Healthy]
  LB --> P3[Pool Asia - Degraded]
  P1 --> O1[Origin 1 US]
  P1 --> O2[Origin 2 US]
  P2 --> O3[Origin 1 EU]
  P2 --> O4[Origin 2 EU]
  P3 --> O5[Origin 1 Asia]
  LB --> F[Failover to healthy pool]
  style LB fill:#f90,color:#fff
  style P3 fill:#c00,color:#fff
  style F fill:#090,color:#fff

Components of a Cloudflare Load Balancer

A load balancer has three core components: origins, pools, and monitors.

Component Purpose
Origin A server IP or hostname that serves traffic
Pool A group of origins in the same region or data center
Monitor A health check that polls origins at a configurable interval
Steering The algorithm that decides which pool receives each request

Setting Up Your First Load Balancer

Create a load balancer through the Cloudflare dashboard under Traffic > Load Balancing.

# Example DNS record for the load balancer
# Type: CNAME, Name: app, Target: your-load-balancer.cloudflare.net
# Proxied: Yes (orange cloud)
# Create a pool via Cloudflare API
curl -X POST https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/pools \
  -H "Authorization: Bearer {api_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "us-east-pool",
    "origins": [
      {"name": "web-1", "address": "198.51.100.10", "enabled": true},
      {"name": "web-2", "address": "198.51.100.11", "enabled": true}
    ],
    "description": "US East Coast origin pool"
  }'

# Response includes pool ID for referencing in load balancer config
# Attach a health monitor to the pool
curl -X POST https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/monitors \
  -H "Authorization: Bearer {api_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "http",
    "description": "HTTP health check",
    "method": "GET",
    "path": "/health",
    "interval": 60,
    "retries": 2,
    "timeout": 5,
    "expected_codes": "200"
  }'

# The monitor polls /health every 60 seconds and expects a 200 response

Steering Policies

Cloudflare supports several steering policies that determine how traffic is routed.

Policy Behavior
Standard (default) Traffic goes to the pool with the lowest latency
Geo Traffic routes based on Visitor country
Proximity Traffic routes based on physical distance
Random Traffic is distributed randomly across pools
Dynamic Uses real-time latency and pool health data
# Configure steering policy via API
curl -X PUT https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/{lb_id} \
  -H "Authorization: Bearer {api_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "steering_policy": "geo",
    "description": "Geo-steered load balancer"
  }'

Health Monitors in Detail

A health monitor checks whether an origin is alive. Monitors can be HTTP, HTTPS, TCP, or UDP based.

# Monitor configuration best practices
# Use a dedicated /health endpoint that returns 200 only when the app is ready
# Set interval to 30-60 seconds for balance between freshness and cost
# Configure 2-3 retries before marking origin as unhealthy
# Timeout should be 5-10 seconds depending on your app response time
# Check monitor status via API
curl -s https://api.cloudflare.com/client/v4/accounts/{account_id}/load_balancers/monitors/{monitor_id} \
  -H "Authorization: Bearer {api_token}" | jq '.result.status'

# Response shows "healthy" or "unhealthy" for each monitored origin

FAQ

What is the difference between a pool and an origin?

An origin is a single server IP or hostname. A pool is a group of origins, typically in the same geographic region, that share traffic among themselves.

{{< faq "How does Cloudflare detect an unhealthy origin?">}} Cloudflare sends health check requests to the monitor path at the configured interval. If the origin fails to respond or returns an unexpected status code after the configured number of retries, it is marked unhealthy and traffic is redirected to other origins. {{< /faq >}}

{{< faq "Can I use Cloudflare Load Balancing without purchasing dedicated servers?">}} Yes. You can load balance across any servers you control, including cloud VMs, dedicated servers, or even Serverless functions. You only need valid origin addresses that Cloudflare can reach.{{< /faq >}}

Practice Questions

  1. What are the three core components of a Cloudflare load balancer?
  2. How does a geo steering policy differ from a proximity steering policy?
  3. What happens to traffic when all origins in a pool are marked unhealthy?

Summary

Cloudflare Load Balancing distributes traffic across origin servers using pools, health monitors, and steering policies. Pools group origins by region, monitors check origin health at configurable intervals, and steering policies decide how traffic flows. Together they provide automatic failover, reduced latency, and high availability for any application behind Cloudflare.

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro — security-first tools for the modern web.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro