Cost savings with Spot instances

When we are talking about the cloud, its on-demand instances are actually cheap already. However, in the long run, the price of using cloud instances will be similar to buying real machines. To solve this pricing problem, major cloud providers, such as Amazon EC2, and Google Cloud Platform, provide a new instance type, collectively called a Spot instance in this book:

Figure 7.7: Comparison of shutdown signals of a Spot instance on AWS versus Google Cloud

Spot instances are far cheaper than on-demand instances. However, their weak point is the short life cycle and unexpected termination. That is, a Spot instance could be terminated at any time. When it is gone, you have a choice as to whether to preserve or completely discard the volumes. On AWS, the instance will get the notification around 120 seconds before termination via remote metadata, while on Google Cloud, the notification will be sent via an ACPI signal 30 seconds before the machine stops. The rough comparison is shown in the previous figure.

We could put stateless computing to run on these kinds of instances. Both microservices and functions are naturally stateless, so Spot instances fit with the deployment of microservices and functions nicely.

With this kind of infrastructure on cheap instances, its cost will be comparable to AWS Lambda or Google Cloud Functions, but we are more in control of the overall system, meaning no invocation timeout for functions on this kind of infrastructure.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset