Google App Engine

Google App Engine Architecture and Programming Support

How Google App Engine is built: applications, services, versions, and instances, how requests get routed, and which languages each environment supports.

On this page
  1. How App Engine’s architecture is organized
  2. How a request reaches your code
  3. The resource hierarchy
  4. How instances scale
  5. Standard and Flexible under the hood
  6. Programming support
  7. App Engine in the textbook cloud model
  8. Supporting services
  9. Common misconceptions
  10. Next steps

How App Engine’s architecture is organized

App Engine organizes everything into four levels: an application (one per Google Cloud project), its services, the versions of each service, and the running instances of each version. A request passes through Google’s front end and any routing rules before it reaches an instance of the right version. You deploy code and configuration, and the platform handles the rest.

How a request reaches your code

The chain below is a text diagram of the request path:

Client
  |
Google Front End (TLS and load balancing)
  |
App Engine routing (dispatch.yaml rules, if you have them)
  |
Service (for example: default, api)
  |
Version (for example: v1)
  |
Instance (runs your code)

The front end handles TLS and load balancing. Optional dispatch.yaml rules can send certain paths or hosts to a particular service. Each version runs one or more instances, and the platform decides how many based on your scaling settings.

The resource hierarchy

  • Application: one per Google Cloud project. Its region is chosen when you create it and cannot be changed later.
  • Services: formerly called modules. Each service has its own scaling settings, and the first service must be named default. Services in the same project share one region and one Datastore, so they are parts of one app, not separate apps.
  • Versions: each deployment creates a version. Old versions stay available until you delete them, and you can split traffic between versions.
  • Instances: the running copies of a version. App Engine creates and removes them based on the scaling type you choose.

Each service needs an app.yaml file. Optional configuration files include dispatch.yaml, cron.yaml, index.yaml, and queue.yaml.

How instances scale

App Engine offers three scaling types:

  • Automatic scaling adds and removes instances based on traffic. The Standard environment can scale to zero.
  • Basic scaling creates instances when requests arrive and shuts them down after a period without traffic.
  • Manual scaling keeps a fixed number of instances running.

Standard instances come in classes. The F classes (F1, F2, F4, F4_1G) are for frontend services that use automatic scaling. The B classes (B1 through B8) are for backend services that use basic or manual scaling.

Two more details matter for performance. App Engine can send warmup requests to /_ah/warmup so your code loads before real traffic arrives. Request timeouts also depend on the scaling type: 10 minutes for Standard automatic scaling, 24 hours for basic and manual scaling, and 60 minutes for Flexible.

Standard and Flexible under the hood

The two environments run code differently:

  • Standard runs your app in a sandbox. Second-generation runtimes use the gVisor sandbox, and they allow third-party libraries and outbound network access. Writes are limited to /tmp, which is held in memory.
  • Flexible runs your app in Docker containers on Compute Engine virtual machines behind Google’s load balancing. The VMs are restarted weekly for operating system patches, and you can connect to them over SSH.

The Standard vs Flexible comparison covers startup times, billing, and when each fits.

Programming support

Each environment supports a different set of languages:

  • Standard supports specific versions of Python, Java, Node.js, PHP, Ruby, and Go. Version numbers change over time, so check Google’s current runtime list before you start.
  • Flexible supports those languages and .NET. Because it runs containers, you can use any language or framework you can package in a Dockerfile.

App Engine launched in 2008 with Python only. Java, Go, and PHP were added in later years. Some of the older bundled APIs, such as the Users API and XMPP, are no longer the recommended way to build, so new code should use the Google Cloud client libraries.

App Engine in the textbook cloud model

Many cloud computing textbooks describe a platform in five layers: infrastructure, runtime environment, storage, application services, and compute services. App Engine’s legacy APIs map onto those layers, and most have modern replacements:

Layer App Engine legacy Modern equivalent
Infrastructure Managed by Google, not visible to you Still managed by Google; Flexible instances run on Compute Engine VMs
Runtime environment Standard and Flexible runtimes Same runtimes; Cloud Run for containers
Storage Datastore, Memcache, static file servers Firestore in Datastore mode, Memorystore, Cloud Storage
Application services URL Fetch, Mail, Images, Users Client libraries and Google Cloud APIs
Compute services Task Queues, Cron Cloud Tasks, Cloud Scheduler

App Engine does not require Datastore. Any Google Cloud database works, including Cloud SQL.

Supporting services

App Engine works with the rest of Google Cloud. Cloud Build builds your code during deployment. Cloud Logging and Cloud Monitoring show logs and metrics. Cloud Trace provides latency sampling and reporting for App Engine, including per-URL statistics. Secret Manager stores credentials, and IAM controls who can deploy and read data.

Common misconceptions

  • “App Engine requires Datastore.” It does not. Any Google Cloud database works.
  • “Services are separate apps.” They share one project, one region, and one Datastore.
  • “Flexible is Standard with more memory.” Flexible runs on full VMs with different billing and slower startup.
  • “XMPP and the Users API are current features.” Diagrams that show them as current are out of date.

Next steps

If you are starting out, the App Engine tutorial walks through a first deployment. If you are choosing between the two serverless options, App Engine vs Cloud Run compares them directly. The pricing guide covers how costs follow from the scaling choices above, and the Compute Engine explainer covers the IaaS option for comparison.

The complete guide to google app engine

Google App Engine Tutorial for Beginners
Read the guide

Keep exploring

Guides from other topics

All topics →