Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Migrasi traffic mengalihkan pemilihan rute permintaan antar-versi dalam
layanan aplikasi Anda, sehingga memindahkan traffic dari satu atau beberapa versi ke
satu versi baru.
Traffic akan langsung dimigrasikan antar-versi Anda di lingkungan fleksibel. Tidak seperti versi di lingkungan standar, migrasi traffic bertahap tidak didukung di lingkungan fleksibel.
Jika Anda segera memigrasikan traffic ke versi baru tanpa instance yang berjalan, aplikasi Anda akan mengalami lonjakan latensi saat instance sedang dibuat. Anda dapat menghindari lonjakan latensi dengan menggunakan App Engine Admin API untuk menyediakan instance versi aplikasi baru yang memadai sebelum memigrasikan traffic ke versi tersebut.
Tetapkan minTotalInstances untuk versi baru ke nomor yang diperlukan untuk menangani ekspektasi traffic. Setelah migrasi selesai, Anda dapat mereset kolom ini agar penskalaan otomatis terjadi jika traffic menurun.
Anda dapat membagi traffic antar-versi aplikasi, sehingga meningkatkan jumlah traffic yang diterima suatu versi secara bertahap.
Untuk mengetahui informasi tentang cara memisahkan traffic antara dua versi aplikasi atau lebih, lihat Pemisahan Traffic.
Sebelum memulai
Sebelum Anda dapat mengonfigurasi traffic ke versi tertentu, pastikan akun pengguna menyertakan hak istimewa yang diperlukan.
Memigrasikan traffic ke versi baru
Konsol
Untuk memigrasikan traffic di Google Cloud console, buka halaman Versions:
Pilih versi mana yang 100% traffic-nya ingin Anda migrasikan.
Klik Migrate traffic.
Opsional: Saat warmup request diaktifkan, traffic Anda akan dimigrasikan secara bertahap. Untuk segera memigrasikan traffic, pilih opsi di bagian Show advanced options.
Untuk memigrasikan traffic secara terprogram, Anda dapat menggunakan Admin API. Baca artikel Memigrasikan dan Memisahkan Traffic untuk mengetahui detailnya.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-11 UTC."],[[["\u003cp\u003eTraffic migration in the flexible environment allows you to immediately switch request routing from one or more versions of your application to a single new version.\u003c/p\u003e\n"],["\u003cp\u003eTo prevent latency spikes, provision sufficient instances of the new version using the App Engine Admin API before migrating traffic, and set \u003ccode\u003eminTotalInstances\u003c/code\u003e accordingly.\u003c/p\u003e\n"],["\u003cp\u003eTraffic can be migrated using the Google Cloud console, the \u003ccode\u003egcloud app services set-traffic\u003c/code\u003e command, or programmatically through the Admin API.\u003c/p\u003e\n"],["\u003cp\u003eGradual traffic migration is an option through the use of the \u003ccode\u003emigrate\u003c/code\u003e flag or the enabling of warmup requests, and can be configured from the console or through the \u003ccode\u003egcloud\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eEnsure your user account has the necessary privileges to configure traffic before you begin migrating traffic to a new version.\u003c/p\u003e\n"]]],[],null,["# Migrating traffic\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nTraffic migration switches the request routing between the versions within a\nservice of your application, moving traffic from one or more versions to a\nsingle new version.\n\nTraffic is migrated immediately between your versions in the\nflexible environment. Unlike versions in the standard environment,\n[gradual traffic migration](/appengine/docs/standard/migrating-traffic)\nis not supported in the flexible environment.\n\nIf you immediately migrate traffic to a new version without any running\ninstances then your app will have a spike in latency while instances are being\ncreated. You can avoid a spike in latency by using the\n[App Engine Admin API](/appengine/docs/admin-api) to provision\nsufficient instances of the new app's version before you migrate traffic to it.\n\nSet [`minTotalInstances`](/appengine/docs/admin-api/reference/rest/v1/apps.services.versions#automaticscaling)\nfor the new version to the number needed to handle expected traffic. After\nmigration is complete, you can reset this field so that autoscaling occurs\nif traffic drops.\n\nYou can split traffic between versions of your app, increasing the amount of\ntraffic a version receives in stages.\n\n\nFor information about splitting traffic between two or more versions of your\napp, see [Traffic Splitting](/appengine/docs/flexible/splitting-traffic).\n\nBefore you begin\n----------------\n\nBefore you can configure traffic to a version, ensure that your user account\nincludes the [required privileges](/appengine/docs/flexible/access-control#basic_roles).\n\nMigrating traffic to a new version\n----------------------------------\n\n### Console\n\nTo migrate traffic in the Google Cloud console, go to the Versions page:\n\n[Go to Versions](https://console.cloud.google.com/appengine/versions)\n\n1. Select the version to which you want to migrate 100% of the traffic.\n2. Click **Migrate traffic**.\n3. Optional: When warmup requests are enabled your traffic is migrated gradually. To migrate traffic immediately, select the option under the **Show advanced options** section.\n\n### gcloud\n\nAfter installing the [Google Cloud CLI](/sdk/docs), you run the [`gcloud\napp services set-traffic`](/sdk/gcloud/reference/app/services/set-traffic)\ncommand to migrate 100% of traffic to a single version. For example:\n\n- To migrate traffic immediately: \n\n ```bash\n gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1\n ```\n- To gradually migrate traffic, you include the optional `--migrate` flag: \n\n ```bash\n gcloud app services set-traffic [MY_SERVICE] --splits [MY_VERSION]=1 --migrate\n ```\n\n### API\n\nTo programmatically migrate traffic, you can use the Admin API,\nsee [Migrating and Splitting\nTraffic](/appengine/docs/admin-api/migrating-splitting-traffic) for details."]]