Automatic load balancing

This guide describes how to automatically load balance between two or more origin servers. Load balancing distributes requests across multiple servers to optimize resource use and avoid overloading any single resource.

Before you begin

Before you configure load balancing, keep in mind the following:

  • To prevent errors when shielding is enabled, all backends in the automatic load balancing group must use the same shielding location.
  • Conditions on your origin server can directly change how automatic load balancing behaves. Be sure to review conditions behavior to ensure automatic load balancing works properly.
  • Many customers configure failover at the same time they configure load balancing functionality. Our guide on configuring failover can show you how.

Enabling load balancing

To enable load balancing across two or more origin servers, follow the steps below:

  1. Log in to the Fastly web interface.
  2. From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
  3. Click the Edit configuration button and then select the option to clone the active version. The Domains page appears.
  4. Click the Origins link. The Origins page appears.
  5. Click the name of the Host you want to edit. The Edit this Host page appears.
  6. From the Auto load balance menu, select Yes.
  7. In the Weight field, enter the percentage of the total traffic to send to the origin server.

  8. Click the Update button.
  9. Repeat steps 5, 6, 7, and 8 for each origin server you want to include in the automatic load balancing group.

  10. Click the Activate button to deploy your configuration changes.

Using conditions with load balancing

You can set conditions on origin servers to change how load balancing works. The load balancing autodirector groups servers together based on like conditions, giving you the flexibility to effectively create subsets of the autodirector by assigning a condition to one group of origins and another condition to another set of origins. If each group of origin servers has a different condition that affects load balancing, the auto load function will not randomly load balance between the different servers.

What's next

For more advanced load balancing scenarios, refer to our developer documentation.

Back to Top