liveBook · Manning

Load balancing

As explained in Building Distributed Applications that Work

The distribution of incoming traffic across multiple service instances or resources.

A load balancer distributes requests across service replicas. They share a front-facing address, while each instance listens on its own internal HTTP port. section 9.1.1

builder.AddProject<Projects.OnlineShop_Web>("webfrontend")
   .WithExternalHttpEndpoints()
   .WithReference(cache)
   .WithReference(apiService)
   .WithReplicas(3)...

Configure three webfrontend replicas in the Aspire host with WithReplicas(3). section 9.1.1

How Building Distributed Applications that Work covers it

How deep it goes
Explains replica configuration and shared versus internal addresses, but does not detail the routing algorithm.
Examples
Demonstrates three webfrontend replicas sharing a front-facing address while listening on distinct internal ports.
What you can do after
Operate/configure Aspire service replicas by setting their count with WithReplicas in AppHost.cs.
How it connects
Connects load balancing to service replicas, HTTP endpoints, and Aspire host configuration.

Also explained in

Compare how 14 books explain load balancing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.