Google Datastore cross region replication

后端 未结 1 1340
孤城傲影
孤城傲影 2021-01-19 04:54

We have a app that is hosted in US and the EU. For great performance we will host a datastore instance on both locations.

Now is our question how we can replicate th

相关标签:
1条回答
  • 2021-01-19 05:37

    There is not such thing as multi-location GAE apps (at least not yet). The app's unique location can be selected when the app is created and cannot be changed. See App Engine - How to create project in region us-central and gae app moving to eu-datacenter or re-opening

    An important note from Creating a project and application:

    Important: Each Cloud Platform project can contain only a single App Engine application and you cannot change the region after you create the App Engine application.

    Now the datastore itself can only exist in a single cloud project, which also maps 1:1 to a location. From Google Cloud Datastore Locations:

    When you create a Google Cloud Platform project, you must choose a location where the project's data is stored. To reduce latency and increase availability, store your data close to the users and services that need it. You can create projects in the following locations:

    • europe-west — Western Europe
    • us-central — Central United States
    • us-east1 — Eastern United States
    • asia-northeast1 — Northeastern Asia-Pacific

    Both App Engine and Cloud Datastore are listed as products with Multi-Regional Coverage (see https://cloud.google.com/about/locations/). But that coverage is not global, it still remains contained within a region group. And US and EU are in different region groups, so this won't help you. From Multi-regional resources:

    The data associated with multi-regional resources is not tied to a specific region and can be moved between regions and regions can be added and removed from a region group. For example, buckets in the European Union location for Google Cloud Storage keep data at-rest inside the European Union, but at-rest data can be stored in or moved to any Cloud Storage region within the European Union (subject to terms of service and service specific terms).

    So at best you can have 2 different GAE apps deployed in 2 different regions, eventually from (almost) the same code.

    You need to take care of replicating the data across these apps yourself, for example by adding custom/dedicated communication between the apps for that purpose or by using the Remote API (each app acting like a client for the other app's remote API).

    Most likely not trivial, especially if the data consistency is important. In such case you might be better off with a single app and some performance penalty for some of your customers, based on their location.

    0 讨论(0)
提交回复
热议问题