Traffic migration smoothly switches request routing when you upload a new version of a module, gradually moving traffic from the old version to the new version. You can only use traffic migration when a single version of your application is receiving 100% of all traffic to that module.
To split traffic between two or more versions of your application, see Traffic Splitting.
Adding warmup requests to your application
When using traffic migration you must enable warmup requests on the version you are migration to, or the target version.
Warmup requests are sent to new instances before they receive user requests, which improves response time. Otherwise, when a request from a user requires the creation of a new instance, the instance receives a loading request first, in order to initialize and load the application code. This can increase latency when handling the first user request.
For Go modules, you need to enable warmup requests by including this line in
inbound_services: - warmup
For more information, see Configuring Warmup Requests to Improve Performance.
Turning on traffic migration in the Google Cloud Platform Console
To begin migrating traffic, go to the Versions page in the Cloud Platform Console.
Go to the Versions page
- Select an available version.
- Click Migrate traffic.
Migration takes a short amount of time (possibly a few minutes), and the exact interval depends on how much traffic your app is receiving and how many instances are running. Once the migration is complete, the new version receives 100% of the traffic.