A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/appengine/docs/legacy/standard/python/splitting-traffic below:

Splitting Traffic | App Engine standard environment for Python 2

Splitting Traffic

Stay organized with collections Save and categorize content based on your preferences.

Region ID

The REGION_ID is an abbreviated code that Google assigns based on the region you select when you create your app. The code does not correspond to a country or province, even though some region IDs may appear similar to commonly used country and province codes. For apps created after February 2020, REGION_ID.r is included in App Engine URLs. For existing apps created before this date, the region ID is optional in the URL.

Learn more about region IDs.

You can use traffic splitting to specify a percentage distribution of traffic across two or more of the versions within a service. Splitting traffic allows you to conduct A/B testing between your versions and provides control over the pace when rolling out features.

Traffic splitting is applied to URLs that do not explicitly target a version. For example, the following URLs split traffic because they target all the available versions within the specified service:

For information about how requests reach a version, see How Requests are Routed.

Before you begin

Before you can configure traffic to a version, ensure that your user account includes the required privileges.

Avoiding caching issues

Before you turn on traffic splitting, you might want to account for potential caching problems. Caching issues can exist for any App Engine app, especially when deploying a new version. Traffic splitting often makes subtle caching problems more apparent.

For example, assume you are splitting traffic between two versions, A and B, and some external cacheable resource changed between versions, for example, a CSS file. Now assume that a client makes a request and the response contains an external reference to the cached file. The local HTTP cache will retrieve the file if it's in the cache, regardless of which version of the file is cached and which version of the application sent the response. The cached resource could be incompatible with the data that was sent in the response.

To avoid caching problems:

You can also have your app set the Vary: Cookie header so that the uniqueness of a resource is computed by combining the cookies and the URL for the request. However, this approach increases the burden on cache servers. There are 1000 possible values of GOOGAPPUID, and hence 1000 possible entries for each URL for your app. Depending on the load on the proxies between your users and your app, this can decrease how often your app serves a cached result. In addition, for the 24 hours after adding a new batch of users to a version, those users might still see cached resources. However, using Vary: Cookie can make it easier to rename static resources that are changing between versions.

The Vary: Cookie technique doesn't work in all circumstances. In general, if your app is using cookies for other purposes, you must consider how this affects the burden on proxy servers. If codeninja had its own cookie that had 100 possible values, then the space of all possible cache entries becomes a very big number (100 * 1000 = 100,000). In the worst case, there is a unique cookie for every user. Two common examples of this are Google Analytics (__utma) and SiteCatalyst (s_vi). In these cases, every user gets a unique copy, which severely degrades cache performance and can also increase the billable instance hours consumed by your app.

Splitting traffic across multiple versions

When you have specified two or more versions for splitting, you must choose whether to split traffic by using either a sender IP address or HTTP cookie. It's easier to set up an IP address split, but a cookie split is more precise. For more information, see IP address splitting and Cookie splitting.

Console

To split traffic in the Google Cloud console, go to the Versions page:

Go to the Versions page

  1. Select one or more versions to which you want to split traffic.
  2. Click Split traffic and then specify:
gcloud

After installing the Google Cloud CLI, you run the following command to split traffic across multiple versions, for example:

gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION1]=[VERSION1_WEIGHT],[MY_VERSION2]=[VERSION2_WEIGHT] --split-by [IP_OR_COOKIE]

For details and additional options, see the gcloud app services set-traffic reference.

API

To programmatically migrate traffic, you can use the Admin API, see Migrating and Splitting Traffic for details.

IP address splitting

If you choose to split traffic to your application by sender IP address, when the application receives a request, it hashes the IP address to a value between 0–999, and uses that number to route the request.

IP address splitting has some significant limitations:

Cookie splitting

If you choose to split traffic to your application by cookies, the application looks in the HTTP request header for a cookie named GOOGAPPUID, which contains a value between 0–999:

If the response does not contain the GOOGAPPUID cookie, the app first adds the GOOGAPPUID cookie with a random value between 0–999 before it is sent.

Using cookies to split traffic makes it easier to accurately assign users to versions. The precision for traffic routing can reach as close as 0.1% to the target split. Although, cookie splitting has the following limitations:

Disabling traffic splitting

To disable traffic splitting, you migrate all traffic to a single version.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["`REGION_ID` is a Google-assigned abbreviated code based on the region selected during app creation, not corresponding to a specific country or province, and it is included in App Engine URLs for apps created after February 2020."],["Traffic splitting allows the distribution of traffic across multiple versions of a service, which enables A/B testing and controlled feature rollouts, applied to URLs that do not explicitly target a specific version."],["Caching issues, particularly with external resources, can be more apparent with traffic splitting, so setting `Cache-Control` and `Expires` headers for dynamic resources or changing URLs for version-varying static resources is recommended."],["Traffic can be split by sender IP address, which is easier to set up but less precise, or by HTTP cookie (`GOOGAPPUID`), which is more precise but requires cookie management and is done with the Google Cloud console, gcloud CLI, or the Admin API."],["Disabling traffic splitting involves migrating all traffic to a single version."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4