6

A working guide to understanding Google Compute Engine Pricing Options — Part 3

 3 years ago
source link: https://rominirani.com/a-working-guide-to-understanding-google-compute-engine-pricing-options-part-3-7c0883681a7b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

A working guide to understanding Google Compute Engine Pricing Options — Part 3

In the previous part, we took a look at Custom Machine Types in Google Compute Engine and how you could provision a VM as per your specific vCPU / RAM requirements and save on the cost.

In this article, we are going to look at how you can save a lot more of the list price of a VM via what are know as Preemptible Virtual Machines. We will also understand more importantly, where you can ideally use this type of a VM.

What is a Preemptible Virtual Machine?

I would like to present the definition via two points:

  • This is an instance that you can get at a much lower price.
  • This is an instance that can be stopped if Compute Engine requires the infrastructure for some other tasks.

Having defined the above, it means that these instances which could be stopped any time , at-least once across a 24 hour period, should not be used for any kind of workload. You cannot use this instance for a customer facing website or a critical workload that is not designed to survive an instance stopping, etc.

As a result, it is best suited for batch processing or fault tolerant jobs, where the Preemptible Virtual Machines (PVMs) are part of a cluster. Think of Big Data clusters, where the frameworks are fault-tolerant , can distribute their workloads across instances and can tolerate a few instances going up and down. It can be well suited to a Managed Instance Group too.

I won’t go too much into the finer aspects of how you will be notified if a PVM is going to be preempted, how to write a shutdown script to handle that for some work to be done before the VM terminates, etc. You should read up on all those details over here. Google Cloud has also published a set of best practices to reduce your chances of getting preempted, interesting … isn’t it?

GCP Calculator for PVM Pricing

Let’s continue with the example that we have been using so far for provisioning a n1-standard-1 instance type (1 vCPU and 3.75 GB RAM). Launch the GCP Calculator https://cloud.google.com/products/calculator and use the following:

# instances : 1
What for? : Server-1
OS : Free
Series : N1
Machine Type : n1-standard-1
Region : Mumbai

This comes to our standard pricing that we saw earlier as shown below:

1*9Cp-jNGQqYG1QR2ryB3FMw.png?q=20
a-working-guide-to-understanding-google-compute-engine-pricing-options-part-3-7c0883681a7b

Remember that I have chosen 24 hours per day and 7 days a week as running time for this instance.

Now, let’s see the cost if we go for a Preemptible version of the above. Go with the same settings, except that in the GCP Calculator, you will see a field called “Machine Class”. Click on that dropdown and select Preemptible instead of Regular.

1*TFWTd0G356dYbsr1vy3ogw.png?q=20
a-working-guide-to-understanding-google-compute-engine-pricing-options-part-3-7c0883681a7b

With all the other settings remaining the same, the pricing comes to:

1*iAG0CRfF8aPVKj3H7XCj5A.png?q=20
a-working-guide-to-understanding-google-compute-engine-pricing-options-part-3-7c0883681a7b

See the big difference in cost? Use this knowledge and the fact that if you have fault tolerant workloads that are run across cluster of VMs, you could save tons of $$$ using PVMs. Just make sure that you understand the tradeoffs that are mentioned in the documentation.

Conclusion

I would like to highlight that there are a lot more things to consider from a total cost perspective, when provisioning a Virtual Machine and not just list price. My goal was to help you understand the list prices via the Google Cost Calculator and for you to better understand the following terms:

  • Sustained Use Discounts
  • Committed Use Discounts
  • Custom Machine Types
  • Preemptible Virtual Machines

Hope this series was useful to you. Look forward to any feedback and some lessons that you have learnt while juggling with these options.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK