Skip to main content

Select your location

Modernizing with Cloud Spanner — Google Cloud’s SQL Database with Global Scale

Jake Holmquist

When to choose Spanner over Cloud SQL… and how Spanner could be a more cost-effective option!

Cloud maturity and modernization efforts

Today, organizations large and small are modernizing at an accelerating pace. While most organizations’ application modernization approach focuses on replatforming, refactoring, or re-writing applications for the cloud, a frequently overlooked and sometimes missed opportunity is to consider how and where the data that supports those applications is stored. At the heart of any modernization project is data, and how your data is secured, organized, and accessed plays a critical role in the success of digital transformation and modernization efforts.

Google Cloud provides a number of options for hosting your applications’ data in the cloud - from lift-and-shift options such as migrating your relational SQL database from on-premise servers to a similarly configured Computer Engine instance, to fully-managed and cloud-native solutions such as Cloud SQL and Cloud Spanner. When choosing a database option, it’s important to consider the effort that will be required to preserve vs transform what you are attempting to modernize. Organizations with a high level of Cloud Maturity will choose to direct resources and efforts towards transformation instead of preserving how things were hosted on premise. These organizations not only operate more efficiently, they are also more agile and have the ability to manage change more effectively.

In this article, we’ll explore Cloud Spanner as an option for organizations seeking to transform how and where their data is stored to accelerate their modernization efforts.

Cloud Spanner


Cloud Spanner is Google Cloud’s fully managed, cloud-native relational database with unlimited scale, strong consistency, and up to 99.999% availability. Compared to options such as Google’s fully managed Cloud SQL offerings or the lift-and-shift option to run your SQL database in Google Compute Engine, Cloud Spanner had long been considered the “most expensive” due to its ability to scale globally and how it managed and automated the underlying infrastructure.

With the general availability (GA) of granular instances, Cloud Spanner offers all of the benefits of a massively scalable relational SQL database for business-critical applications at a price that any user can now afford with an entry point as low as ~$65/mo.

Granular Instances

In June, Google announced the general availability of Cloud Spanner granular instances. Granular instances enable users to run a production workload in Spanner starting at as low as ~$65/month. For more granular control to provision and use database compute capacity, Google has introduced “processing units ”. One Spanner node is equal to 1,000 processing units. Customers can now provision in batches of 100 processing units, and get a proportionate amount of compute and storage resources. This will allow customers to run smaller workloads on Spanner at a much lower cost. With this feature, customers can start at 100 processing units and scale up as needed in batches of 100 processing units, to up to 1,000 processing units (1 node), all with zero downtime. Subsequently, customers can continue to scale up by adding more nodes, just like what they do today.

Customers who take advantage of the committed use discounts for Cloud Spanner that Google announced in March can save even more! Spanner committed use discounts provide deeply discounted prices in exchange for your commitment to continuously use Spanner compute capacity (as measured in nodes or processing units) for a one or three year period. One-year commitment provides a 20% discount whereas a three-year commitment provides a 40% discount!

TL;DR — with a 3yr committed use discount, the price of entry to Cloud Spanner is less than $40/mo.

Compare Cloud Spanner to Cloud SQL

To compare Cloud Spanner with Cloud SQL, it’s important to note a few of the key differences. Cloud Spanner includes just about everything you would expect from an enterprise-grade relational database — schemas, SQL queries, and ACID transactions — battle-tested and ready to scale for both reads and writes globally. While customers with existing applications that connect to a PostgreSQL database would benefit from making use of PostgreSQL interface on Spanner, it’s important to note that Spanner is not fully backwards compatible with the traditional open-source SQL databases and lacks a few legacy features such as triggers and stored procedures. Instead, business logic implemented by database-level stored procedures and triggers should be moved into the application empowering developers and power users to manage business logic.

Zonal vs. Regional

By default, Spanner is a regional service spread across 3 zones with exactly 3 read-write replicas, which means that Spanner has built-in HA from the start. Cloud Spanner can be deployed as a regional or multi-regional configuration.


Regional instance configuration

Cloud SQL, on the other hand, is a zonal service and can be deployed in as few as 1 zone. To get a level of high availability, enabling HA in Cloud SQL will make it a regional service across 2 zones.

 

Cloud SQL - High availability

Comparing costs

It’s true that Cloud SQL can cost less than Cloud Spanner since Cloud SQL can be deployed in a single zone, but it’s very unlikely that you’d see that configuration in a production environment. Instead, you will most commonly see Cloud SQL deployed in an HA configuration. 

Let’s explore the costs associated with Cloud SQL and Cloud Spanner — first getting a sense of what Cloud SQL would costs to run in a single zone, then comparing a production-ready configuration of Cloud SQL with HA enabled (Regional with 2 zones) and Cloud Spanner (Regional with 3 zones). We’ll use the basic “db-standard-1” instance type for Cloud SQL and the entry-level “100 Processing Units” for Cloud Spanner. For both instances, we’ll assume 100GB for the database and 2x or 200GB for backups.

Cloud SQL for PostgreSQL - Pricing calculator
Google Cloud pricing calculator: https://cloud.google.com/products/calculator

The entry-level configuration for a zonal Cloud SQL instance will cost approximately to $82/mo. In order to compare apples-to-apples with Cloud Spanner, we’ll add the HA option.

 

Cloud SQL for PostgreSQL - Pricing calculator with HA option
Cloud Spanner - Pricing calculator

Once we add the HA option to Cloud SQL to make it regional, the cost jumps to ~$148/mo. A similarly configured regional Cloud Spanner instance costs ~$115/mo. As you can see, in this scenario, Cloud Spanner may be a better option!

When to choose each option?

Cost is only one factor when deciding on which database option to use for your application. To really understand which option is best, we need to look at each use case to determine what’s most important.

Developing New Applications

When developing new applications, focus on cloud-native solutions that require the least amount of management — like Cloud Spanner. While Cloud Spanner can scale globally, we’ve just shown how it can also be a cost-effective option for even the smallest application.

Migrating Applications

When you are migrating applications from on-premise to the Cloud, the pace at which you can complete the migration may be important. In these cases, modifications to existing applications might delay the migration and require extra upfront work. This is where you might choose to migrate your database to Cloud SQL first, then consider a modernization project to move pieces of your application to Cloud Spanner later.

Is Cloud Spanner right for you?

Whether you are ready to fully modernize your applications and data right away, or would benefit from a phased approach of shifting workloads to the cloud and modernizing in place, consider Cloud Spanner as a way to not only meet your current needs, but position your organization to be ready for what’s ahead.

Kin + Carta is a Google Premier Partner recognized by Google for specializing in Application Development and expertise in Enterprise Database Migrations. Our Cloud and Platforms team is ready to help accelerate your organization’s cloud maturity efforts by modernizing your applications and data on Google Cloud.

Ready to modernize with Cloud Spanner?

Get in touch

Share this article

Show me all