Instances Processing Requests Unevenly

Sometimes instances on App Engine handle incoming requests very oddly. Here’s an example (this is a screenshot of the Instances page in the admin console):

As you can see, the first instance has processed over 40,000 requests within the last 2 hours 18 minutes. The second instance has only processed 7 requests, despite the fact that it has been running for over an hour. Notice also how the first instance has a much higher QPS and a slightly higher memory footprint compared to the second instance.

Changing Front End Instance Classes

App Engine allocates a certain amount of RAM and processing power to your application. Specific sizes of memory and processing power are called instance classes. You can increase the amount of resources allocated to your app by moving to a higher instance class as shown below.

First, go to the administration console and click the Application Settings link:

Go down to the Performance section and find the dropdown box marked Frontend Instance Class.

Select the instance class you need. Note that selecting a higher instance class will cost you more money/deplete your free instance hours faster.

Save your settings by clicking the Save button.

Error Code 202

On high traffic App Engine applications, you may occasionally see a request fail with error code 202. You’ll see the following text in your logs:

A problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. (Error code 202)

The request log will look similar to the picture below:

Error code 202 is an internal App Engine failure code: an unknown error occurred within App Engine or its associated services, not from your application. This is not an error that your application can catch or recover from, nor is the application at fault for this error. The current request will fail, but the client is free to retry the request. If this request is from the task queue service, the task queue will automatically retry the request if you set the appropriate settings while creating the task.

A note about error codes: the code 202 relates to App Engine; it is NOT a HTTP status code. When a request encounters this internal error, it fails with the HTTP status code 500 (as you can see from the above picture).

App Engine Default Server Error Page

When your application encounters an error, App Engine will shut down the request causing the error and return the following text to the user:

Error: Server Error

The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it.

The server error page will look similar to the following:

This error page is not the full error report; to see the actual error, you need to go to the Logs section of your App Engine application and find the error log. Here’s some pictures to help you find the error log:

First, go to your application dashboard and click the Logs link:

Click on the radio button marked Logs with minimum severity and choose Error from the dropdown box:

The logs page will automatically update to show all requests that failed.