English
Skip to page content Skip to main navigation

e.g. "templates" or "datastore"

# Quotas

An App Engine application can consume resources up to certain maximums, or quotas. With quotas, App Engine ensures that your application won't exceed your budget, and that other applications running on App Engine won't impact the performance of your app.

Note: The free quota levels described below will change on May 25th, 2009 (90 days after February 24th, 2009). See Upcoming Changes to the Free Quotas below for more details. If your application requires higher quotas than the "billing-enabled" per-minute values listed below allow, you can request an increase.

- Billable Quotas and Fixed Quotas
- How Resources are Replenished
- Per-minute Quotas
- When a Resource is Depleted
- Monitoring CPU Usage in a Request
- Resources
  - Requests
  - Datastore
  - Mail
  - URL Fetch
  - Image Manipulation
  - Memcache
  - Deployments
- Upcoming Changes to the Free Quotas

## Billable Quotas and Fixed Quotas

Each App Engine resource is measured against one of two kinds of quota: a billable quota or a fixed quota.

Billable quotas are resource maximums set by you, the application's administrator, to prevent the cost of the application from exceeding your budget. Every application gets an amount of each billable quota for free. You can increase billable quotas for your application by enabling billing, setting a daily budget, then allocating the budget to the quotas. You will be charged only for the resources your app actually uses, and only for the amount of resources used above the free quota thresholds.

After you enable billing for your application, you can set your daily budget and adjust quota allocations for your app using the Admin Console. For more information about setting your budget and allocating quotas, see Billing.

Fixed quotas are resource maximums set by App Engine to ensure the integrity of the system. These resources describe the boundaries of the architecture, and all applications are expected to run within the same limits. They ensure that another app that is consuming too many resources will not affect the performance of your app.

When you enable billing for your app, the app's fixed quotas increase. See the Resources section for details.

## How Resources are Replenished

App Engine records how much of each resource an application uses in a calendar day, and considers the resource depleted when this amount reaches the app's quota for the resource. A calendar day is a period of 24 hours beginning at midnight, Pacific Time. App Engine resets all resource measurements at the beginning of each day, except for Stored Data which always represents the amount of datastore storage in use.

Historical note: The 24-hour replenishment cycle was introduced in December 2008. It replaced a more complicated system of "continuous" replenishment, to make it easier to report and control resource usage.

## Per-minute Quotas

In addition to the daily quotas described above, App Engine moderates how quickly an app can consume a resource, using per-minute quotas. This protects the app from consuming all of its quota in very short periods of time, and keeps other apps from affecting your app by monopolizing a given resource.

If your application consumes a resource too quickly and depletes one of the per-minute limits, the word "Limited" will appear by the appropriate quota on the Quota Details screen in the Admin Console. Requests for resources that have hit their per-minute maximum will be denied. See When a Resource is Depleted for details.

As with the daily fixed quotas, there are two levels of per-minute quotas, depending on whether billing has been enabled or not. See the quota tables in the Resources section for details.

## When a Resource is Depleted

When an app consumes all of an allocated resource, the resource becomes unavailable until the quota is replenished. This may mean that your app will not work until the quota is replenshed.

For resources that are required to initiate a request, when the resource is depleted, App Engine returns an HTTP 403 Forbidden status code for the request instead of calling a request handler. The following resources have this behavior:

- Requests
- CPU Time
- Bandwidth, incoming and outgoing

For all other resources, when the resource is depleted, an attempt in the app to consume the resource results in an exception. This exception can be caught by the app and handled, such as by displaying a friendly error message to the user. In the Python API, this exception is `apiproxy_errors.OverQuotaError`.

The following example illustrates how to catch the `OverQuotaError`, which may be raised by the `SendMessage()` method if an email-related quota has been exceeded:

    try:
      mail.SendMessage(to='test@example.com',
                       from='admin@example.com',
                       subject='Test Email',
                       body='Testing')
    except apiproxy_errors.OverQuotaError, message:
      # Log the error.
      logging.error(message)
      # Display an informative message to the user.
      self.response.out.write('The email could not be sent. '
                              'Please try again later.')

If you're going over your system resource quota unexpectedly, consider profiling your app's performance.

## Monitoring CPU Usage in a Request

A Python application can determine how much CPU time the current request has taken so far by calling the Quota API. This is useful for profiling CPU-intensive code, and finding places where CPU efficiency can be improved for greater cost savings. You can measure the CPU used for the entire request, or call the API before and after a section of code then subtract to determine the CPU used between those two points.

The `google.appengine.api.quota` package provides the `get_request_cpu_usage()` function. This function returns the amount of CPU resources that the current request has spent so far, as a number of megacycles. This number is proportional to the "CPU Time" quota measurement, but does not include the CPU speed multiplier. This number does not include CPU used by API calls.

In the development server, this function returns 0.

    import logging
    from google.appengine.api import quota

    start = quota.get_request_cpu_usage()
    do_something_expensive()
    end = quota.get_request_cpu_usage()

    logging.info("do_something_expensive() cost %d megacycles." % (start - end))

This function is not yet available for Java applications. It may be added in a future release.

## Resources

An application may use the following resources, subject to quotas. Resources measured against billable quotas are indicated with "(billable)." Resource amounts represent an allocation over a 24 hour period.

The cost of additional billable resources is listed on the Billing page.

### Requests

Requests
  The total number of requests to the app. The per-minute quotas for application with billing enabled allow for up to 500 requests per second--more than one billion requests per month. If your application requires even higher quotas than the "billing-enabled" values listed below, you can request an increase in these limits here.
Outgoing Bandwidth (billable)

  The amount of data sent by the app in response to requests.

  This includes data sent in response to both secure requests and non-secure requests, data sent in email messages, and data in outgoing HTTP requests sent by the URL fetch service.

Incoming Bandwidth (billable)

  The amount of data received by the app from requests.

  This includes data received by the app in secure requests and non-secure requests, and data received in response to HTTP requests by the URL fetch service.

CPU Time (billable)

  The total processing time for handling requests, including time spent running the app and performing datastore operations. This does not include time spent waiting for other services, such as waiting for a URL fetch to return or the image service to transform an image.

  CPU time is reported in "seconds," which is equivalent to the number of CPU cycles that can be performed by a 1.2 GHz Intel x86 processor in that amount of time. The actual number of CPU cycles spent varies greatly depending on conditions internal to App Engine, so this number is adjusted for reporting purposes using this processor as a reference measurement.

  One tool to assist you in identifying areas in the application which use high amounts of runtime CPU quota is the `cProfile` module. For instructions on setting up profiling while debugging your application, see "How do I profile my app's performance?".

  You can examine the CPU time used to serve each request by looking at the Logs section of the Admin Console. While profiling will assist in identifying inefficient portions of your Python code, it's also helpful to understand which datastore operations contribute to your CPU usage.

  - Writes to the datastore use roughly 5 times as much CPU as reads.
  - Writes that update indexes require more CPU than writes that do not.
  - As the number of properties associated with a given entity increases, so does the CPU time required to read and write that entity.
  - For the most part, queries are equally efficient, since all queries use indexes. However, fetching results requires additional CPU Time.
Secure Requests
  The number of requests that used a secure connection (HTTPS). Secure requests also count towards the Requests quota.
Secure Outgoing Bandwidth
  The amount of data send by the app over a secure connection in response to requests. Secure outgoing bandwidth also counts toward the Outgoing Bandwidth quota.
Secure Incoming Bandwidth
  The amount of data received by the app over a secure connection from requests. Secure incoming bandwidth also counts toward the Incoming Bandwidth quota.

Resource | Free Default Quota | Billing Enabled Quota
--- | --- | ---
Daily Limit | Maximum Rate | Daily Limit | Maximum Rate
Requests | 1,300,000 requests | 7,400 requests/minute | 43,000,000 requests | 30,000 requests/minute
Outgoing Bandwidth (billable, includes HTTPS) | 10 gigabytes | 56 megabytes/minute | 10 gigabytes free; 1,046 gigabytes maximum | 740 megabytes/minute
Incoming Bandwidth (billable, includes HTTPS) | 10 gigabytes | 56 megabytes/minute | 10 gigabytes free; 1,046 gigabytes maximum | 740 megabytes/minute
CPU Time (billable) | 46 CPU-hours | 15 CPU-minute/minute | 46 CPU-hours free; 1,729 CPU-hours maximum | 72 CPU-minute/minute

### Datastore

Datastore API Calls
  The total number of times the app retrieved, created, updated or deleted an entity, or performed a query.
Stored Data (billable)

  The amount of data stored in entities and corresponding indexes.

  It's important to note that data stored in the datastore may incur significant overhead. This overhead depends on the number and types of associated properties, and includes space used by built-in and custom indexes. Each entity stored in the datastore requires the the following metadata:

  - The entity key, including the kind, the ID or key name, and the key of the entity's parent entity.
  - The name and value of each property. Since the datastore is schemaless, the name of each property must be stored with the property value for any given entity.
  - Any built-in and custom index rows that refer to this entity. Each row contains the entity kind, any number of property values depending on the index definition, and the entity key. See How Index Building Works for more details.
Data Sent to API
  The amount of data sent to the datastore when creating or updating an entity, or performing a query.
Data Received from API
  The amount of data returned by the datastore when retrieving an entity or performing a query.
Datastore CPU Time
  The time spent performing datastore operations. Datastore CPU cycles also count toward the CPU Time quota. See CPU Time, above, for details on how CPU time is calculated.

Resource | Free Default Quota | Billing Enabled Quota
--- | --- | ---
Daily Limit | Maximum Rate | Daily Limit | Maximum Rate
Datastore API Calls | 10,000,000 calls | 57,000 calls/minute | 140,000,000 calls | 129,000 calls/minute
Stored Data (billable) | 1 gigabyte | None | 1 gigabytes free; no maximum | None
Data Sent to API | 12 gigabytes | 68 megabytes/minute | 72 gigabytes | 153 megabytes/minute
Data Received from API | 115 gigabytes | 659 megabytes/minute | 695 gigabytes | 1,484 megabytes/minute
Datastore CPU Time | 60 CPU-hours | 20 CPU-minutes/minute | 1,200 CPU-hours | 50 CPU-minutes/minute

### Mail

Mail API Calls
  The total number of times the app accessed the mail service to send an email message.
Recipients Emailed (billable)
  The total number of recipients to whom the app has sent email messages.
Admins Emailed
  The total number of application admins to whom the app has sent email messages.
Message Body Data Sent
  The amount of data sent in the body of email messages. This also counts toward the Outgoing Bandwidth quota.
Attachments Sent
  The total number of attachments sent with email messages.
Attachment Data Sent
  The amount of data sent as attachments to email messages. This also counts toward the Outgoing Bandwidth quota.

Resource | Free Default Quota | Billing Enabled Quota
--- | --- | ---
Daily Limit | Maximum Rate | Daily Limit | Maximum Rate
Mail API Calls | 7,000 calls | 32 calls/minute | 1,700,000 calls | 4,900 calls/minute
Recipients Emailed (billable) | 2,000 recipients | 8 recipients/minute | 2,000 recipients free; 7,400,000 recipients maximum | 5,100 recipients/minute
Admins Emailed | 5,000 mails | 24 mails/minute | 3,000,000 mails | 9,700 mails/minute
Message Body Data Sent | 60 megabytes | 340 kilobytes/minute | 29 gigabytes | 84 megabytes/minute
Attachments Sent | 2,000 attachments | 8 attachments/minute | 2,900,000 attachments | 8,100 attachments/minute
Attachment Data Sent | 100 megabytes | 560 kilobytes/minute | 100 gigabytes | 300 megabytes/minute

### URL Fetch

URL Fetch API Calls
  The total number of times the app accessed the URL fetch service to perform an HTTP or HTTPS request.
URL Fetch Data Sent
  The amount of data sent to the URL fetch service in requests. This also counts toward the Outgoing Bandwidth quota.
URL Fetch Data Received
  The amount of data received from the URL fetch service in responses. This also counts toward the Incoming Bandwidth quota.

Resource | Free Default Quota | Billing Enabled Quota
--- | --- | ---
Daily Limit | Maximum Rate | Daily Limit | Maximum Rate
UrlFetch API Calls | 657,000 calls | 3,000 calls/minute | 46,000,000 calls | 32,000 calls/minute
UrlFetch Data Sent | 4 gigabytes | 22 megabytes/minute | 1,046 gigabytes | 740 megabytes/minute
UrlFetch Data Received | 4 gigabytes | 22 megabytes/minute | 1,046 gigabytes | 740 megabytes/minute

### Image Manipulation

Image Manipulation API Calls
  The total number of times the app access the image service.
Data Sent to API
  The amount of data sent to the image service.
Data Received from API
  The amount of data received from the image service.
Transformations executed
  The number of times the service performed an image transformation for the app.

Resource | Free Default Quota | Billing Enabled Quota
--- | --- | ---
Daily Limit | Maximum Rate | Daily Limit | Maximum Rate
Image Manipulation API Calls | 864,000 calls | 4,800 calls/minute | 45,000,000 calls | 31,000 calls/minute
Data Sent to API | 1 gigabytes | 5 megabytes/minute | 560 gigabytes | 400 megabytes/minute
Data Received from API | 5 gigabytes | 28 megabytes/minute | 427 gigabytes | 300 megabytes/minute
Transformations executed | 2,500,000 transforms | 14,000 transforms/minute | 47,000,000 transforms | 32,000 transforms/minute

### Memcache

Memcache API Calls
  The total number of times the app accessed the memcache service to get, set or expire values.
Data Sent to API
  The amount of data sent to the memcache.
Data Received from API
  The amount of data received from the memcache.

Resource | Free Default Quota | Billing Enabled Quota
--- | --- | ---
Daily Limit | Maximum Rate | Daily Limit | Maximum Rate
Memcache API Calls | 8,600,000 | 48,000 calls/minute | 96,000,000 | 108,000 calls/minute
Data Sent to API | 10 gigabytes | 56 megabytes/minute | 60 gigabytes | 128 megabytes/minute
Data Received from API | 50 gigabytes | 284 megabytes/minute | 315 gigabytes | 640 megabytes/minute

### Deployments

Deployments
  The number of times the app has been uploaded by a developer.

## Upcoming Changes to the Free Quotas

On May 25th, 2009, along with many performance improvements, we will be reducing the free quota levels for the billable quotas. App Engine will always remain free to get started. We believe these new levels will continue to serve a reasonably efficient application around 5 million page views per month, completely free.

The new free quota levels to take effect on May 25th will be as follows:

- CPU Time: 6.5 hours of CPU time per day
- Bandwidth: 1 gigabyte of data transferred in and out of the application per day
- Stored Data & Email Recipients: unchanged

Several fixed quotas may also change on May 25th for applications without billing enabled. Fixed quotas for applications with billing enabled will not be affected.