Skip to content

Google Cloud SQL Migration

Wilson Kurniawan edited this page May 22, 2022 · 1 revision
  • Priority: Very High
  • Knowledge required: Back-end development/testing, database tuning, database management
  • Status: Ongoing

TEAMMATES use Google Cloud Datastore ("Datastore") as its database. This is however not a conscious design decision; rather, it is a forced decision due to the state of Google App Engine at its infancy.

Since then, Google Cloud Platform has massively expanded its offering of databases, and ever since our upgrade to Google App Engine second generation runtime, we are no longer constrained to (solely) use Datastore anymore.

After a thorough cost-benefit analysis, we have concluded that using Google Cloud SQL ("Cloud SQL") has far more benefits compared to the incurred costs:

  • TEAMMATES' data model is highly structured, relational, and cascaded. NoSQL is not the right database model from the beginning.
  • SQL has far more capabilities and is far less restrictive than Datastore (e.g. JOINs, transactions, more flexible compound indexes).
  • SQL has far more dev support (e.g. offline prints, online resources, StackOverflow) compared to Datastore.
  • Datastore has terrible backup support; Cloud SQL supports scheduled, automatic backup at no cost (other than storage).

At the same time, we will not forget the incurred costs:

  • Cloud SQL uses a machine resource-based pricing model, compared to Datastore's usage-based pricing model.
    • Cloud SQL's basic running cost will be far higher than that of Datastore, but Cloud SQL's variable cost will be near zero.
      • There can be times whereby Cloud SQL's monthly cost is lower than Datastore, but it is only expected during peak usage periods.
    • It is far less feasible for contributors to set up their own staging server using Cloud SQL, at least due to the regular incurred cost.
      • At the same time, contributors will then be free to use SQL database configured somewhere else, at a possibly lower to no cost.
  • The burden is shifted to us to set up the right configurations for Cloud SQL (e.g. machine resources, replica, network settings).
  • We need to be more wary of related security issues, e.g. SQL injection.