Working with Quotas

Google Cloud Platform (GCP) enforces quotas on resource usage for project owners, setting a hard limit on how much of a particular GCP resource your project can use. There are two types of resource usage that we limit with quota:

  • Rate quota such as API requests per day. This quota resets after a specified time, such as a minute or a day.
  • Allocation quota such as the number of virtual machines or load balancers used by your project. This quota does not reset over time but must be explicitly released when you no longer want to use the resource, for example by deleting a GKE cluster.

Quotas are enforced for a variety of reasons: for example, they protect the community of GCP users by preventing unforeseen spikes in usage. Quotas also help you with resource management: for instance, you can set your own caps on service usage within your Google-provided quota while developing and testing your applications. Each quota limit is expressed in terms of a particular countable resource, from requests per day to an API to the number of load balancers used by your application.

Not all projects have the same quotas for the same services. If you are using a free trial account to explore the platform, for example, you may have very limited quota. Higher quotas for some services are available only after you have enabled billing for your project. As your use of Google Cloud Platform expands over time, your quotas may increase accordingly. You can also request more quota if you need it, and set up monitoring and alerts in Stackdriver to warn you about unusual quota usage behavior or when you're running out of quota.

This page describes how to work with quotas in your projects, including how to find and modify your existing quota limits, how to request higher quota, and how to monitor quota usage.

Viewing your quota

There are two main ways to view your current quota limits in the Google Cloud Console:

  • Using the Quotas page, which gives you a list of all your project's quota usage and limits.

  • Using the console, which gives you quota information for a particular API, including resource usage over time.

In addition, some services offer command line access to quota and resource usage information. For example, Compute Engine lets you access quota information using gcloud compute.

You can find out how to monitor your quota usage in Monitoring quota metrics below.

Viewing all project quotas

To view quotas (quota usage and limits) for all resources in your project, do the following:

  1. Go to the GCP Console Quotas page in IAM & admin.
  2. From the projects list, select a project or create a new one. The Quotas page for the selected project is displayed, listing one line item for each type of quota available in each service.
  3. (Optional) Sort and filter the results to find the information you need:

    • Use the filters at the top of the page to adjust the list by Quota type, Service, Metric, and/or Location.
    • By default the list is sorted to show your most used quota first (in terms of peak usage over the last seven days), helping you see limits that are at risk of being exceeded. You can toggle to show the least used first by selecting the 7 Day Peak Usage arrow.

The list also shows your Current Usage of a particular quota. For allocation quota, your current usage is simply how much of the resource you're currently using. For per day rate quota, it is the usage so far in the current day. For per minute or per 100 seconds rate quota, it is the average usage in the past 24 hours.

You can find out more about quotas for a specific service and what they mean in their own documentation: for example, Compute Engine quota is documented in Resource Quotas.

API-specific quota

To view more detailed quota information for a particular API, including usage over time, visit the API's quota page in the console. Depending on the API, these limits may include requests per day, requests per minute, and requests per minute per user. Some APIs set very low limits until you enable billing on your project.

To view the current limits for a particular API, do the following:

  1. Go to the GCP Console APIs & Services Dashboard page.
  2. From the projects list, select a project or create a new one.
  3. Click the name of the API you're interested in.
  4. Click Quotas. The quota names and corresponding limits for your chosen API are displayed on the Quotas page. By default these limits are those imposed by Google: if you want to specify a lower limit, you can find out how to do so in Capping usage. If there is no Google-imposed limit on a given quota, the limit is displayed as Unlimited.

Not all quotas appear on an API-specific quota page. For instance, requests to the Compute Engine API have an API-specific quota page, but this does not include Compute Engine compute resource usage (allocation quota). In addition, if you are using the service in multiple locations, the API-specific quota page doesn't show regional or zonal quota limits and their usage. For a complete list of your project's quota (which also lets you filter by location), see the project Quotas page.

Managing your quota

Depending on your resource usage, you may want to adjust your project's quota limits up or down. This section describes how to change your provided quota limits.

Requesting higher quota

You can request a quota change for most billable services with a quota limit, as follows:

  1. In the Quotas page, use the checkboxes to select one or more quotas to edit, then click EDIT QUOTAS. Billing must be enabled on the project in order to click the checkboxes.
  2. In the Edit Quotas panel on the right, complete the form with your Name, Email , and Phone details, then click Next.
  3. In the Edit Quotas panel, select the service to expand the view, then edit the quotas in that service to your requested limit. Click Done.
  4. Repeat to edit the quotas in each of the selected services.
    • A service with an alert icon (error) has not yet been edited or a field has not been filled in.
    • You can add more quotas to edit by selecting them from the list on the left.
    • You can remove a service from the Edit Quotas panel by clicking the delete icon (delete).
  5. When you are done editing quotas, click Submit request.

GCP quota requests are usually processed quickly, within two business days. You should receive an email confirmation for your request from GCP support. Should you need further assistance, you can respond to that email. Note that large quota increases can take a longer time to be approved.

Capping usage

You might want to limit usage of a particular resource by setting your own quota limits. For example, to prevent getting billed for usage beyond the free courtesy usage limits, you can set requests per day caps. The simplest way to cap quota is to edit the limits on the API-specific quota page.

  1. Go to the API-specific quota page for the API whose usage you want to cap.
  2. On the quota line you want to change, click the edit icon (edit), then enter your preferred total quota, up to the limit specified by Google.
  3. Click Save to save your changes.

If you want to cap quota that doesn't appear on this page, or you want to set a higher limit than the provided maximum, you must edit your limits following the Edit Quota process described in Requesting higher quota.

Monitoring quota metrics

In addition to viewing basic quota information in the Google Cloud Console, GCP lets you monitor quota usage, limits and errors in greater depth using the Stackdriver API and UI, with quota metrics appearing in the Metrics Explorer. You can then use these metrics to create custom dashboards and alerts, letting you monitor quota usage over time and receive alerts when, for example, you are near a quota limit.

Stackdriver supports a wide variety of metrics, which you can combine with filters and aggregations for new and insightful views into your quota usage. For example, you can combine an allocation quota usage count metric with a quota_metric filter on Cloud TPUs.

Go to the Metrics Explorer

To see quota metrics in Metrics Explorer, first select Consumer Quota as the resource type. Then select Allocation quota usage or Rate quota usage to monitor quota usage for allocation or rate quota. You can then optionally use the filter and aggregation options to further refine your data. Once you've found the quota usage information you want, you can use Stackdriver to create custom dashboards and alerts that will help you continue to monitor and maintain a robust application. Similarly, to see quota limits or exceeded errors, first select Consumer Quota as the resource type and then select Quota limit or Quota exceeded error. You can find out how to do this in the following pages:

You can find a detailed reference for quota metrics in the Stackdriver Monitoring documentation.

Quota errors

If your project exceeds a particular quota while using a service, the platform will return an error.

In general, GCP will return a HTTP 429 error code if you're using HTTP/REST to access the service, or ResourceExhausted if you're using gRPC. How this error appears to you is service-dependent.

If you're using Stackdriver, you can use it to identify the quota associated with the error and then create custom alerts upon getting a quota error, as described in Monitoring quota metrics. Note that the quota error metric is only available as a selection in Stackdriver custom dashboards once a project has quota exceeded errors.

Czy ta strona była pomocna? Podziel się z nami swoją opinią:

Wyślij opinię na temat...