Don’t forget Spot Instances on AWS

For those with an attention span of 30 seconds: Spot Instances on AWS are not a curiosity. Seriously consider using Spot Instances on AWS wherever possible, even if you need the instance all the time. Yes. All the time. Carry on reading if you like or jump to the conclusions towards the end.

I previously demonstrated that if you can guarantee that you are going to use an AWS EC2 instance for more than 24% of the time (over a 3 year period) then you should absolutely be using reserved instances. This happens to be very close to 8 hours per day, 5 days per week, 52 weeks per year; highlighting that in fact On Demand instances are probably not your starting point.

This begged the question: when to use a Spot Instance? Let’s have go at answering that question, if not conclusively but at least provide more information to help make that decision.

The first question to ask is: given a certain bid price, then what percentage of the time can I actually get an instance at that price? This will help answer questions like: how often is the spot price actually less than the On Demand and Reserved Instance Price? If the answer is “hardly ever” then we can probably forget about them. It seems the answer is better than that.

Pulling down the spot price history for the main instance types in the EU region and then calculating the percentage of time spent below a specific price reveals a common pattern:

image

Figure 1 Spot bid price and percentage yield (availability)

It would seem that there is a discontinuity in the relationship at about 66%. Indicating, for example, that if your need for compute is less than 66% of the time then it would appear that you can get a good price for it. The question is, how does this compare with Reserved and On Demand instances. Let’s zoom in on the m1.large instance in the EU:

image

Figure 2 The cost of EU m1.large instances at different levels of utilisation

Be clear how to read this chart – it answers questions such as: if you were to run an instance for 50% of the time, what would the Reserved Instance price be and what price would I need to bid for Spot Instances to guarantee that level of utilisation.

The above chart shows, again, how 3 Year Reserved Instances become more economical than On Demand at >24% utilisation and 1 yr Reserved Instances at >47%. It also shows the asymptotic line of Reserved Instance pricing as utilisation drops towards 0% – i.e. they rapidly become several times more expensive than On Demand instances below 10% utilisation. Not surprising, because at 0% utilisation you have paid the upfront fee for no compute time.

Let’s zoom in and see where the lines intersect:

image

Figure 3 Cost of EU m1.large instances at different levels of utilization – zoomed in on intersections

Interestingly if we were looking for 92% utilisation we could set the Spot Price as high as a 1 yr Reserved Instance price. Importantly, remember, the bid price would be the maximum you would pay. In reality a lot of the time the price paid would be much lower. Clearly setting the Spot price a smidgen higher than the On Demand price gives 100% utilisation but with the reality that you pay a lot less almost all the time!

According to this data if you set the Spot ceiling at $0.4 (c.f. $0.38 for On Demand) you would be given an instance 100% of the time, yet:

  • 0.013% of the time you would pay $0.02 more than the On Demand price – just over one hour per year. To all intents and purposes the Spot Instance will always cost less than On Demand.
  • In fact, 66% of the time you would pay less than half the On Demand price and the remaining 34% of the time you would be paying about 70% of the On Demand price. This translates to approximately $0.20 overall – half price.
  • Magically, running a Spot Instance 100% of the time costs about the same price as a 3yr Reserved Instance running 100% of the time…

So the next question is: if I do set the Spot ceiling so high that it runs for 100% of the time, and taking into account all the price fluctuations, what is the effective price paid and how does that compare with running On Demand or Reserved for 100%?

image

Figure 4 Running all instance types for 100% of the time for each of the pricing options (taking into account Spot fluctuations)

The above chart shows that even running Spot Instances 100% of the time (by setting the bid price sufficiently high) actually works out cheaper than 3 yr Reserved Instances running at 100%.

Conclusions and generalisations:

If you can deploy your application to run within Spot Instances, you can set the Spot price to the max Spot Price and run even more cheaply than the effective hourly rate of a 3yr Reserved Instance – without the need to venture anything upfront.

If you are really trying to push the cost-of-execution right down, then setting the Spot bid price to half the On Demand price will return a 66% yield. This will be 25% cheaper than 3yr Reserved Instances at 66% utilisation.

The gradient of the Spot Instance pricing lines shows that there is actually little incentive to set the bid price below the 66% utilisation point. Availability drops dramatically with little reward in price. In other words, you will get significantly less likelihood of being given an instance, a much higher chance of having it terminated abruptly, for very little gain in hourly price.

Remember, for EU m1.large, Reserved Instance Price states $0.16 but when you take in to account the $1400 up front then the effective hourly price never drops below $0.21 (100% utilisation). It is often stated that the Spot price never really drops below the Reserved Instance price – this is not true as we can see that it is less for 66% of the time.

Cautions:

This data is only based on 88 days of spot price history in the EU region.

@jamessaull

About these ads
  1. #1 by Michele Mazzucco on July 15, 2011 - 8:32 am

    Nice article.
    I have recently worked on how to deliver highly available services using “spot instances”. You can see a summary here http://cloud-computing-economics.com/business-benefits-applications/delivering-reliable-services-spot-instances/ and the full article here http://math.ut.ee/~mazzucco/papers/hpcc_2011.pdf

  2. #2 by percentage calculator on November 23, 2011 - 12:02 am

    Interesting article.
    There’s an interesting paper on how to deliver highly available services using “spot instances” by Michele Mazzucco
    You can grab it here: http://math.ut.ee/~mazzucco/papers/hpcc_2011.pdf

  1. Doing BI to hunt for Spot Price trends: only for low margin high scale tasks « Cloud Comments .net
  2. More Cloud Computing Economics « Cloud Comments .net
  3. Pricing is hard « Off the record - Craig Box

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: