Stay organized with collections Save and categorize content based on your preferences.
This API is supported for first-generation runtimes and can be used when upgrading to corresponding second-generation runtimes. If you are updating to the App Engine Java 11/17 runtime, refer to the migration guide to learn about your migration options for legacy bundled services. Data consistency levelsDatastore queries can deliver their results at either of two consistency levels:
In an eventually consistent query, the indexes used to gather the results are also accessed with eventual consistency. Consequently, such queries may sometimes return entities that no longer match the original query criteria, while strongly consistent queries are always transactionally consistent.
Datastore query data consistencyQueries return their results with different levels of consistency guarantee, depending on the nature of the query:
Fetching an entity by key, which is also called "lookup by key", is strongly consistent.
Setting the Datastore read policyTo improve performance, you can set the Datastore read policy so that all reads and queries are eventually consistent. (The API also allows you to explicitly set a strong consistency policy, but this setting will have no practical effect, since non-ancestor queries are always eventually consistent regardless of policy.)
You can also set the Datastore
call deadline, which is the maximum time, in seconds, that the application will wait for Datastore to return a result before aborting with an error. The default deadline is 60 seconds; it is not currently possible to set it higher, but you can adjust it downward to ensure that a particular operation fails quickly (for instance, to return a faster response to the user).
To set the Datastore read policy in Java, you construct a
Datastore service configuration(
DatastoreServiceConfig
), using the nested helper class
DatastoreServiceConfig.Builder
, and pass it an instance of class
ReadPolicy
. The following example shows how to set the read policy, the call deadline, or both:
What's next?Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This API supports first-generation runtimes and is relevant when upgrading to second-generation runtimes, while migration to Java 11/17 requires a separate migration guide."],["Datastore queries offer two consistency levels: strongly consistent queries, which guarantee the freshest results but may be slower, and eventually consistent queries, which are generally faster but may return stale results."],["Ancestor queries are strongly consistent by default but can be set to eventually consistent, while non-ancestor queries are always eventually consistent."],["The Datastore read policy can be set to eventually consistent to improve performance, and the call deadline can be adjusted to control the maximum wait time for a Datastore operation."],["Developers can use the `DatastoreServiceConfig` to set the read policy and/or the call deadline for Datastore operations, using the `ReadPolicy` for consistency and `withDeadline` for the time limit, and can use the `DatastoreServiceFactory` to get a `DatastoreService` instance with the desired configuration."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4