REGION_ID is a code that Google assigns based on
the region you select when you create your app. Including
REGION_ID.r in App Engine URLs is optional for
existing apps and will soon be required for all new apps.
To ensure a smooth transition, we are slowly updating App Engine to use region IDs. If we haven't updated your Google Cloud project yet, you won't see a region ID for your app. Since the ID is optional for existing apps, you don't need to update URLs or make other changes once the region ID is available for your existing apps.
Learn more about region IDs.
This document describes how your App Engine application receives requests and sends responses. For more details, see the Request Headers and Responses reference.
If your application uses services, you can address requests to a specific service or a specific version of that service. For more information about service addressability, see How Requests are Routed.
Your application is responsible for starting a webserver and handling requests. You can use any web framework that is available for your development language.
App Engine runs multiple instances of your application, and each
instance has its own web server for handling requests. Any request can be routed
to any instance, so consecutive requests from the same user are not necessarily
sent to the same instance. An instance can handle multiple requests
concurrently. The number of instances can be adjusted automatically as traffic
You can also change the number of concurrent requests an instance can handle
by setting the
element in your app.yaml file.
The server determines which PHP handler script to run by comparing the URL of
the request to the URL patterns in the app's
configuration file. It then runs the script populated with the request data. The
server puts the request data in environment variables and the standard input
stream. The script performs actions appropriate to the request, then prepares a
response and puts it on the standard output stream.
The following example is a PHP script that responds to any HTTP request with the message 'Hello World!'
<?php echo 'Hello, World!';
Quotas and limits
App Engine automatically allocates resources to your application as traffic increases. However, this is bound by the following restrictions:
App Engine reserves automatic scaling capacity for applications with low latency, where the application responds to requests in less than one second. Applications with very high latency, such as over one second per request for many requests, and high throughput require Silver, Gold, or Platinum support. Customers with this level of support can request higher throughput limits by contacting their support representative.
Applications that are heavily CPU-bound may also incur some additional latency in order to efficiently share resources with other applications on the same servers. Requests for static files are exempt from these latency limits.
Each incoming request to the application counts toward the Requests limit. Data sent in response to a request counts toward the Outgoing Bandwidth (billable) limit.
Both HTTP and HTTPS (secure) requests count toward the Requests, Incoming Bandwidth (billable), and Outgoing Bandwidth (billable) limits. The Cloud Console Quota Details page also reports Secure Requests, Secure Incoming Bandwidth, and Secure Outgoing Bandwidth as separate values for informational purposes. Only HTTPS requests count toward these values. For more information, see the Quotas page.
The following limits apply specifically to the use of request handlers:
|request size||32 megabytes|
|response size||32 megabytes|
|request timeout||depends on the type of scaling your app uses|
|maximum total number of files (app files and static files)||10,000 total
1,000 per directory
|maximum size of an application file||32 megabytes|
|maximum size of a static file||32 megabytes|
|maximum total size of all application and static files||first 1 gigabyte is free
$ 0.026 per gigabyte per month after first 1 gigabyte
Dynamic responses are limited to 32MB. If a script handler generates a response larger than this limit, the server sends back an empty response with a 500 Internal Server Error status code. This limitation does not apply to responses that serve data from Cloud Storage .
An incoming HTTP request includes the HTTP headers sent by the client. For security purposes, some headers are sanitized or amended by intermediate proxies before they reach the application.
For more information, see the Request headers reference.
Request responsesApp Engine calls the script with the
$_REQUESTarray populated, buffers any output from the script, and when the script completes execution, sends the buffered output to the end user.
There are limits that apply to the response you generate, and the response may be modified before it is returned to the client.For more information, see the Request responses reference.
App Engine does not support streaming responses where data is sent in incremental chunks to the client while a request is being processed. All data from your code is collected as described above and sent as a single HTTP response.
If the client sends HTTP headers with the original request indicating that the
client can accept compressed (gzipped) content, App Engine compresses
the handler response data automatically and attaches the appropriate response
headers. It uses both the
User-Agent request headers to
determine if the client can reliably receive compressed responses.
Custom clients can indicate that they are able to receive compressed responses
by specifying both
User-Agent headers with a value of
Content-Type of the response is also used to determine whether
compression is appropriate; in general, text-based content types are compressed,
whereas binary content types are not.
Specifying a request deadline
App Engine is optimized for applications with short-lived requests, typically those that take a few hundred milliseconds. An efficient app responds quickly for the majority of requests. An app that doesn't will not scale well with App Engine's infrastructure.A PHP script has a limited amount of time to generate and return a response to a request. Once the deadline has been reached, the
TIMEOUTbit on the connection status bitfield is set. Your script will then have a short second deadline to clean up any long running tasks and return a response to the user.
If your script hasn't returned a response by the second deadline, the handler is terminated and a default error response is returned.
LoggingThe App Engine web server captures everything the handler script writes to the standard output stream for the response to the web request. It also captures everything the handler script writes to the standard error stream, and stores it as log data. Log data for your application can be viewed in the Cloud Console using Cloud Logging.
App cachingThe PHP runtime environment includes the OPcache which can cache PHP intermediate code and significantly improve your application's response time. You can disable OPcache caching by setting
opcache.enabled = "0"in the application's php.ini file.