Cloudflare Docs
Load-Balancing
Visit Load Balancing on GitHub
Set theme to dark (⇧+D)

Pool steering

When you create a load balancer , their are several options for Traffic Steering, which decide how your load balancer routes traffic to attached and available pools.


Off - standard failover

Standard failover directs traffic from unhealthy pools — determined by health checks and the Health Threshold — to the next healthy pool in the configuration. Customers commonly use this option to set up active - passive failover .

Standard failover uses the pool order to determine failover priority (the failover order).

If all pools are marked unhealthy, Load Balancing will direct traffic to the fallback pool. The default fallback pool is the last pool listed in the Load Balancing configuration.

If no monitors are attached to the load balancer, it will direct traffic to the primary pool exclusively.


Dynamic steering

Dynamic Steering uses health check data to identify the fastest pool for a given Cloudflare Region or data center.

Dynamic Steering creates Round Trip Time (RTT) profiles based on an exponential weighted moving average (EWMA) of RTT to determine the fastest pool. If there is no current RTT data for your pool in a region or colocation center, Cloudflare directs traffic to the pools in failover order.

When enabling Dynamic Steering the first time for a server pool, allow 10 minutes for the change to take effect while Cloudflare builds an RTT profile for that pool.

For TCP health checks, calculated latency may not reflect the true latency to the origin if you are terminating TCP at a cloud provider edge location.

The diagram below shows how Cloudflare would route traffic to the pool with the lowest EWMA among three regions: Eastern North America, Europe, and Australia. In this case, the ENAM pool is selected because it has the lowest RTT.

Dynamic steering routes traffic to the fastest available pool


Geo steering

Geo Steering directs traffic to pools to a specific geographical region or — for Enterprise customers only — data center. This option is extremely useful when you want site visitors to access the origin server closest to them, which improves page-loading performance.

You can assign multiple pools to the same region and the load balancer will use them in failover order. If there is no configuration for a region or pool, the load balancer will use the default failover order.

Cloudflare has 13 geographic regions that span the world. The region of a client is determined by the region of the Cloudflare data center that answers the client’s DNS query.

Region codeRegion name
EEUEastern Europe
ENAMEastern North America
MEMiddle East
NAFNorthern Africa
NEASNortheast Asia
NSAMNorthern South America
OCOceania
SAFSouthern Africa
SASSouthern Asia
SEASSoutheast Asia
SSAMSouthern South America
WEUWestern Europe
WNAMWestern North America

For more details on working with regions and region codes, refer to Region Mapping API .

Via the API

Use the regions_pool property of the Update Load Balancers command to specify an array of regions. Specify each region using the appropriate region code followed by a list of origin servers to use for that region. In the example below, WNAM and ENAM represent the West and East Coasts of North America, respectively.

Request
// PUT /zones/:zone_id/load_balancers
{
"description": "Load Balancer for www.example.com",
"name": "www.example.com",
"ttl": 30,
"proxied": true,
"fallback_pool": "ff02c959d17f7bb2b1184a202e3c0af7",
"default_pools": ["17b5962d775c646f3f9725cbc7a53df4", "ff02c959d17f7bb2b1184a202e3c0af7"],
"region_pools": {
"WNAM": ["17b5962d775c646f3f9725cbc7a53df4", "ff02c959d17f7bb2b1184a202e3c0af7"],
"ENAM": ["17b5962d775c646f3f9725cbc7a53df4", "ff02c959d17f7bb2b1184a202e3c0af7"],
"EU": ["ff02c959d17f7bb2b1184a202e3c0af7", "17b5962d775c646f3f9725cbc7a53df4"]
}
}

If you only define WNAM, then traffic from the East Coast will be routed to the default_pools. You can test this using a client in each of those locations.

Proximity steering

Choose Proximity Steering to route visitors or internal services to the closest physical data center.

To use proximity steering on a load balancer, you first need to add GPS coordinates to each origin pool.

When to add proximity steering

How to add proximity steering

To add coordinates when creating or editing a pool:

  1. Click the Configure co-ordinates for Proximity Steering dropdown.
  2. Enter the latitude and longitude or drag a marker on the map.
  3. Select Save.

Random steering

Choose Random to route traffic to a healthy pool at random. Customers can use this option to set up active - active failover (or round robin), where traffic is split equally between multiple pools.