Traffic Director load balancing
Traffic Director uses sidecar proxies or proxyless gRPC to deliver global load balancing for your internal microservices. You can deploy internal microservices (sidecar proxy-based or proxyless gRPC-based) with instances in multiple regions. Traffic Director provides health, routing, and backend information to the sidecar proxies or proxyless gRPC, enabling them to perform optimal traffic routing to application instances in multiple cloud regions for a service.
In the following diagram, user traffic enters a Google Cloud
deployment through an external global load balancer. The external load balancer
distributes traffic to the Google Front End (GFE) microservice in either
asia-southeast1, depending on the location of the end user.
The internal deployment features three global microservices: GFE, Shopping
Cart, and Payments. Each service runs on managed instance groups (MIGs) in two
asia-southeast1. Traffic Director uses a global
load-balancing algorithm that directs traffic from the user in California to the
microservices deployed in
us-central1. Requests from the user in
Singapore are directed to the microservices in
An incoming user request is routed to the GFE microservice. The service proxy installed on the host with the GFE then directs traffic to the Shopping Cart. The sidecar proxy installed on the host with the Shopping Cart directs traffic to the Payments microservice. In a proxyless gRPC environment, your gRPC application would handle traffic management.
In the following example, if Traffic Director receives health check results
that indicate that the virtual machine (VM) instances running the Shopping Cart
us-central1 are unhealthy, Traffic Director instructs the
sidecar proxy for the GFE microservices to fail over traffic to the Shopping
Cart microservice running in
asia-southeast1. Because autoscaling is
integrated with traffic management in Google Cloud, Traffic Director
notifies the MIG in
asia-southeast1 of the additional traffic, and the MIG
increases in size.
Traffic Director detects that all backends of the Payments microservice are
healthy, so Traffic Director instructs Envoy's proxy for the Shopping Cart to
send a portion of the traffic—up to the customer's configured
asia-southeast1 and overflow the rest to
Load-balancing components in Traffic Director
During Traffic Director setup, you configure several load-balancing components:
- A global forwarding rule, which includes the VIP address, the target proxy, and the URL map. These resources are part of Traffic Director's traffic routing mechanism. The target proxy must be a target HTTP proxy.
- The backend service, which contains configuration values.
- A health check, which provides health checking for the VMs and Google Kubernetes Engine (GKE) Pods in your deployment.
The following diagram shows an application running on Compute Engine VMs or GKE Pods, the components, and the traffic flow in a Traffic Director deployment. It shows Traffic Director and the Cloud Load Balancing resources that it uses to determine traffic routing. An xDS API-compatible sidecar proxy (such as Envoy, as shown) runs on a client VM instance or in a Kubernetes Pod. Traffic Director serves as the control plane and uses xDS APIs to communicate directly with each proxy. In the data plane, the application sends traffic to the VIP address configured in the Google Cloud forwarding rule. The sidecar proxy or your gRPC application intercepts the traffic and redirects it to the appropriate backend.
- To learn more about service discovery and traffic interception, see Traffic Director service discovery.
- To learn more about Traffic Director, see the Traffic Director overview.