Python 2.7 已終止支援,並將於 2026 年 1 月 31 日
淘汰。淘汰後,您將無法部署 Python 2.7 應用程式,即使貴機構先前曾使用機構政策重新啟用舊版執行階段的部署作業,也無法部署。現有的 Python 2.7 應用程式在
淘汰日期過後,仍會繼續執行並接收流量。建議您
改用系統支援的最新 Python 版本。
透過 API Explorer 設定自動調度資源參數
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如果您是使用 gcloud CLI 工具部署應用程式,例如 gcloud app deploy
,可以在 app.yaml
設定檔中設定下列自動調度資源參數:
min_instances
max_instances
target_throughput_utilization
target_cpu_utilization
您也可以使用 API Explorer 使用者介面設定自動調度資源參數:
開啟 API Explorer 頁面。
在右側面板中的「Try This API」(試用這個 API) 標籤下找出「name」(名稱) 文字方塊,並按照以下格式輸入應用程式名稱字串:
apps/<YOUR-PROJECT-ID>/services/default/versions/<YOUR-VERSION-ID>
將 YOUR-PROJECT-ID
改為應用程式的專案 ID,並將 <YOUR-VERSION-ID>
改為要接收要求的應用程式版本。字串的其餘部分則無須修改。
在「updateMask」文字方塊中,使用下表的 updateMask
名稱輸入待設定參數的完整 .json
物件路徑名稱:
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 |
如要在單一要求中設定多項參數,請提供各項參數的遮罩名稱,並以半形逗號分隔。舉例來說,如果您要設定執行個體數量下限和上限,以及 CPU 使用率,請使用下列 updateMask:
automatic_scaling.standard_scheduler_settings.max_instances,
automatic_scaling.standard_scheduler_settings.min_instances,
automatic_scaling.standard_scheduler_settings.target_cpu_utilization
在「Request body」(要求主體) 方塊中,按一下 [Add request body parameters] (新增要求主體參數)。
選取 [automaticScaling]。
按一下提示說明圖示 (+
圖示),然後選取 [standardSchedulerSettings]。
按一下提示說明圖示,選取要使用的自動調度資源排程器參數,然後提供所需的值。
如要提供其他自動調度資源排程器參數,請再次點選提示圖示,選取參數,然後提供所需的值。
以下是填寫完畢的要求主體範例:
{
"automaticScaling": {
"standardSchedulerSettings": {
"maxInstances": 100,
"minInstances": 1,
"targetCpuUtilization": 0.75
}
}
}
按一下 [Execute] (執行)。首次執行時,系統可能會提示您為 API Explorer 授予相關權限。如果收到提示,請按照指示為 API Explorer 授予權限。
開啟專案的 App Engine「Versions」(版本) 頁面,然後按一下「Config」(設定) 資料欄中的 [View] (查看),確認已套用正確的設定。您應該會看到剛剛設定的值。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eYou can configure autoscaling parameters for your application using the \u003ccode\u003egcloud app deploy\u003c/code\u003e command and specifying values in the \u003ccode\u003eapp.yaml\u003c/code\u003e file for \u003ccode\u003emin_instances\u003c/code\u003e, \u003ccode\u003emax_instances\u003c/code\u003e, \u003ccode\u003etarget_throughput_utilization\u003c/code\u003e, and \u003ccode\u003etarget_cpu_utilization\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe API explorer user interface allows for the configuration of autoscaling parameters by specifying the \u003ccode\u003eupdateMask\u003c/code\u003e names such as \u003ccode\u003eautomatic_scaling.standard_scheduler_settings.max_instances\u003c/code\u003e and corresponding values in the request body.\u003c/p\u003e\n"],["\u003cp\u003eTo update multiple parameters using the API explorer, you must include each parameter's \u003ccode\u003eupdateMask\u003c/code\u003e name separated by commas within the \u003ccode\u003eupdateMask\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eAfter setting your parameters through the API explorer, you can confirm the new values have been correctly applied by viewing the \u003cem\u003eConfig\u003c/em\u003e column on the App Engine versions page for your project.\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`,\n\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/python/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."]]