Compute Engine 並行作業配額

本文說明 Compute Engine 的並行作業配額。

並行作業配額

並行作業配額定義了任何時間點可進行的進行中或並行作業數量。凡是建立、修改或刪除 Compute Engine 資源的 API 要求,都必須通過並行作業限制檢查,確保任何時間點的進行中作業總數不會超過該作業的指定限制。

超出並行作業限制錯誤

如果專案超出任何進行中作業的並行作業限制,您會收到 403 錯誤,原因為 rateLimitExceeded

錯誤的 API 回應如下所示:

    "error": {
      "code": 403,
      "message": "Rate Limit Exceeded",
      "errors": [
        {
          "message": "Rate Limit Exceeded",
          "domain": "usageLimits",
          "reason": "rateLimitExceeded",
        ...
        ...
        }
      ],
      "details": [
        {
          "@type": "type.googleapis.com/google.rpc.ErrorInfo",
          "reason": "CONCURRENT_OPERATIONS_QUOTA_EXCEEDED",
          "domain": "compute.googleapis.com",
          "metadata": {
            "containerType": "PROJECT",
            "containerId": "PROJECT_ID",
            "quotaMetric": "QUOTA_METRIC",
            "quotaLimit": "QUOTA_LIMIT",
            "operationType": "OPERATION_TYPE",
            "location": "global | REGION"
          }
        },
        {
          "@type": "type.googleapis.com/google.rpc.Help",
          "links": [
            {
              "description": "Concurrent operations quota documentation.",
              "url": "https://cloud.google.com/compute/operations-quota#concurrent_operation_limits"
            }
          ]
        },
      ...
      ... 

錯誤詳細資料包含下列值:

  • PROJECT_ID:配額超出限制的專案 ID。

  • QUOTA_METRIC:超出限制的並行配額指標。可以是下列其中一項:

    • compute.googleapis.com/global_concurrent_operations
    • compute.googleapis.com/regional_concurrent_operations
  • QUOTA_LIMIT:並行配額的限制名稱。 可以是下列其中一項:

    • GlobalConcurrentOperationsPerProject
    • GlobalConcurrentOperationsPerProjectOperationType
    • RegionalConcurrentOperationsPerProject
    • RegionalConcurrentOperationsPerProjectOperationType
  • OPERATION_TYPE:配額超出限制的全球或區域作業。如需作業清單,請參閱「並行作業配額群組」。

  • location 可以是下列其中一項:

    • global:指定超出全域作業配額限制
    • REGION:指定作業配額超出限制的地區

詳細錯誤記錄只會透過 API 回應傳回。記錄檔探索工具中的錯誤類似於下列內容:

   "protoPayload":{
    "@type": "type.googleapis.com/google.cloud.audit.AuditLog",
    "status": {
      "message": "Rate Limit Exceeded"
    }
    "serviceName": "compute.googleapis.com",
    "methodName": "METHOD_NAME",
    ...
    ...
    "response": {
      "error": {
        "message": "Rate Limit Exceeded",
        "code": 403,
        "errors": [
          {
            "message": "Rate Limit Exceeded",
            "reason": "rateLimitExceeded",
            "domain": "usageLimits"
          }
        ]
      },
      "@type": "type.googleapis.com/error"
    },
    ...
    ... 

錯誤訊息中的 METHOD_NAME 代表超出速率限制的 API 方法。例如:v1.compute.instances.stop

並行作業配額群組

本節說明各種 Compute Engine 進行中或並行作業的限制。

全球作業配額

並行全域作業會耗用專案中為作業類型指定的全域限制。下表列出進行中作業的全球配額和對應指標。

您可以使用 Trusted Cloud 控制台、Google Cloud CLI 和 Service Usage API,查看全域作業的配額。詳情請參閱「查看並行作業配額和限制」。

配額名稱
說明
指標名稱 消耗這項配額的方法
Concurrent global operations per project
限制專案的並行全域作業總數。

在 Trusted Cloud 控制台中查看這項配額

compute.googleapis.com/global_concurrent_operations

所有全域方法。

這些方法的 HTTP 要求網址包含 global。舉例來說,networks.insert 方法:
POST /compute/v1/projects/{project}/global/networks

Concurrent global operations per project operation type
限制每個專案的並行作業數量 (依作業類型)。

在 Trusted Cloud 控制台中查看這項配額

compute.googleapis.com/global_concurrent_operations

所有全域方法。

根據預設,每個專案的並行作業配額為 500 個進行中的作業,但下列方法除外,這些方法有不同的預設限制:

globaladdresses.move

firewalls.delete

firewalls.insert

images.delete

images.deprecate

images.insert

images.patch

images.setLabels

images.setIamPolicy

licenses.insert

machineimages.delete

machineimages.insert

networks.addPeering

networks.removePeering

networks.updatePeering

projects.setCommonInstaneMetadata

publicAdvertisedPrefixes.delete

publicAdvertisedPrefixes.insert

routes.delete

routes.insert

securityPolicies.patchRule

snapshots.delete

snapshots.insert

snapshots.setLabels

snapshots.setIamPolicy

snapshotSettings.patch

區域作業配額

並行區域作業會耗用指定區域中每個專案的作業類型區域限制。

下表列出進行中作業的區域配額和對應指標。

您可以使用 Trusted Cloud 控制台、Google Cloud CLI 和 Service Usage API,查看區域作業的配額。詳情請參閱「查看並行作業配額和限制」。

配額名稱
說明
指標名稱 消耗這項配額的方法
Concurrent regional operations per project
限制專案的並行區域作業總數。

在 Trusted Cloud 控制台中查看這項配額

compute.googleapis.com/regional_concurrent_operations

所有區域性方法。

這些方法的 HTTP 要求網址包含 regionszones
舉例來說,instances.insert 方法:
POST /compute/v1/projects/{project}/zones/{zone}/instances

Concurrent regional operations per project operation type
限制每個專案的並行區域作業數量 (按作業類型)。

在 Trusted Cloud 控制台中查看這項配額

compute.googleapis.com/regional_concurrent_operations

所有區域性方法。

根據預設,每個專案在每個區域的進行中作業配額為 500,但下列方法除外,這些方法有不同的預設限制:

addresses.move

disks.insert

instances.delete

instances.insert

instances.simulateMaintenanceEvent

networkEndpointGroups.attachNetworkEndpoints

networkEndpointGroups.detachNetworkEndpoints

publicDelegatedPrefixes.delete

publicDelegatedPrefixes.insert

查看並行作業配額和限制

如要查看專案的配額用量和限制,請按照下列步驟操作:

主控台

  1. 前往 Trusted Cloud 控制台的「Quotas」(配額) 頁面。

    前往配額頁面

    「配額」頁面會列出專案的所有配額用量和限制。根據預設,清單會依照您最常用的配額進行排序,方便您查看有超過上限之虞的項目。

  2. 如要篩選清單,並查看任何特定配額的使用量和限制,請在「篩選條件」欄位中選取「配額」或「指標」

    舉例來說,選取配額 Concurrent global operations per project operation type 即可查看各作業類型的全域方法配額用量。

    如要篩選特定作業的配額,請在篩選查詢中新增「維度」,然後選取「operation_type」。舉例來說,選取 firewalls_insert 即可查看 firewalls.insert 作業的配額用量和限制。

gcloud

您可以使用 Google Cloud CLI 查看並行作業配額的用量和限制。

如要使用這個方法,請確認您已安裝 alpha 指令元件。如果您使用 Cloud Shell 與 Trusted Cloud by S3NS互動,系統會為您安裝 Google Cloud CLI。

如要查看配額,請使用下列指令:

gcloud alpha services quota list \
    --service=compute.googleapis.com \
    --consumer=projects/PROJECT_ID

PROJECT_ID 替換為要查看配額的專案 ID。

最佳做法

以下檢查清單彙整了減少並行作業限制不足錯誤的最佳做法:

後續步驟