Are Google Cloud SQL costs keeping you up at night? Perhaps you have already heard of the Committed Use Discounts (CUDs) for Cloud SQL that could drastically reduce your SQL bill, but you don’t know how to accurately estimate the savings potential? There is a tool that makes it quick & easy to quantify how much you will save by purchasing Cloud SQL CUDs and exactly how much you should commit to— so let’s jump into it.
What are Cloud SQL CUDs?
For those unfamiliar with Committed Use Discounts, or CUDs: They are a means by which to obtain deeply discounted compute power in a particular GCP region in exchange for committing to pay for 24/7 usage of that regional compute resource for either a one- or three-year term, paid on a no-upfront, monthly basis. You must pay for the quantity of Compute you committed to regardless of whether or not you use it, making CUDs appropriate only when you are certain a particular workload will bring a consistent, heavy load.
CUDs were originally limited to Compute Engine, however, the same principles were recently brought over to Cloud SQL.
How do CUDs work?
When you purchase a Cloud SQL commit, it works the same as a Compute Engine commitment: You commit to using a specific quantity of CPUs and GBs of RAM. This method of Compute commitment works favorably for GCP users as it allows you to be flexible in how your commitment is used. You could, for example, use the entirety of a 100 CPU and 400 GB memory commitment via a single high-powered database, or you could instead spread usage across 50 smaller 2 CPU, 8 GB databases — the cost savings will be the same.
All Cloud SQL machine types, with the exception of the shared CPU machine types (e.g. db-f1-micro and db-g1-small), can be used to apply your commitment, so if a newer generation Cloud SQL machine type were released during your commitment you could upgrade your databases to this latest machine type and continue to utilize your existing commitment discount so long as you continue to consume the same quantity of CPU and memory.
Overall, GCP’s CUD methodology is less restrictive than other cloud providers where you are forced to commit to using a specific machine type and size, and the desired quantity of that machine, for the duration of your commitment.
CUD Savings Potential
Cloud SQL CUD pricing as of August 2020 is as follows: Paying for a one-year commitment yields a 25% discount off on-demand pricing, while a three-year commitment yields a 52% discount. This discount can apply to any Cloud SQL database types (MySQL, PostgreSQL, and SQL Server), but it is critical to note that CUDs only apply to the number of CPUs and the amount of memory you committed to — CUDs do not apply towards costs incurred from storage, networking, or (for SQL Server) licensing. Example prices are shown below for SQL Server in default and high availability (HA) configuration:
While the pricing scheme seems straightforward at first, calculating this for a production environment can be seriously challenging. You may have multiple Cloud SQL instances spanning multiple regions. Each leader node may have multiple read replicas that scale up and down over time as demand for your services spikes and wanes. You may have developers provisioning temporary testing & development Cloud SQL instances. All of these factors cause intermittent cost fluctuations that make it difficult to determine your baseline spend.
If you were to use your end-of-the-month Cloud SQL bill to estimate your required Cloud SQL CPU and RAM commitment, you will likely over-provision and spend more than is required for your true day-to-day baseline operational costs. Ideally, you should be able to explore your hourly Cloud SQL usage over an extended period of time, broken down by region, and with that exploratory data quickly quantify your baseline usage and spend.
Cloud SQL CUD Eligibility Report
Exclusive to DoiT International customers as part of our Cloud Management Platform, we offer Cloud Reports, an interactive, exploratory means for rapidly deciphering cloud costs. As the DoiT FAQ so eloquently puts it, Cloud Reports offer “instant visibility into your Google Cloud costs without having to spend agonizing hours scanning through your bills.”
While building your own custom reports spanning one or more GCP services is straightforward and easy, commonly utilized default reports are also provided, among which is the “Cloud SQL CUD Eligible Consumption” report. This displays your hourly Cloud SQL CUD-eligible spend (CPU and RAM usage) per-region.
For the following DoiT customer, us-central1 Cloud SQL CUD spend peaks near $28 / hr, however, they should provision CPU and RAM quantities closer to the historical baseline amounts used when costs are around $23 / hr, unless they expect to sustain $28 / hr worth of usage for the next 1 to 3 years:
Looking at another DoiT customer with Cloud SQL machines spanning 10 regions, it is easy to see how complex an estimation of per-region Cloud SQL CUDs can become.
Trying to determine CUDs for each region for the following example would be disastrously error-prone and result in over- and under-provisioning for regions if you based the CUD estimates solely off of the total monthly Cloud SQL billing cost. There are largely regional, daily variations in Cloud SQL spend that must be known and understood in order to accurately determine the appropriate baseline CPU & RAM usage for regional CUDs:
To determine the hourly breakdown for how many CPUs and how many GBs of RAM were used, simply click on Customize, then switch out the following:
- Metric from “Cost” to “Usage”
- View As option from “Area Spline” to “Table”
- Drag “Unit” down as a Breakout Dimension to separate out CPU usage from RAM usage
Without the usage of DoiT’s Cloud Reports to explore data, determining an appropriate Cloud SQL CUD for each region of a global deployment would take weeks of custom monitoring solution development and data review to achieve. Avoiding this approach to accuracy and instead quickly guesstimating usage based on a monthly bill is more than likely to result in over-provisioning CUDs and thus significantly raising your cloud costs for your 1- to 3-year commitment term.
What to do next
Interested in saving on your Cloud SQL spend by quickly identifying baseline usage levels and using that as the basis for a Committed Use Discount?
Reach out to DoiT International to find out how you can take advantage of Cloud Reports to rapidly achieve Cloud SQL cost savings! It could be well worth your while.