Prepare and test your skills

Prepare and test your skills

Execute Deployment Strategies and Rollback Procedures is the practice of shifting percentage-based traffic splitting (opens in a new tab) between application versions to release safely and recover quickly. A stable version keeps serving most users while a new version receives a small share of traffic. A rollback reallocates traffic back to the stable version if metrics or failures show a problem. In App Engine, this control applies within a service across two or more versions.
Traffic splitting in App Engine distributes requests that arrive at a service-level URL across versions by percentage. Traffic flows from the generic service URL to the splitter, the splitter routes each request to one version, and that version returns the response to the client. Requests to https://PROJECT_ID.REGION_ID.r.appspot.com are distributed to versions of the default service, while requests to https://SERVICE_ID-dot-PROJECT_ID.REGION_ID.r.appspot.com are distributed to versions of that named service. URLs that explicitly target a version bypass the split, so testing and production traffic can coexist.
A left-to-right flow showing a client request to a service URL, a splitter dividing 90 percent to stable version A and 10 percent to new version B, with a dashed response back and a rollback path restoring 100 percent to stable.
A gradual rollout keeps the previous stable version running while the new version proves itself. The operator first deploys the new version without sending it all traffic, then increases its percentage in stages as error rates, latency, and user experience remain healthy. Because both versions stay available during the split, the operator can shift weight forward to complete the release or backward to recover without redeploying code. This pattern also supports A/B testing because different users can use different versions at the same time.
Choosing a split method in App Engine means deciding how the splitter assigns each request to a version shard. IP address splitting hashes the sender IP address to a value from 0–999 and uses that value to route the request. Cookie splitting looks for a GOOGAPPUID cookie with a value from 0–999 in the HTTP request header, uses that value if present, and generates and returns a masked random value if the cookie is missing.
| Method | How routing value is assigned | Precision and stickiness |
|---|---|---|
| IP address splitting | Splitter hashes sender IP address from client to 0–999 | Approximate and less sticky; a 5% target may initially serve 3–7% and averages closer with more traffic, and mobile or roaming users may change versions when their IP changes |
| Cookie splitting | Splitter uses GOOGAPPUID value from 0–999, creating one when absent; 1000 shards are divided by percentage, so 10%, 60%, and 30% become 100, 600, and 300 shards | Precise to near 0.1% of target and sticky; the same cookie value is handled by the same version |
Choose IP address splitting when simplicity matters and approximate distribution is acceptable for external browser traffic. Choose cookie splitting when accurate percentages and consistent user experience matter, especially for A/B testing, gradual feature rollouts, and traffic that includes requests sent between apps inside Google's cloud infrastructure.
Exam tip: Use cookie splitting, not IP splitting, for internal app-to-app requests, because internal requests come from a small pool of IP addresses that can all land on one version and ignore the intended percentages.
Rollback by reallocating traffic means disabling the split by migrating 100% of service traffic to a single stable version. The stable version must remain deployed and healthy so traffic flows from the service URL directly to that version as soon as the weights are changed. This makes recovery fast because no new deployment is required, only a routing change in response to failed checks, rising errors, or degraded performance.
Traffic weights can be changed in the Google Cloud console, with the Google Cloud CLI (gcloud CLI), or programmatically with the Admin API. In the console, the operator opens the Versions page, selects the versions, clicks Split traffic, and sets the method and the percentage each version should receive. With gcloud CLI, the same change uses a command such as gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION1]=[VERSION1_WEIGHT],[MY_VERSION2]=[VERSION2_WEIGHT] --split-by [IP_OR_COOKIE].
IP address splitting has practical limits that affect rollout decisions:
Cookie splitting has different operational limits:
Set-Cookie value and send it with each later request, while browser apps manage this automatically.GOOGAPPUID value, although the same value consistently reaches the same version.Avoiding caching problems during version splits means preventing a proxy or browser from serving a file cached from one version alongside a page rendered by another version. The risk grows during splits because two versions can reference different static resources, such as a CSS file, while sharing the same service URL. A client may then receive data from version B but load a cached resource from version A that is incompatible with that data.
For dynamic resources, the app should set both Cache-Control and Expires headers so proxies treat the response as dynamic, since not all proxies handle Cache-Control alone correctly. For cacheable static resources that change between versions, the app should change the resource URL between versions so both copies can coexist safely in caches. The app can also send Vary: Cookie so cache uniqueness combines the URL and cookies, but there are 1000 possible GOOGAPPUID values and therefore up to 1000 cache entries per URL, which lowers hit rates and can increase instance hours. The burden multiplies with other cookies, such as 100 app values creating 100,000 combinations, and users added to a version may still see cached resources for about 24 hours.
Configure Traffic Distribution in Google Kubernetes Engine is the practice of dividing incoming requests across different versions of an application by percentage using traffic management (opens in a new tab) controls. A split such as 95% to the stable version and 5% to a new version lets teams run canary releases, blue-green deployments, and A/B testing while controlling the pace of a rollout. The same idea applies to outbound traffic, where pod workloads must be explicitly enabled to send traffic outside the organization.
Splitting traffic across versions means specifying a percentage distribution of traffic across two or more versions within a service. The split applies to URLs that do not explicitly target a version, so requests to the service hostname are divided according to the configured weights. For example, https://PROJECT_ID.REGION_ID.r.appspot.com distributes traffic to versions of the default service, while https://SERVICE_ID-dot-PROJECT_ID.REGION_ID.r.appspot.com distributes traffic to versions of that named service. For apps created after February 2020, REGION_ID.r is included in App Engine URLs, where REGION_ID is the abbreviated code assigned when the app is created.
Configuring a traffic split means selecting the versions, the splitting method, and the percentage each version should receive. The account must have the required privileges before configuring traffic to a version. Three interfaces support the same operation:
gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION1]=[VERSION1_WEIGHT],[MY_VERSION2]=[VERSION2_WEIGHT] --split-by [IP_OR_COOKIE] to assign weights and choose IP or cookie-based splitting.Comparing IP and cookie routing means understanding how each method decides which version handles a request. When two or more versions are specified for splitting, the split uses either sender IP address or HTTP cookie. IP address splitting is easier to set up, while cookie splitting is more precise and stable for individual users.
| Option | How requests are routed | Behavior and limitations |
|---|---|---|
| IP address splitting | The application hashes the sender IP address to a value between 0–999 and uses that number to route the request | Addresses are reasonably sticky but not permanent, so mobile users or users moving networks may shift versions; actual percentages vary at low traffic and converge toward the target as traffic grows; internal requests from Google Cloud infrastructure come from few IPs and may all land on one version |
| Cookie splitting | The application uses an HTTP cookie, including GOOGAPPUID values, to keep a user on the assigned version | More precise per-user routing than IP hashing; there are 1000 possible GOOGAPPUID values, so caches must store more variants and users added to a version may still see cached resources for up to 24 hours |
Exam tip: Choose cookie splitting instead of IP address splitting for internal requests between apps, because internal requests originate from a small number of infrastructure IP addresses that can all map to the same version.
Preventing caching problems during a split means avoiding mismatched content when a new version changes shared files such as CSS. A client may receive a response from version B while its browser or proxy serves a cached static file from version A, and the cached resource may be incompatible with the response data. For dynamic resources, the app sets both Cache-Control and Expires headers to tell proxies the resource is dynamic, since not all proxies handle Cache-Control correctly. For cacheable static resources that vary between versions, the app changes the resource URL between versions so both versions can coexist in browser and proxy caches.
Setting Vary: Cookie can also separate cached entries by cookie and URL, but it increases cache burden because each URL can have 1000 entries for GOOGAPPUID alone. The burden grows much larger if the app uses its own cookies such as analytics identifiers. This tradeoff matters because lower cache hit rates mean more requests reach the application versions directly.
Enabling outbound traffic from pod workloads controls whether container workloads in a project can send traffic outside the organization. By default, Google Distributed Cloud (GDC) air-gapped blocks workloads in a project from going out of the organization. Traffic can leave only after the Platform Administrator (PA) disables data exfiltration protection for the project and the Application Operator (AO) adds the label egress.networking.gke.io/enabled: true to the pod.
When a well-known IP address is allocated and used for the project, the platform performs source network address translation (NAT) on the outbound traffic leaving the organization. If pods are managed by a higher-level controller such as a Deployment or DaemonSet, the label must be configured in the pod template specification so every managed pod carries it. In this model, the PA controls the project boundary and the AO controls which pods are allowed to use the outbound path.
Manage Traffic Splitting in Serverless Environments is the practice of distributing incoming requests with traffic splitting (opens in a new tab) across two or more versions of the same service by percentage. In App Engine, a service can run multiple versions at the same time, and the split controls how much traffic each version receives. This pattern supports A/B testing between versions and lets teams control the pace of a gradual feature rollout.
How serverless requests are split is determined by whether the request URL names a specific version. Traffic splitting in App Engine applies only to URLs that target a service without naming a specific version. Requests to https://PROJECT_ID.REGION_ID.r.appspot.com are distributed across versions of the default service, while requests to https://SERVICE_ID-dot-PROJECT_ID.REGION_ID.r.appspot.com are distributed across versions of that named service. A URL that explicitly targets a version bypasses the split and goes directly to that version.
Before configuring a split, the user account must have the required privileges to manage the service versions. A traffic split is configured for a service by selecting two or more versions, choosing a split method, and assigning a traffic percentage to each version. In the Google Cloud console, this is done from the Versions page by selecting the versions and clicking Split traffic. The same split can be applied from the command line with gcloud app services set-traffic, which takes the service name, each version with its weight, and the split method, or programmatically through the Admin API.
Split method precision determines how App Engine decides which version handles each request. The service supports splitting by sender IP address or by HTTP cookie, and the two methods differ in precision and behavior for internal traffic.
| Method | How routing is decided | Precision and stickiness |
|---|---|---|
| IP address splitting | App Engine hashes the sender IP address to a value from 0–999 and routes the request | Easier to set up, but less precise and less sticky when client addresses change |
| Cookie splitting | App Engine routes by the GOOGAPPUID cookie value from 0–999, creating the cookie when missing | More precise, close to 0.1%, and keeps the same user on the same version |
Exam tip: Choose cookie splitting when precision matters or when requests originate inside Google Cloud infrastructure, because internal requests share a small set of IP addresses and do not respect IP-based percentages.
IP address splitting limits describe what happens when requests are routed by hashing the sender IP address to a number between 0–999. Sender addresses are reasonably sticky but are not permanent, so a user on a mobile phone or a laptop moving between networks can shift addresses and have an inconsistent experience. The actual distribution also varies at low traffic volumes and moves closer to the target as volume grows.
IP address splitting has three main limitations:
Cookie splitting precision comes from routing each request using a cookie named GOOGAPPUID found in the HTTP request header. If the cookie exists, App Engine uses its value from 0–999 to route the request, and if it is missing, App Engine generates a masked random value and adds the cookie to the response. App Engine divides traffic into 1000 shards and gives each version a share of shards that matches its percentage, so a 10%, 60%, and 30% split assigns 100, 600, and 300 shards. The same cookie value always routes to the same version, although there is no way to predict which value maps to which version.
Cookie splitting has three main limitations:
Set-Cookie value and send it with each later request, while browsers handle this automatically.GOOGAPPUID value belongs to which version, only that identical values stay together.Avoiding caching issues during traffic splitting means handling the case where two versions serve different content behind the same service URL. A common problem occurs when versions A and B reference different cacheable files, such as a CSS file, and a browser or proxy reuses the cached file from one version with a response from the other. For dynamic resources, the app sets both the Cache-Control and Expires headers so proxies treat the response as dynamic. For static resources that change between versions, the app changes the resource URL in each version so both copies can coexist safely in browser and proxy caches.
Disabling traffic splitting means returning a service to a single serving version. The split is removed by migrating 100% of traffic to one version, after which service-level URLs no longer distribute requests across multiple versions. The remaining version then handles all service traffic until a new split is configured.
GOOGAPPUID cookie value from 0–999 and is precise to near 0.1% and sticky.egress.networking.gke.io/enabled: true to the pod.In App Engine, IP address splitting routes by hashing the sender IP address to a value from 0 to 999 and is approximate and less sticky, while cookie splitting routes by the GOOGAPPUID cookie value from 0 to 999 and is precise to near 0.1 percent and sticky. A 5 percent IP target may initially serve 3 to 7 percent and averages closer with more traffic, while cookie splitting divides 1000 shards by percentage so 10, 60 and 30 percent become 100, 600 and 300 shards. The same cookie value is consistently handled by the same version, whereas mobile or roaming users may change versions when their IP changes.
Use cookie splitting in App Engine when accurate percentages and consistent user experience matter, especially for A/B testing, gradual feature rollouts, and traffic that includes requests sent between apps inside Google cloud infrastructure. IP address splitting is appropriate when simplicity matters and approximate distribution is acceptable for external browser traffic. Internal requests should use cookie splitting because they come from a small pool of IP addresses that can all land on one version and ignore the intended percentages.
Rollback in App Engine is performed by migrating 100 percent of service traffic to a single stable version. The stable version must remain deployed and healthy so traffic flows from the service URL directly to that version as soon as the weights are changed. This recovery requires no new deployment, only a routing change in response to failed checks, rising errors, or degraded performance.
Prevent caching problems during an App Engine split by setting both Cache-Control and Expires headers for dynamic resources and by changing the resource URL between versions for cacheable static resources that change. Setting both headers tells proxies to treat the response as dynamic, while changing the URL lets both copies coexist safely so a browser or proxy does not serve a cached file from one version alongside a response from another version. Sending Vary with Cookie can also separate entries by URL and cookie, but 1000 possible GOOGAPPUID values create up to 1000 cache entries per URL, which lowers hit rates and can increase instance hours.
Your team has deployed a new revision (orders-v2) of an internal microservice running on Cloud Run. Before directing any live user traffic to orders-v2, quality assurance engineers need to perform isolated smoke testing using a dedicated URL.
After testing is successful, you need to route 10% of incoming production requests to orders-v2 and keep 90% of traffic directed to the existing stable revision (orders-v1).
Which configuration approach should you use?
Last updated