The Best Solutions for Running a Database on Google Cloud Platform

0
339

Google’s Cloud Platform offers many solutions for modernizing your existing database infrastructure. By moving to the cloud, and taking advantage of Google’s PaaS offerings, you can reduce the headache of database administration.

Cloud SQL

Cloud SQL is Google’s alternative to AWS’s RDS—a simple managed database solution for MySQL, SQL Server, and PostgreSQL.

Rather than having to configure the database yourself, it’s all handled for you and manageable from the Cloud SQL Console. You’ll still access the database from your client applications as normal, but you won’t have to worry much about updates, scalability, or availability.

Pricing for Cloud SQL is simple, you pay a flat fee per vCPU and GB of memory. Of course, it’s going to be more than Compute Engine’s base pricing, so it’s still cheaper to configure MySQL or Postgres on your own server. But, for many businesses, the benefits of having everything managed for you (including much less stress on your DBAs) will greatly outweigh the price increase.

If you’re using your resources consistently throughout a month, you will qualify for the Sustained Use Discount, which will lower the price significantly. Of course, this is also available on regular Compute Engine, but it’s worth keeping in mind when running the numbers.

Cloud Spanner

Cloud Spanner is also a managed SQL database, but it’s built for a different purpose.

Traditional SQL databases, like MySQL, have a common problem: They’re only vertically scalable. If your database needs more performance, the best option is to upgrade the underlying instance. This is an issue that most NoSQL databases solve by design.

With Cloud Spanner, Google has found the best of both worlds, and made a relational SQL-compatible database that can scale horizontally, easily managing global replication and consistency. Databases running on Cloud Spanner will be shared across multiple regions, with all writes synced up automatically. If you’re curious about how this works under the hood, you can read this write-up by The Data Guy.

If you’re set on a SQL database and want the absolute best solution possible, Cloud Spanner is your go-to option. Google uses it internally, and has battle-tested it with petabytes of data spread all around the world.

Of course, with features this fancy and maximum performance, it’s not cheap. You’re charged hourly for each “node” in the network, each of which provide up to 2 TB of storage and 10,000/2,000 read/write queries per second. Nodes start at $0.90 hourly for us-east1, so even with only one of them you’re looking at a monthly bill over $700. If you don’t care about running a global network of databases, stick to Cloud SQL.

Firebase/Firestore

Firebase is built to be an easy-to-use managed backend for your applications, with a particular focus on mobile applications. Firebase as a whole is an entire app development platform, with numerous useful features like authentication, analytics, performance and crash monitoring, and managed storage.

At its heart, though, is the Firebase Realtime Database, a NoSQL document database that’s built to enable real-time updates to clients subscribed over WebSockets. Real-time syncing of updates to database data makes collaboration between users easy, allowing for applications like Google Docs. Firestore is a similar feature, used for storing large objects like uploaded photos and videos in conjunction with the Realtime Database.

It’s entirely serverless, so you won’t have to worry at all about database administration or creating instances. As far as pricing goes, it has a generous free tier for small projects and development. After that, it’s pay as you go. You can use their calculator to estimate how much it will cost you.

If you want to learn more about Firebase, you can read our guide on getting started with it.

Memorystore

Redis and Memcached are in-memory databases, commonly used for storing small bits of data with high throughput and very low latency. Most databases will use memory as cache, but with Redis, everything is stored in RAM.

Memorystore is simply Google’s managed Redis and Memcached service, similar to Cloud SQL.

Pricing varies, depending on how much data you’re storing. For small deployments under 4GB, you’ll be paying $0.049 per GB, per hour. The hourly cost decreases for higher memory deployments.