Traffic Director in Google Cloud
A friendly, complete guide to Google's managed control plane for service meshes: how it tells your services where to send requests, how it enables safe releases, retries and security, and how to run it with confidence.
Modern applications are rarely one big program. They are often dozens or hundreds of small programs, called services, that talk to each other all day. One service shows the product page, another checks the stock, another calculates the price, another handles payments. Every time one service needs another, a request must travel across the network, find a healthy copy of the target, and come back with an answer.
When there are only three services, a developer can manage this by hand. When there are three hundred, it becomes a full-time puzzle. Which copy of the service should get this request? What if it is slow? What if a new version should only get five percent of the traffic? Traffic Director is Google Cloud’s managed system for answering those questions in one central place. This guide explains it from zero. Every new word is explained when it first appears, so you can follow along even if you have never built a service mesh.
WWhat Is Traffic Director?
Start with the big picture: what it is, what it is not, and where it fits.
A service is a small program that does one job and is reached over the network. A microservices application is built from many such services. Traffic between services inside your application is often called east-west traffic, because on a diagram it flows sideways between boxes. Traffic coming in from users on the internet is called north-south traffic, because it flows down from the outside.
A service mesh is a layer that manages east-west traffic. It gives every service the same helpful abilities, such as finding other services, spreading load evenly, retrying failed calls, encrypting conversations and recording what happened, without each development team having to write that code again and again.
A service mesh has two parts. The data plane is the set of small programs, called proxies, that actually carry the requests. A proxy is a middleman that receives a request and forwards it to the right place. The most common proxy is Envoy, a popular open-source proxy. The control plane is the brain that tells all those proxies how to behave.
Traffic Director is Google Cloud’s fully managed control plane for a service mesh. “Fully managed” means Google runs it, scales it, keeps it available and updates it. You describe the rules you want, and Traffic Director sends the right instructions to every proxy in your system. It uses open standard APIs known as xDS, which are the same discovery APIs that Envoy understands, so it works with Envoy and with gRPC applications that can speak xDS directly.
Think of a big city’s traffic control center. The roads and cars are the services and requests. At every junction there is a traffic officer (the proxy) who directs cars. The control center (Traffic Director) does not stand at any junction and never touches a single car. It simply watches the whole city and radios updated instructions to every officer: “Road 5 is closed, send cars to Road 7”, or “send one car in twenty down the new bridge as a test”.
An important note about names
Google’s product names change over time. Traffic Director has been presented together with other Google service mesh offerings under the broader name Cloud Service Mesh, and some features are configured through newer routing APIs. The ideas in this guide stay the same, but always check the current Google Cloud documentation for the latest names, supported features and recommended setup.
Traffic Director is a brain, not a muscle. It does not carry your traffic itself. Your proxies do that. This is why a problem in the control plane does not instantly stop traffic, as you will see later.
TThe Problem Traffic Director Solves
Every good tool begins with a pain. Here are the pains of running many services.
Pain 1: Finding the other service
Services come and go. Machines are replaced, containers restart and copies are added during busy hours. Their network addresses change all the time. A service that wants to call another must always know the current, healthy addresses. This job is called service discovery. Doing it by hand, or with a hard-coded list, breaks quickly.
Pain 2: Sharing the load fairly
If one service has ten copies, the caller must decide which one gets each request. A simple rotation is not always best. One copy may be slower, another may be overloaded. Smart load balancing needs live information.
Pain 3: Failures spread like dominoes
When one service becomes slow, callers keep waiting and pile up more requests. Soon they too become slow, and the problem spreads across the whole application. This is called a cascading failure. Good systems retry sensibly, give up quickly when needed, and stop sending traffic to sick copies.
Pain 4: Releases are scary
Releasing a new version of a service to everyone at once is a gamble. Teams want to send just a small share of traffic to the new version first, watch for problems, and then slowly increase the share. This is a canary release. Doing this needs careful traffic control.
Pain 5: Every team writes the same code
Without a mesh, each team writes its own retry logic, timeouts, encryption and logging inside every service, often in different programming languages and different styles. The result is inconsistent and hard to update. If a rule changes, hundreds of services must be rebuilt.
Pain 6: Mixed environments
Real companies often have services on virtual machines, in containers, in several regions, and even in other clouds or data centers. Treating them as one connected application is difficult without a common layer of control.
Imagine a company where every employee must memorize every colleague’s current desk number, decide alone who is free to help, and write their own safety rules. Chaos! A receptionist system that knows where everyone is, who is busy and what the safety rules are makes everyone’s life easier. Traffic Director plays the role of the knowledge behind that receptionist system.
CCore Concepts You Must Know
Eight building blocks explain almost everything you will see in the settings and documents.
Control Plane
The central system that holds all rules and pushes them to proxies. Traffic Director is this part, and Google runs it for you.
Data Plane
The proxies and clients that actually carry requests between services. They follow the instructions from the control plane.
Envoy Sidecar
An Envoy proxy that runs right beside each service instance, handling that instance’s incoming and outgoing network traffic.
Proxyless gRPC
A style where the gRPC library inside the application talks to Traffic Director itself, so no separate proxy is needed.
xDS APIs
A family of open discovery APIs through which a control plane sends listeners, routes, clusters and endpoints to proxies.
Backend Service
A named group of identical service copies, with settings for load balancing, health checks and resilience.
Network Endpoint Group (NEG)
A list of exact addresses and ports where a service is running. NEGs let Traffic Director track containers and virtual machines precisely.
Routing Rules
Instructions that match requests by host, path or header, and send them to the right backend, with options like weights, retries and timeouts.
Handy words
| Term | What it means | Everyday picture |
|---|---|---|
| gRPC | A fast way for services to call each other, built on HTTP/2 | A direct phone line between two departments |
| Health check | A regular test that asks a service copy “are you well?” | A nurse checking temperatures |
| Retry | Sending a failed request again | Calling someone back when the line drops |
| Timeout | The maximum time to wait for an answer | Hanging up if nobody answers |
| Circuit breaker | A limit that stops sending more requests to an overloaded service | The fuse in your house |
| mTLS | Mutual TLS, where both sides prove who they are and encrypt the conversation | Two people showing ID to each other before whispering |
| Canary release | Giving a new version a small share of traffic first | A taste test before serving the whole table |
| Observability | The ability to see what a system is doing through metrics, logs and traces | A car dashboard |
AArchitecture and Components
See how the brain, the proxies and your services fit together.
The big idea is the clean split between the control plane and the data plane. Traffic Director lives in the control plane and runs as a global service on Google’s side. Your proxies, which sit in the data plane, open a long-lived connection to Traffic Director and ask for their instructions. Your requests never pass through Traffic Director. They flow directly from one service’s proxy to another service’s proxy.
flowchart TB
Admin["Platform Engineer Defines Routing Rules"] --> TD["Traffic Director Managed Control Plane"]
Health["Health Checks and Endpoint Lists"] --> TD
TD -->|"xDS configuration"| P1["Envoy Sidecar Beside Service A"]
TD -->|"xDS configuration"| P2["Envoy Sidecar Beside Service B"]
TD -->|"xDS configuration"| G1["Proxyless gRPC Client in Service C"]
SA["Service A"] --> P1
P1 -->|"Direct request chosen by rules"| P2
P2 --> SB["Service B"]
G1 -->|"Direct request"| P2
Walking through the picture
A platform engineer, or an automated pipeline, writes the routing rules. Traffic Director also gathers live facts, such as which service copies exist and which ones passed health checks. It combines the rules and the facts into a complete configuration for each proxy and pushes it out. When Service A wants to call Service B, its sidecar already knows where all the healthy copies of B are and which rules apply, so it can choose and send the request immediately.
The main components
- Traffic Director control plane: the global, managed brain that stores configuration and serves it using xDS.
- Configuration resources: rules and settings you create, such as backend services, health checks, routes and policies.
- Endpoint sources: NEGs and instance groups that tell Traffic Director where service copies are running, including on virtual machines, in Google Kubernetes Engine containers and in hybrid locations.
- Data plane proxies: Envoy sidecars, Envoy running as gateways or middle proxies, and proxyless gRPC clients.
- Security services: certificate authority integration, so proxies can get identities for encrypted conversations.
- Telemetry destinations: Cloud Monitoring, Cloud Logging and Cloud Trace, where proxies report what they see.
Consider an airline’s operations center and its pilots. The center decides routes, weather diversions and gate changes, and radios them out. The pilots fly the planes themselves. Passengers never board the operations center. If the radio crackles for a minute, the planes keep flying on the last instructions they received.
Traffic Director is not the same as Google Cloud’s external load balancers. Those handle user traffic coming in from the internet. Traffic Director focuses on service-to-service traffic inside your application. The two often work together in one system.
HHow It Works Inside: The xDS Conversation
Understand the quiet, constant conversation between proxies and the control plane.
When an Envoy proxy starts, it reads a small startup file that tells it who it is and where to find Traffic Director. It then opens a long-running connection to Traffic Director and says, in effect, “Hello, I am this proxy, in this network, serving this service. What are my instructions?” Traffic Director replies with a complete setup, and then keeps the connection open to push changes as soon as they happen.
sequenceDiagram
participant E as Envoy Proxy
participant T as Traffic Director
participant S as Backend Endpoint
E->>T: Connect and send node identity
T-->>E: Send listeners and routes
T-->>E: Send clusters and settings
T-->>E: Send endpoint addresses
E->>S: Forward application request using received rules
T-->>E: Push updated endpoints after a change
The four kinds of information
The xDS family splits the configuration into pieces. You do not need to memorize the short names, but the ideas help a lot.
- Listeners: where the proxy should listen for traffic, for example “listen for requests meant for the payments service”.
- Routes: how to match a request, using host name, path or headers, and which destination group it should go to.
- Clusters: the destination groups, with settings such as load balancing method, timeouts, circuit breaking and encryption.
- Endpoints: the actual addresses of the healthy copies in each group, including which zone or region each one lives in.
Why pushing beats polling
Because the connection stays open and Traffic Director pushes changes, proxies learn about a new or failing service copy within moments. A system that asks for updates only every few minutes would keep sending requests to dead copies for a long time. The push model keeps the picture current.
What happens if the control plane is unreachable
Proxies keep working with the last good configuration they received. They continue to route requests, apply load balancing and enforce rules. What they cannot do during such a gap is learn about new changes. This is why the data plane keeps carrying traffic even when the control plane is briefly unavailable, but also why you should not rely on instant updates during an outage.
A delivery driver carries a printed map and a list of addresses. A dispatcher radios live changes: “road closed”, “new customer”. If the radio goes quiet, the driver keeps delivering using the printed map, though without any new information until the radio works again.
Test what happens in your own system when a proxy cannot reach the control plane, for example when you restart many proxies at once while the control plane is unreachable. New proxies need an initial configuration to work, so planning for startup is as important as planning for steady running.
DData Flow and Request Lifecycle
Follow one request from Service A to Service B, step by step.
Service A makes a call
The application code simply asks for “the pricing service” by name. It does not need to know any machine addresses.
The local proxy catches it
The sidecar next to Service A intercepts the outgoing request. In the proxyless style, the gRPC library plays this role.
Rules are matched
The proxy checks its routes. Does a header or path rule apply? Is a canary split in effect? It picks the destination group.
A healthy copy is chosen
Using the load balancing method and the live endpoint list, the proxy chooses a specific copy, usually preferring a nearby one.
The request is sent securely
If mutual TLS is on, the proxies prove their identities and encrypt the conversation. The request is delivered with the configured timeout.
Failures are handled
If the call fails in a retryable way, the proxy may try another copy. Repeated failures can eject a sick copy from the pool for a while.
Telemetry is recorded
Both proxies note timing, status and size, and can send metrics, logs and trace data to the monitoring tools.
The slow lane: configuration lifecycle
Next to the fast lane of requests, there is a slow lane of configuration. You change a rule. Traffic Director validates it and prepares updated configuration for the affected proxies. The proxies receive the update over their open connections and apply it to new requests, usually without restarting. A configuration change therefore takes effect within a short time across the whole mesh, though not at the exact same instant on every proxy.
Because proxies update at slightly different moments, a rollout of routing changes can briefly show mixed behavior. Design your rules so that both the old and new state are safe for a short overlap.
TThe Configuration Model: Resources and Rules
How you describe what you want to Traffic Director.
Traffic Director is configured with resources, which are named objects that you create through the console, command line, automation tools or the APIs. There are two styles you will meet in documentation. One is built on Google Cloud’s load balancing resources, and the other uses newer service routing resources modeled on ideas from the Kubernetes Gateway world. Both aim to answer the same questions, so learning the concepts first makes either style easier.
flowchart LR
FR["Forwarding Rule - Internal Self Managed"] --> TP["Target Proxy"]
TP --> UM["URL Map - Routing Rules"]
UM --> BS1["Backend Service Version 1"]
UM --> BS2["Backend Service Version 2"]
BS1 --> NEG1["Network Endpoint Group One"]
BS2 --> NEG2["Network Endpoint Group Two"]
BS1 --> HC["Health Check"]
BS2 --> HC
The load-balancing style, explained
| Resource | Job | Simple picture |
|---|---|---|
| Forwarding rule | Defines the virtual address and port that clients call. For a mesh it uses an internal, self-managed scheme, meaning your own proxies do the forwarding | A phone number listed in a directory |
| Target proxy | Connects the address to a set of routing rules, for HTTP or gRPC | The switchboard operator |
| URL map | Holds the matching rules: host, path, header, and what to do for each | The company’s department directory |
| Backend service | A group of service copies with load balancing and resilience settings | A department team |
| Health check | The test that decides whether a copy is healthy | A nurse’s rounds |
| NEG or instance group | The list of actual copies and their addresses | The staff roster |
The service-routing style, explained
The newer style uses simpler building blocks. A Mesh resource represents the mesh itself. Route resources, such as HTTP routes and gRPC routes, describe how requests are matched and where they go. A Gateway resource represents an entry or exit point managed by proxies. Services are attached to the mesh by binding them to routes. If you already know Kubernetes Gateway API ideas, this will feel familiar. Which style is recommended for your case can change, so check the current documentation.
Matching requests
A route can match on many things:
- Host: which service name was asked for.
- Path: the exact path, a prefix, or a pattern, such as everything under “/checkout”.
- Headers: a request label, for example “x-user-group is beta-testers”.
- Query parameters: values in the address after the question mark.
Actions that a route can take
- Send traffic to one backend, or split it between several with weights.
- Rewrite the host or path before forwarding.
- Set a timeout and retry policy.
- Mirror a copy of the traffic to another backend for testing.
- Inject delays or errors on purpose, to test resilience.
- Redirect the caller to another address.
A company’s front desk has a directory board. “If a visitor asks for Billing, send them to the third floor. If they ask for Support and carry a gold card, send them to the premium lounge.” Routes are those directory lines, and the proxies are the front desk staff who read them.
Keep all configuration in version-controlled files and apply it with automation. Hand-clicking in a console is fine for learning, but in production you want every change reviewed, repeatable and easy to roll back.
TTraffic Management: Safe Releases and Smart Routing
The most loved feature: control exactly who gets which version.
Weighted traffic splitting
With weights, you decide the share of traffic each version receives. You might begin with ninety-five percent to the stable version and five percent to the new one. If the new version behaves well, you raise it to twenty-five, then fifty, then one hundred. If it misbehaves, you set it back to zero in seconds, without redeploying anything.
Header-based routing
You can send only certain requests to the new version, for example requests from your own testers who carry a special header. Real customers still see the stable version. This lets teams test in production safely.
flowchart TD
Req["Request From a Service Proxy"] --> Rule{"Does the Tester Header Match?"}
Rule -->|"Yes"| V2["Send to Version 2"]
Rule -->|"No"| Split{"Apply Weighted Split"}
Split -->|"95 percent"| V1["Version 1 Stable"]
Split -->|"5 percent"| V2
Traffic mirroring
Mirroring sends a copy of real requests to a new version, but throws away its answers. Real users only get answers from the stable version. The team can watch how the new version handles real traffic with zero risk to customers. Be careful with requests that change data, because a mirrored copy could still cause side effects unless the test system is isolated.
Timeouts and retries
A timeout sets the longest a proxy will wait. A retry policy says which failures are worth trying again, how many times, and how long to wait between tries. These rules, set centrally, give every service the same good behavior. Use retries only for requests that are safe to repeat, since a repeated payment request could charge a customer twice.
Fault injection
Fault injection means breaking things on purpose, in a controlled way. You can add delay to a share of requests or return an error for some of them, to learn whether callers cope. It is a safe way to practice for real failures, and a core tool of chaos engineering.
Rewrites and redirects
Routes can rewrite the host or path, which helps when you are renaming services or moving them while keeping old callers working. This makes migrations gradual rather than sudden.
A restaurant testing a new recipe gives a tiny taste portion to a handful of customers and asks for opinions before changing the whole menu. A secret tasting for staff only is the header rule. A kitchen cook who cooks the new dish alongside the old one, but throws the new one away after tasting, is mirroring.
Many retries at many layers multiply. If three services in a chain each retry three times, one failing call at the bottom can become dozens of calls. Set retry limits carefully and keep total waiting time bounded.
LLoad Balancing and Resilience
How the mesh keeps working when parts of the system struggle.
Choosing a load balancing method
Traffic Director can tell proxies how to choose among healthy copies. Common methods include:
- Round robin: take turns, one copy after another. Simple and fair when copies are equal.
- Least request: prefer the copy with the fewest requests in progress. Helps when requests take different times.
- Random: pick any healthy copy.
- Consistent hashing methods: send the same kind of request, such as the same user, to the same copy. This is useful when copies keep helpful temporary data in memory.
The exact list of supported methods can differ by proxy type, so check the current documentation.
Locality-aware routing
Google Cloud is divided into regions and zones. A call that stays in the same zone is faster and cheaper than one that crosses to another region. With locality-aware load balancing, proxies prefer the nearest healthy copies and only move to farther ones when nearby copies are unhealthy or overloaded. This lowers delay and network cost.
Failover
If every copy in a zone fails, traffic spills over to the next-nearest healthy location. You can design multi-zone and multi-region setups so that a whole zone can be lost without users noticing much.
Circuit breaking
A circuit breaker limits how many connections or requests may be waiting for a service at once. When the limit is hit, extra requests are rejected quickly instead of piling up. This protects both the caller and the struggling service, stopping the domino effect.
Outlier detection
Outlier detection watches for copies that keep failing compared to their peers. A copy that returns too many errors is temporarily removed from the pool, then tried again later. This is like benching a player who is injured and letting them return when they have recovered.
Health checks and draining
Health checks tell Traffic Director which copies are well. When you remove or replace a copy, connection draining lets existing requests finish while new ones go elsewhere, so deployments do not cut people off mid-request.
A supermarket opens more checkout lanes when queues grow (load balancing), sends shoppers to the closest open lane (locality), closes a lane with a broken scanner (outlier detection), and puts up a “lane full” sign when a queue is too long (circuit breaker).
Resilience settings only help if they are tested. Use fault injection in a safe environment to confirm that your timeouts, retries and circuit breakers really produce the behavior you expected.
DDeployment Models and Where It Runs
Several ways to put proxies and services together, and several kinds of places to run them.
Model 1: Sidecar proxies
An Envoy proxy runs next to each service copy, in the same virtual machine or in the same pod, which is the smallest deployable unit in Kubernetes. All of the service’s network traffic goes through its sidecar. This model works with any programming language, because the application does not need to know about the mesh. The cost is extra memory and CPU for each proxy, and a small added delay per hop.
Model 2: Proxyless gRPC
If your services use gRPC, the library inside the application can understand xDS and talk to Traffic Director directly. There is no sidecar. This reduces resource use and delay, and removes one moving part. The trade-offs are that you depend on supported gRPC versions and on the features that the library implements, and not every advanced capability is available in this style.
Model 3: Gateways and middle proxies
Sometimes you want Envoy proxies at the edge of the mesh or in the middle of it, acting as a shared entry point or exit point instead of one per service. Traffic Director can configure these as well. They are useful for controlling how outside systems reach the mesh, or for routing traffic between groups of services.
Model 4: Mixed and hybrid environments
Real systems are rarely tidy. Traffic Director can manage services on Compute Engine virtual machines, in containers on Google Kubernetes Engine, and, through hybrid connectivity options, services running in other clouds or on-premises. A hybrid NEG is a list of endpoints outside Google Cloud that Traffic Director can include in its routing, reachable over private connections such as VPN or Interconnect. This lets you move services to Google Cloud gradually while keeping a single set of routing rules.
| Model | Good for | Main cost |
|---|---|---|
| Envoy sidecar | Any language, rich features, uniform behavior | Extra CPU and memory per instance, a little added delay |
| Proxyless gRPC | gRPC-only systems that value low overhead | Limited by library versions and supported features |
| Gateway or middle proxy | Shared entry points and cross-group traffic | Another tier to run and scale |
| Hybrid and multi-cloud | Gradual migration and mixed estates | Network complexity and extra delay across connections |
A sidecar proxy is like giving every traveler a personal guide who handles tickets and directions. Proxyless gRPC is like training travelers to read the signs themselves. A gateway is like a single helpful information desk at the entrance of a station.
SSecurity in the Mesh
Inside a network, “trusted” is not a good enough default. Verify everyone.
In older designs, a firewall guarded the outside of a network and everything inside trusted everything else. Today, a single stolen password or one compromised service can let an attacker move around freely. The modern approach is zero trust: every request must prove who it comes from and be checked, even inside the network.
Identity for every workload
Each service gets a verifiable identity, delivered as a certificate that is issued and renewed automatically. The certificates come from a certificate authority service, such as Google’s Certificate Authority Service, so teams do not manage certificate files by hand. The identity tells other services exactly who is calling.
Encryption between services
With mutual TLS, both sides show their certificates, then encrypt the conversation. This protects data from being read by anyone listening on the network, and it blocks a fake service from pretending to be a real one. The proxies do this work, so developers do not need to add encryption code to each service.
Authorization policies
Authentication answers “who are you?”. Authorization answers “are you allowed to do this?”. Policies can say that only the checkout service may call the payment service, or that only certain paths and methods are open. This limits the damage if a single service is compromised, because it can only reach what it truly needs. This idea is called least privilege.
Protecting the control plane
Access to change Traffic Director configuration is controlled by Google Cloud’s Identity and Access Management. Only trusted people and automation should be allowed to edit routing rules, because a wrong rule can redirect traffic anywhere. Proxies also authenticate to Traffic Director with their own workload identities, so impostors cannot ask for the mesh configuration.
An office building where every employee wears a photo badge, every door needs a badge tap, and each badge opens only the rooms that person works in. A stolen badge is limited to a few doors instead of the whole building.
Security habits
- Turn on mutual TLS gradually, starting in a permissive mode that accepts both secure and plain traffic, and then tighten to strict mode after you confirm that all callers are ready.
- Write authorization rules as “deny by default, allow what is needed”.
- Keep certificate lifetimes short and make sure renewal is automatic and monitored.
- Use separate identities for separate services, never a shared one.
- Review who can change mesh configuration, and require review for changes.
Turning on strict encryption everywhere in one step can break callers that are not ready, such as old services or health checkers that do not carry certificates. Roll out security by stages and test each stage.
OObservability: Seeing Inside the Mesh
A mesh makes a hidden world of service calls visible, if you look at the right signals.
Because every request passes through a proxy or a smart client, proxies are perfect places to collect facts about traffic. They can report the same set of signals for every service, regardless of programming language.
The three signals
- Metrics: numbers over time, such as requests per second, error rate and response time.
- Logs: records of individual requests, which show what happened to a particular call.
- Traces: the path of one request through many services, showing where time was spent. Your applications may need to pass along a trace identifier for traces to connect properly across services.
These can be sent to Google Cloud’s Cloud Monitoring, Cloud Logging and Cloud Trace, or to other tools you prefer.
The golden signals
A well-known approach says to watch four things for every service: latency (how long requests take), traffic (how many requests), errors (how many fail) and saturation (how full the resources are).
Checking the control plane’s view
Besides watching traffic, you will sometimes ask a different question: “What configuration does this proxy actually have right now?” Traffic Director provides ways to inspect the status of connected clients and their received configuration. This is very helpful when a rule seems not to apply, because it shows whether the problem is in the rule, the delivery or the proxy.
| Signal to watch | Why it matters | A warning sign |
|---|---|---|
| Error rate per service pair | Shows exactly which connection is failing | One caller sees many errors from one target |
| Latency percentiles | Averages hide slow outliers, so look at the slowest few percent | The slowest requests keep getting slower |
| Retry count | Retries hide problems and add load | Retries rising while errors seem low |
| Healthy endpoint count | Shows how many copies are available | A sudden drop in healthy copies |
| Circuit breaker trips | Shows overloaded targets | Frequent rejections at peak time |
| Config update failures | Shows proxies that are stuck with old rules | Proxies not receiving or rejecting updates |
| Proxy CPU and memory | Sidecars use real resources | Proxies near their limits |
If every road junction had a counter showing how many cars pass, how long they wait and how many break down, the city planners would see jams forming before drivers complained. Proxies are those counters at every junction.
PPerformance and Scalability
What grows when your system grows, and what to keep an eye on.
The control plane scales for you
Traffic Director is a managed global service, so Google handles the scaling of the control plane. You do not size servers for it. What you do need to know are the documented limits, such as how many proxies, services or endpoints are supported per configuration. These limits can change, so check the current quotas before designing a very large mesh.
The data plane is your responsibility
Proxies use CPU and memory. The more routes, services and endpoints a proxy has to know about, the more memory its configuration needs. In a very large mesh, giving every proxy the entire picture of every service is wasteful. Where possible, limit each proxy’s view to the services it actually needs to call.
Latency added by proxies
A sidecar adds a small delay on each hop, because the request goes through two proxies (one on each side). For most applications this is tiny compared to the work the services do, but chains of many calls add up. Measure it in your own system. Proxyless gRPC removes this extra hop.
Scaling the services themselves
Traffic Director works nicely with autoscaling. When a managed instance group or a Kubernetes deployment adds copies, the NEG updates, Traffic Director learns of the new endpoints and pushes them to the proxies, so new copies start receiving traffic quickly once they pass health checks.
Tips for large systems
- Use the narrowest configuration scope that works for each group of services.
- Avoid unnecessary changes. Frequent configuration churn makes every proxy work harder.
- Stagger restarts of large groups of proxies so they do not all request their configuration at once.
- Choose sensible health check intervals. Very frequent checks add load and noise.
- Right-size proxy resources after observing real usage.
Giving every taxi driver a map of the whole world uses a lot of memory and slows the driver down. Giving each driver a map of the city they actually serve keeps things fast.
Run a load test that includes the proxies, not just the services. A test that bypasses the mesh can give you numbers that real traffic will never see.
CCost: Understanding the Bill
The cost of a mesh is more than the control plane. Count everything.
Pricing for Traffic Director and related mesh offerings is set by Google and can change, so use Google’s pricing page and calculator for current numbers. What matters for planning is to see the full picture of where money goes.
Managed Service Usage
Any charge for using the managed control plane, which depends on how Google currently prices the offering. Check the latest rules.
Proxy Resources
CPU and memory for every sidecar or gateway. In a large fleet, this is often the biggest hidden cost.
Data Transfer
Traffic between zones, regions or out to other clouds is charged. Locality-aware routing helps reduce it.
Logs, Metrics and Traces
Collecting everything from every request can become expensive. Sampling helps control it.
Ways to keep spending sensible
- Prefer local traffic: keep callers and targets in the same zone when possible.
- Consider proxyless gRPC: where it fits, it saves the cost of running sidecars.
- Sample logs and traces: record all errors, but only a fraction of normal requests.
- Right-size sidecars: measure and set realistic resource requests, instead of copying large defaults.
- Limit configuration scope: smaller configurations mean lighter proxies.
- Label everything: so that billing reports show which team and environment spend what.
Hiring a personal guide for every traveler is wonderful but costs more than printing clear signs. Decide where the extra help truly pays off, and use cheaper methods elsewhere.
A mesh can also save money. Standard retries, timeouts and encryption mean less custom code to write and maintain, and safer releases mean fewer costly outages.
AAdopting It Step by Step
A calm, staged path from “no mesh” to “mesh in production”.
Decide if you need a mesh
If you have a handful of services and simple needs, simpler tools may be enough. A mesh pays off as the number of services and the need for consistent control grow.
Pick the data plane style
Choose sidecars, proxyless gRPC or a mix, based on your languages, protocols and resource budget.
Start in a test environment
Set up a small mesh with two or three non-critical services. Practice routing, splitting and failure handling.
Add observability first
Turn on metrics, logs and traces before changing behavior, so you can see the effect of every change.
Onboard services gradually
Bring services into the mesh one team at a time, starting with the least critical. Keep the old path available while you verify the new one.
Introduce security in stages
Begin with permissive encryption, confirm all callers are ready, and then move to strict mode and authorization policies.
Automate and document
Keep configuration in version control, use review and testing for changes, and write runbooks for common problems.
How Traffic Director relates to Istio and other options
Istio is a well-known open-source service mesh that includes its own control plane that you or a vendor run. Traffic Director takes a different approach: Google runs the control plane, and it speaks the open xDS APIs, which Envoy and other clients understand. Google has also brought its mesh offerings together under the Cloud Service Mesh name, including options based on Istio, so you may see both styles described together. Which path is right for you depends on your platform, your need for Kubernetes-specific features and your appetite for running your own control plane. Read the current documentation to see which options are recommended for new projects.
Because product packaging and recommended paths evolve, before starting a new project check Google’s latest guidance on which mesh option to use. Your skills, such as understanding routes, proxies and xDS, will transfer either way.
AAdvantages, Disadvantages and Trade-offs
No tool is perfect. A good architect weighs both sides before choosing.
Advantages
- Fully managed, so there is no control plane for your team to run or patch
- Built on open xDS APIs, which reduces lock-in at the proxy level
- One central place for routing, retries, timeouts and traffic splitting
- Safe releases through canaries, header routing and mirroring
- Works across virtual machines, containers and hybrid locations
- Supports both sidecar and proxyless gRPC styles
- Locality-aware load balancing lowers delay and network cost
- Integrates with Google Cloud identity, certificates and observability
- Proxies keep working with their last configuration if the control plane is briefly unreachable
Disadvantages
- Adds a new layer, with new concepts that teams must learn
- Sidecars consume extra CPU and memory and add a small delay
- Debugging gets harder, because a problem may sit in the app, the proxy or the rules
- Tied to Google Cloud for the managed control plane
- Product names and recommended setups change over time, which can confuse teams
- Proxyless gRPC is limited to supported libraries and features
- A wrong central rule can affect many services at once
- For small systems, the complexity may outweigh the benefit
How it compares with its neighbors
| Question | Traffic Director | Cloud Load Balancing (external or internal) | Self-run Istio |
|---|---|---|---|
| Main purpose | Control plane for service-to-service traffic | Distribute traffic to a service from clients | Open-source mesh with its own control plane |
| Who runs the control plane | Google, as a managed load balancer | You or a vendor | |
| Proxies | Envoy or proxyless gRPC that you deploy | Managed by Google | Envoy that you deploy |
| Best fit | Many services needing consistent routing and policy | Entry points and simple internal balancing | Teams wanting full control of an open-source mesh |
| Operations effort | Moderate: data plane only | Low | Higher: data plane and control plane |
The main trade-offs, in plain words
- Consistency versus complexity: a mesh gives every service the same behavior, but you must learn and operate the mesh.
- Power versus overhead: sidecars give rich features at a resource cost. Proxyless saves resources but offers fewer features.
- Central control versus blast radius: one place for rules is convenient, but a mistake there can spread widely. Review and staged rollouts reduce the risk.
- Managed versus self-run: a managed control plane saves effort, while a self-run one gives deeper control and portability.
DDesign Patterns and Anti-patterns
A pattern is a proven way to solve a common problem. An anti-pattern is a tempting mistake that causes pain later.
Helpful patterns
Canary Release
Send a small share of traffic to a new version, watch the signals, and raise the share step by step, with a quick path back to zero.
Shadow Testing
Mirror live requests to a new version and compare behavior without affecting users.
Zone-Aware Routing
Prefer local copies to reduce delay and cross-zone cost, with failover to other zones as a safety net.
Bulkheads and Circuit Breakers
Limit how much one caller can demand of a service, so one noisy neighbor cannot sink everyone.
Strangler Migration
Move functions out of an old system one route at a time, using rules to send each path to old or new, until the old system can be retired.
Zero-Trust Service Access
Give every service an identity, encrypt calls and allow only the specific callers that each service needs.
Anti-patterns to avoid
What people do
They add retries at every layer of a call chain, each with generous counts.
Why it hurts
A small failure turns into a retry storm that overloads the very service that is already struggling.
Better approach
Retry only at one well-chosen layer, limit the number of attempts, add waiting time between tries and use circuit breakers.
What people do
They push a rule change to the whole mesh at once, with no testing.
Why it hurts
One typo can misroute traffic for every service, causing a wide outage.
Better approach
Validate in a test mesh first, apply changes to a small group, watch the signals, then expand. Keep the previous version ready to restore.
What people do
They put business logic into mesh rules, such as complicated conditions that decide what a customer is entitled to.
Why it hurts
The behavior of the application becomes hidden in infrastructure configuration, where developers do not expect it and cannot test it easily.
Better approach
Keep the mesh for traffic, security and resilience. Keep business decisions in application code.
What people do
They let every proxy know about every service in a huge system.
Why it hurts
Proxies use more memory, take longer to start, and every small change causes a lot of update traffic.
Better approach
Limit each proxy’s view to the services it needs, and group services logically.
What people do
They adopt a mesh for a handful of services “because it is modern”.
Why it hurts
The team spends its energy learning and debugging infrastructure instead of building features.
Better approach
Adopt a mesh when you feel real pain from inconsistent behavior, risky releases or security gaps, and start small.
BBest Practices and Common Mistakes
A checklist you can follow from the first day.
Best practices
- Start small and learn. Begin with a few services in a test environment.
- Make observability the first step. Turn on metrics, logs and traces before changing routing.
- Manage configuration as code. Keep it in version control, with reviews and automated checks.
- Release with canaries. Use weights and header rules, and define clear success signals before you begin.
- Set explicit timeouts everywhere. A call without a timeout can wait forever.
- Use retries wisely. Only for safe, repeatable requests, with limits.
- Use health checks that reflect real readiness. A service that is starting up should not receive traffic yet.
- Prefer locality. Keep traffic near its source and fail over only when needed.
- Secure in stages. Permissive first, strict later, with least-privilege policies.
- Protect who can edit rules. Use tight access control and require review.
- Run drills. Practice failure with fault injection and test failover.
- Check the latest documentation. Names, limits and recommended setups change, so verify before final designs.
Common mistakes
Forgetting health check firewall rules
If health checkers cannot reach the services, every copy looks unhealthy and traffic stops. Allow the health check sources through the firewall.
Mismatched names
Routes match on host names. A small difference between the name the client uses and the name in the rule means the rule never applies, and traffic follows an unexpected path.
Missing trace headers
If applications do not pass along the trace identifiers, traces break into disconnected pieces and become much less helpful.
Overlooking proxy resource limits
Proxies starved of CPU or memory slow down all traffic and make the mesh look broken. Monitor and size them.
Blaming the mesh for everything
Once a mesh exists, every network problem gets blamed on it. Use proxy logs and traces to find out whether the problem is in the application, the network or the rules.
No plan for rollback
Teams change rules without keeping the last known good version. Always keep a quick way back.
RReal-World Usage Scenarios
Four illustrative stories show where Traffic Director fits. The companies below are imaginary examples to teach the ideas.
Scenario 1: An online store releasing a new pricing service
A retailer rewrites its pricing service. Instead of switching everyone at once, the team sends requests from its own staff to the new version using a header rule, then gives it five percent of real traffic, then twenty-five, then everyone. When error rates rise at the twenty-five percent step, they set the weight back to zero within moments, fix the bug and try again the next day. Customers barely notice.
Scenario 2: A bank separating sensitive services
A bank runs many internal services. They give each service its own identity, turn on mutual encryption and write rules so that only the transfer service may call the ledger service, and only on specific paths. When one low-risk reporting service is found to be vulnerable, the attacker cannot reach the ledger, because the policy refuses the call.
Scenario 3: A company moving to Google Cloud slowly
A logistics company has some services in its own data center and some on Google Cloud. Using hybrid endpoints and routing rules, the team sends one route at a time to the new cloud versions while the rest stays on-premises. If something goes wrong, they switch that route back. After several months the data center services are retired without a dramatic cutover weekend.
Scenario 4: A streaming app surviving a zone problem
A video app runs its services across several zones. Proxies prefer the nearest healthy copies to keep delays low. When one zone has a problem, outlier detection and health checks remove the sick copies, and traffic flows to healthy zones automatically. Viewers see a short blip at most, and the on-call engineer receives an alert instead of a flood of angry messages.
When Traffic Director is a strong choice
- You run many services on Google Cloud, and you want consistent routing, resilience and security.
- You want safe releases with traffic splitting and mirroring.
- You have a mix of virtual machines, containers and hybrid locations.
- You prefer Google to run the control plane rather than running your own.
When to think twice
- You have only a few services and simple needs.
- Your team does not yet have the skills or time to operate proxies and troubleshoot them.
- You need a fully self-hosted, cloud-neutral mesh with deep control of the control plane.
- You cannot accept any added resource use or delay from proxies, and proxyless gRPC does not fit.
FFrequently Asked Questions
Quick answers to questions that beginners ask most often.
SSummary and Key Takeaways
Remember These Points
- What it is: Traffic Director is Google Cloud’s managed control plane for service meshes. It tells your proxies where to send requests and how to behave, using open xDS APIs.
- Brain and muscle: the control plane holds the rules, and the data plane of Envoy sidecars, gateways or proxyless gRPC clients carries the traffic. Your requests never pass through Traffic Director.
- Safe releases: weighted splits, header rules and mirroring let you test new versions with small risk and roll back in seconds.
- Resilience built in: timeouts, careful retries, circuit breakers, outlier detection, locality-aware routing and failover keep problems small.
- Security in layers: workload identities, mutual TLS and least-privilege authorization policies, introduced in stages and protected by strict access to the rules themselves.
- See what happens: metrics, logs and traces from every proxy, plus tools to check the configuration each proxy received, make troubleshooting practical.
- Count the full cost: proxy resources, data transfer and telemetry often matter more than the control plane itself. Proxyless gRPC and sampling can help.
- Adopt with care: start small, use configuration as code and staged rollouts, and always check Google’s latest documentation, because product names, limits and recommended setups evolve.