Storing Data in Java
The App Engine environment provides multiple options to store data for your application:
App Engine Datastore: A schemaless object datastore with automatic caching, a sophisticated query engine, and atomic transactions.
Google Cloud SQL: A relational SQL database for your App Engine application, based on the familiar MySQL database.
Google Cloud Storage: A storage service for objects and files up to terabytes in size, and accessible to App Engine apps via the Google Cloud Storage client library.
Name | Structure | Consistency | Cost |
|---|---|---|---|
App Engine Datastore | Schemaless | Strongly consistent except when performing global queries. | The App Engine Datastore offers a free quota with daily limits. Paid accounts offer unlimited storage, read, and write operations. More information is available on the Datastore Quotas page. |
Google Cloud SQL | Relational | Strongly consistent | Google offers two billing plans for Google Cloud SQL: Packages and Per Use. More information is available in the Cloud SQL price sheet. |
Google Cloud Storage | Files and their associated metadata | Strongly consistent except when performing list operations that get a list of buckets or objects. | There are no charges associated with making calls to Google Cloud Storage. However, any data stored in Google Cloud Storage is charged the usual Google Cloud Storage data storage fees. |
Alternative storage solutions are also available, but they have been superseded by the options listed above.
App Engine Datastore
App Engine Datastore is a schemaless object datastore providing robust, scalable storage for your application, with the following features:
Highly reliable and covered by the App Engine SLA.
ACID transactions.
Advanced querying features.
High availability of reads and writes.
Strong consistency for reads and ancestor queries.
Eventual consistency for all other queries.
You can access Datastore using the low-level API described throughout the Datastore documentation, which provides direct access to all of Datastore's features, or you can use one of the higher-level open-source APIs for Datastore that provide ORM-like features and a more abstract experience, such as Objectify.
Read more about App Engine Datastore on the App Engine Datastore API documentation page.
Google Cloud SQL
Google Cloud SQL is a web service that allows you to create, configure, and use relational databases that live in Google's cloud. It is a fully-managed service offering the capabilities of a MySQL database, allowing you to focus on application development.
To get started using Google Cloud SQL, read the Google Cloud SQL with App Engine SDK documentation.
Google Cloud Storage
Google Cloud Storage is useful for storing and serving large files. Additionally, Cloud Storage offers the use of access control lists (ACLs), the ability to resume upload operations if they're interrupted, and many other features. The Google Cloud Storage client library makes use of this resume capability automatically for your app, providing you with a robust way to stream data into Google Cloud Storage.
There are no charges associated with making calls to Google Cloud Storage. However, any data stored at Google Cloud Storage is charged the usual data storage fees, which are listed on the Cloud Storage price sheet.
Applications connect to Google Cloud Storage using the Google Cloud Storage Client Library. To get started, read the Google Cloud Storage Client Library Getting Started Guide for Java.
Alternative Storage Solutions
The following solutions are supported by App Engine, but they have been superseded by the options listed above.
Blobstore API: Google Cloud Storage is recommended over using the Blobstore API.