Google Cloud has announced adding geo-partitioning to Spanner, its fully-managed, globally distributed database. According to the company, this new feature aims to improve performance and user experience for geographically dispersed applications and users while optimizing operational costs.
Spanner’s geo-partitioning is currently in preview. Spanner users can partition table data at the row level across various global locations. Despite the data being split into different partitions, Spanner maintains a single cohesive table for queries and mutations, ensuring seamless data management.
Jerene Yang, a senior engineering manager at Google, wrote in a LinkedIn post:
This is many years in the making. Imagine a database where rows can live in different geographical locations, where you can specify the location with just a value in the column, and yet you can perform transactions and complex queries.
The benefits are reduced latency, as geo-partitioning improves network latency by placing data closer to users, resulting in faster response times and lower costs as customized database configurations align costs with actual usage, for example, allocating more resources to partitions serving a more significant number of users.
Under the hood, the feature works as follows:
- Geo-partitioning distributes a single table across multiple configurations, bringing data closer to users while maintaining centralized table benefits
- Users can partition some or all tables, allowing specific placement rules at the row level
- Application requests are routed to the relevant partitions containing the requested data
Nitin Sagar, a senior product manager, provides an example in a Google blog post on the geo-partitioning feature:
As shown in the diagram below, your different data partitions can be configured with different numbers of nodes based on the specific requirements—reads, writes, and storage—of the data that your partition serves. This helps you optimize your costs for an asymmetrical distribution of players.
Geo-partitioning example (Source: Google blog post)
Richard Seroter, a chief evangelist at Google, tweeted:
Geo-partitioning in Spanner allows you to partition your table data at the row-level, across the globe, to serve data closer to your users ... Spanner still maintains all your distributed data as a single cohesive table for queries and mutations.
Lastly, other globally distributed databases, like Spanner, offer similar geo-partitioning features. CockroachDB, for example, supports geo-partitioning within the same logical instance of the database, and Yugabyte has techniques for building cloud-native geo-distributed SQL applications with low latency. Both databases can store and process data in a region closest to the user, optimizing costs for asymmetrical global workloads and reducing write and robust read latency.