Menyetel Parameter Penskalaan Otomatis dengan API Explorer
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Jika Anda menggunakan alat gcloud CLI untuk men-deploy aplikasi, seperti gcloud app deploy
, atau plugin terkait gcloud CLI untuk
Maven,
Gradle,
IntelliJ, atau
Eclipse,
Anda dapat menyetel parameter penskalaan otomatis berikut di file konfigurasi
app.yaml
:
min_instances
max_instances
target_throughput_utilization
target_cpu_utilization
Anda juga dapat menggunakan antarmuka pengguna API explorer untuk menetapkan parameter penskalaan otomatis:
Buka halaman
API explorer.
Di panel kanan di bawah label Cobalah API Ini, cari kotak teks nama
dan masukkan string nama aplikasi dalam format berikut:
apps/<YOUR-PROJECT-ID>/services/default/versions/<YOUR-VERSION-ID>
Ganti YOUR-PROJECT-ID
dengan project ID aplikasi Anda, dan
<YOUR-VERSION-ID>
dengan versi aplikasi yang Anda kirimi
permintaan. Gunakan string lainnya seperti yang ditunjukkan.
Di kotak teks updateMask, masukkan nama jalur objek .json
yang lengkap dari parameter yang Anda tetapkan, menggunakan nama updateMask
dari tabel di bawah:
Nama updateMask |
automatic_scaling.standard_scheduler_settings.max_instances |
automatic_scaling.standard_scheduler_settings.min_instances |
automatic_scaling.standard_scheduler_settings.target_cpu_utilization |
automatic_scaling.standard_scheduler_settings.target_throughput_utilization |
Jika Anda menetapkan lebih dari satu parameter dalam satu permintaan, berikan nama samaran
untuk setiap parameter, yang dipisahkan dengan koma. Misalnya, jika Anda
menetapkan instance minimum dan maksimum, serta pemakaian CPU, gunakan
updateMask berikut:
automatic_scaling.standard_scheduler_settings.max_instances,
automatic_scaling.standard_scheduler_settings.min_instances,
automatic_scaling.standard_scheduler_settings.target_cpu_utilization
Dalam kotak Isi permintaan, klik Tambahkan parameter isi permintaan .
Pilih automaticScaling.
Klik balon petunjuk (ikon +
), lalu pilih standardSchedulerSettings.
Klik balon petunjuk, lalu pilih parameter scheduler penskalaan otomatis
yang diinginkan dan masukkan nilai yang dikehendaki.
Untuk mengisi parameter scheduler penskalaan otomatis lainnya, klik lagi balon petunjuk,
pilih parameter, dan masukkan nilainya.
Contoh berikut menunjukkan contoh isi permintaan yang terisi:
{
"automaticScaling": {
"standardSchedulerSettings": {
"maxInstances": 100,
"minInstances": 1,
"targetCpuUtilization": 0.75
}
}
}
Klik Jalankan. Anda mungkin diminta untuk memberikan otorisasi pada API Explorer saat pertama kali
menjalankannya. Jika diminta, berikan otorisasi pada API Explorer dengan mengikuti
perintahnya.
Pastikan setelan yang tepat telah diterapkan dengan membuka halaman versi App Engine untuk project Anda, dan mengklik Lihat di kolom Konfigurasi. Anda akan melihat nilai yang baru saja ditetapkan.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-09-04 UTC.
[[["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-09-04 UTC."],[[["\u003cp\u003eYou can configure autoscaling parameters (\u003ccode\u003emin_instances\u003c/code\u003e, \u003ccode\u003emax_instances\u003c/code\u003e, \u003ccode\u003etarget_throughput_utilization\u003c/code\u003e, \u003ccode\u003etarget_cpu_utilization\u003c/code\u003e) for your application using the gcloud CLI or related plugins within your \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe API Explorer can also be used to set autoscaling parameters, requiring you to enter your application's project ID, version, and the desired parameter's \u003ccode\u003eupdateMask\u003c/code\u003e name.\u003c/p\u003e\n"],["\u003cp\u003eTo set multiple autoscaling parameters via the API Explorer, you must list each parameter's full \u003ccode\u003e.json\u003c/code\u003e path name in the \u003ccode\u003eupdateMask\u003c/code\u003e field, separating them by commas.\u003c/p\u003e\n"],["\u003cp\u003eAfter executing the changes in the API Explorer, you can confirm that the correct settings have been applied by checking the configuration of your app's version in the App Engine versions page.\u003c/p\u003e\n"]]],[],null,["# Setting Autoscaling Parameters with the API Explorer\n\nIf you use the gcloud CLI tooling to deploy your app, such as\n`gcloud app deploy`,\nor gcloud CLI-related plugins for\n[Maven](/appengine/docs/legacy/standard/java/using-maven),\n[Gradle](/appengine/docs/legacy/standard/java/using-gradle),\n[IntelliJ](/tools/intellij/docs), or\n[Eclipse](/eclipse/docs),\nyou can set the following autoscaling parameters in the\n`app.yaml` configuration file:\n\n- `min_instances`\n- `max_instances`\n- `target_throughput_utilization`\n- `target_cpu_utilization`\n\nYou can also use the API explorer user interface to set an [autoscaling parameter](/appengine/docs/legacy/standard/java/config/appref#scaling_elements):\n\n1. Open the [API explorer\n page](/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch).\n\n2. In the right panel under the label *Try This API* , locate the **name**\n text box and enter the application name string in the following format:\n\n apps/\u003cYOUR-PROJECT-ID\u003e/services/default/versions/\u003cYOUR-VERSION-ID\u003e\n\n Replace `YOUR-PROJECT-ID` with your application's project ID, and\n `\u003cYOUR-VERSION-ID\u003e` with the version of the app you are sending the request\n to. Use the rest of the string as shown.\n3. In the **updateMask** text box, enter the full `.json` object path name of the\n parameter you are setting, using `updateMask` names from the table below:\n\n If you are setting more than one parameter in one request, supply the mask\n name for each parameter, separated by a comma. For example, if you are\n setting the min and max instances, and the CPU utilization, use the\n following updateMask: \n\n automatic_scaling.standard_scheduler_settings.max_instances,\n automatic_scaling.standard_scheduler_settings.min_instances,\n automatic_scaling.standard_scheduler_settings.target_cpu_utilization\n\n4. In the **Request body** box, click **Add request body parameters** .\n\n5. Select **automaticScaling**.\n\n6. Click the hint bubble (the `+` icon), then select **standardSchedulerSettings**.\n\n7. Click the hint bubble, then select the desired auto scaling scheduler\n parameter and supply the desired value.\n\n8. To supply another auto scaling scheduler parameter, click the hint bubble\n again, select the parameter, and supply its value.\n\n The following example shows a sample filled out request body: \n\n {\n \"automaticScaling\": {\n \"standardSchedulerSettings\": {\n \"maxInstances\": 100,\n \"minInstances\": 1,\n \"targetCpuUtilization\": 0.75\n }\n }\n }\n\n9. Click **Execute**. You may be prompted to authorize API Explorer the first\n time you run this. If you are prompted, authorize API Explorer by following the\n prompts.\n\n10. Confirm that the correct settings have been applied by opening the\n [App Engine\n versions page](https://console.cloud.google.com/appengine/versions) for your project, and clicking **View** in the\n *Config* column. You should see the values you just set."]]