Skip to main content

Load balancers

A load balancer receives traffic on one address and spreads it across several servers. When a server stops answering its health checks, the load balancer stops sending it traffic. Use one to run a service on several servers, and to replace or update servers without downtime.

A load balancer is built from three parts:

PartRole
ListenerAccepts traffic on one port and protocol, such as HTTP on port 80
PoolThe servers, or members, that receive the listener's traffic, and the algorithm that picks one
Health monitorProbes each member and takes failing members out of rotation

Open Networking in the project's sidebar and choose the Load Balancers tab. Each load balancer shows its address and its provisioning and operating status.

The project's load balancersThe project's load balancers

Create a load balancer​

The servers to balance must be running on a network in the same location.

  1. Choose Create load balancer and choose the Location.
  2. Enter a Name and an optional Description.
  3. Choose the Type. Your provider's types differ in capacity and price, and some run in high availability.
  4. Choose the Network the load balancer takes its address on. Choose the servers' private network and assign a floating IP to reach it from the internet.
  5. Configure the first listener:
    • Protocol and Load Balancer port: what clients connect to, such as HTTP on port 80.
    • Member protocol and Member port: what the servers listen on. The PROXY and PROXYV2 member protocols pass the client's address to servers that support the PROXY protocol.
  6. Configure its pool: a name, the Algorithm, and the Pool members. The list shows the servers on the chosen network. Tick the ones that receive traffic.
  7. Leave Monitoring on and configure the health monitor: its Protocol, how often it probes (Delay), how long it waits (Timeout), and how many probes change a member's state (Max Retries and Max Retries Down).
  8. Choose Add Listener to accept traffic on another port, for example HTTPS on 443.
  9. Choose Create Load Balancer.
The load balancer creation form with listener, pool and health monitorThe load balancer creation form with listener, pool and health monitor

The form shows the load balancer's monthly price. Creating it takes a few minutes. It is ready when it shows Active and Online. Its Overview lists its fixed IP on the network and the floating IP assigned to it.

A load balancer's overview with its addresses, flavor, listeners and poolsA load balancer's overview with its addresses, flavor, listeners and pools
AlgorithmPicks
Round RobinEach member in turn
Least ConnectionsThe member with the fewest open connections
Source IpThe same member for the same client address

Manage listeners​

Open the load balancer and choose Listeners. Add, edit or delete listeners there.

  • Accept traffic turns a listener off without deleting it.
  • Connection Limit caps concurrent connections. -1 leaves them unlimited.
  • Deleting a listener stops traffic on its port. Its pool and members remain.
A load balancer's listenersA load balancer's listeners

Terminate TLS on the load balancer​

A listener with the protocol HTTPS – terminate TLS decrypts HTTPS on the load balancer and forwards plain HTTP to the members. The servers then need no certificate. HTTPS – TLS passthrough forwards the encrypted traffic unchanged, and each server presents its own certificate.

To terminate TLS, choose the TLS certificate: Upload certificate with the certificate and its private key in PEM format, or Use existing certificate to reuse one stored in the project's Key Manager. Additional certificates (SNI) hold certificates for other host names the listener answers for. Terminating TLS needs the Key Manager service in the load balancer's region.

Manage pools and members​

Open Pools to see each pool's members, or targets, and their health.

  • Add Member to Pool adds a server, with the Protocol Port it serves on.
  • Weight sets how much traffic a member takes relative to the others. 0 stops new connections.
  • In rotation turned off drains a member without removing it, for example during maintenance.
  • Session persistence keeps a client on the same member: by Source IP, by a Cookie set by the load balancer, or by a Cookie set by the application.

Removing a member stops its traffic. The server itself is not changed.

A pool with its members and their healthA pool with its members and their health

Check member health​

Monitor shows the pool's health monitor. An HTTP or HTTPS monitor requests a Url Path with an HTTP Method, and counts the member healthy when the answer has one of the Expected Codes, such as 200 or 200-204. A TCP monitor checks that the port accepts connections, and PING that the member answers.

A pool's health monitorA pool's health monitor

Deleting the monitor stops the checks, and a member that stops answering keeps receiving traffic.

Delete a load balancer​

Open the load balancer, choose Delete and confirm. Its listeners, pools and monitors are deleted with it. The member servers keep running. Release its floating IP if you no longer need the address.