Directing Traffic with Weighted Pools

Cloudflare's network spans more than 270 cities, and even a single-origin service can lean on that scale to absorb more requests through caching. But services that need redundancy or serve a high volume of dynamic content typically require multiple origin servers. The Cloudflare Load Balancer spreads requests across those servers and keeps services available. A frequently requested capability has now landed: Weighted Pools.

Before diving in, a quick glossary:

  • Origin Servers — Servers behind Cloudflare, hosted in a customer datacenter or at a public cloud provider.
  • Origin Pool — A logical group of origin servers, usually representing a physical location or provider such as "us-east" or "phoenix-bldg2."
  • Traffic Steering Policy — A rule defining how a load balancer distributes requests across pools. Policies can route by geographic distance, measured latency, or Cloudflare data center location.
  • Pool Weight — A numeric value indicating the share of requests a pool should receive relative to other pools.

Cloudflare's load balancer supports Standard, Geo, Dynamic, and Proximity Steering. Weighted Pools extend the standard random steering policy by letting you define what percentage of requests go to each pool. For example, two pools each with a weight of 0.5 split traffic evenly at 50% each.

When weights matter

Balancing unequally sized pools

Consider a sales promotion that drives up dynamic, uncacheable traffic. If the Las Vegas datacenter pool is overloaded, an administrator can spin up more servers in the public cloud pool. Those pools are no longer equal in capacity, so the admin can set the cloud pool's weight to 0.8 and the Las Vegas pool to 0.2, fine-tuning the distribution to match available resources.

A kill switch for a datacenter

Setting a pool's weight to 0 effectively removes it from rotation. That is useful during troubleshooting or planned maintenance, such as when power may be cut. Even at weight 0, Cloudflare continues health-checking the pool so administrators can see when it's safe to bring traffic back.

Network-level A/B testing

Weights can also be used to carefully test new infrastructure. After standing up a new datacenter or upgrading all servers to a new software build, an administrator can route just 5% of requests to that pool to validate behavior before ramping up the load.

Configuration options

Weighted pools are managed like any other load balancer setup. In the dashboard, navigate to Traffic > Load Balancing, create a load balancer, and under the Origin Pools setup page select Random as the traffic steering policy. Then assign weights to each pool.

Weights do not need to sum to 1.00. Cloudflare normalizes the values behind the scenes and distributes traffic proportionally.

Configuration is also available through the REST API. Two relevant fields:

  • The load balancer's steering_policy should be set to random.
  • Each pool is identified by a UUID and assigned a pool_weight value.

Weighted Pools are available immediately to all customers with load balancers. Developer documentation is at developers.cloudflare.com, and API reference is at api.cloudflare.com.