Traffic migration switches the request routing between the versions within a service of your application, moving traffic from one or more versions to a single new version.By default, warmup requests are enabled and traffic is gradually migrated to the new version.
You can also choose to disable warmup requests if you want the traffic immediately migrated to the new version.
If warmup requests are enabled, you can migrate traffic between versions that reside in different environments only by specifying to migrate traffic immediately.
If you want to split traffic between two or more versions of your application, see Traffic Splitting.
Adding warmup requests to your application
When warmup requests are enabled, traffic is migrated gradually by first sending a warmup request to new instances before those instances receive any user requests. Warmup requests improve user response time by allowing the version currently receiving traffic to handle those requests but the traffic migration to the new version can take a short amount of time while the new instances are created.
When warmup requests are not enabled, user requests are sent to those new instances before they have been created. Due to the delay caused by creating the new instances and loading application code, latency can occur for those user responses.
To avoid latency and enable warmup requests, you include the
element in your configuration file before you deploy your application to App
For example, you include the following in your
before you deploy it to App Engine:
<inbound-services> <service>mail</service> <service>warmup</service> </inbound-services>
For complete details about enabling warmup requests, see Configuring Warmup Requests to Improve Performance.
Migrating traffic to a new version
To migrate traffic in the GCP Console, go to the Versions page:
- Select the version to which you want to migrate 100% of the traffic.
- Click Migrate traffic.
- Optional: When warmup requests are enabled your traffic is migrated gradually. To migrate traffic immediately, select the option under the Show advanced options section.
To migrate traffic immediately:
gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1
To gradually migrate traffic, you include the optional
gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1 --migrate
To programmatically migrate traffic, you can use the Admin API, see Migrating and Splitting Traffic for details.