When the time to launch a new feature has come, you may want to test it live, in production, with a small fraction of your audience, to see how users will react, if they adopt it, or if they encounter issues with this features. This is A/B testing: a fraction of a population sees your application in a certain state (with your new feature), while the rest of the users see the application as usal (without the feature).
Another situation is when a new feature might have an impact on performance, on some resource consumption, and you want to do a progressive rollout to cope with that impact. In this case again, you might wish to make a release of your application in a piecemeal fashion, by dispatching users to one or the other version of your application.
When you develop and deploy applications for Google App Engine, like Snapchat or Angry Birds do, you can take advantage of traffic splitting to do your A/B testing or progressive rollout. You can decide to split your user traffic across multipe versions of your application at the same time, via an IP address based splitting logic, via Cookies, or randomly.
Traffic splitting via the Console
From the Console, in the App Engine section, go to the “Versions” menu item, click on the “Split traffic” button (with the split arrow). Then you can select the versions of your application across which to split traffic, as well as the splitting mode (IP address, Cookie, or Random), and define the percentage of traffic each version should receive.
Traffic splitting via the gcloud CLI
gcloud CLI, you can use the following subcommand:
gcloud app services set-traffic [MY_SERVICE] \ --splits [MY_VERSION1]=[VERSION1_WEIGHT],[MY_VERSION2]=[VERSION2_WEIGHT] \ --split-by [IP_OR_COOKIE]
gcloud app services set-traffic \ --splits 3=.1,2=.9 \ --split-by cookie