Search code examples
google-cloud-datastoredatastore

Google Cloud Datastore: Is multitenancy bringing any performance benefits?


I can't find anything related to performance considerations when it comes to choosing a multitenant architecture with Cloud Datastore

  • Is there any performance gain when you have a namespace per tenant vs having all tenants sharing the same namespace since all the properties are indexed anyways?
  • are the entities within the same namespace collocated?
  • is there any gain when the amount of data grows large?

Solution

  • We don't consider the namespace with respect to sharding across regions, the app id (s~app_name) is the entire prefix used to determine splitting/replication, and appid data is kept within the same geo as the ~ prefix; in this case America (s~). All entities/namespaces will have similar performance characteristics under that appid.

    No gain as the Datastore grows.

    tl;dr Namespaces are a mechanism to simplify your multi-tenant management and are a feature of the SDK. They also help with selective export. They of course allow scoping of the queries (for data segregation between tenants), but composite indexes are shared among all namespaces.