AutoSpotting icon indicating copy to clipboard operation
AutoSpotting copied to clipboard

Ability to include randomness when calculating spot bid price

Open gabegorelick opened this issue 5 years ago • 2 comments

Github issue

Issue type

  • Feature Idea

Build number

master

Summary

AutoSpotting already features the ability to customize SpotPricePercentageBuffer to allow bidding relative to the current spot price. But bidding the same price for every spot instance in an ASG means a lot of your instances may get interrupted at the same time should the price increase. It would be nice if AutoSpotting included some configurable amount of randomness in the bid price for each instance. This way, instances would all be purchased at different rates, which would decrease the chances of them all becoming too expensive at the same time.

This can be mitigated by using a mix of different instance types and hoping their pricing curves differ enough such that they won't all exceed your threshold at the same time.

Steps to reproduce

  1. Set bidding policy to aggressive
  2. Notice AutoSpotting set all bid prices to 10% above spot price
  3. All instances get terminated at the same time when spot price rises 10%

Expected results

Instances get terminated slowly as prices change.

Actual results

Instances get terminated all at once.

gabegorelick avatar Jan 29 '20 23:01 gabegorelick

Great idea, thanks!

If you look at the spot pricing graphs since a couple of years ago there's basically just a daily correction of a very small increment.

In practice using the aggressive bidding policy makes little sense anymore, unless you actually want to trigger replacements in order to test some code paths.

We could determine that increment and instead of using a percentage we can bid a random times that value over the current spot price:

bid_price := current_price + daily_increment*random(X),

where X could be a small configurable integer value, with a default around 10 or so, so basically we spread the termination of instances over a number of days

cristim avatar Jan 30 '20 02:01 cristim

If you look at the spot pricing graphs since a couple of years ago there's basically just a daily correction of a very small increment.

I think AWS technically only guarantees the price for an hour. Some of the more volatile instances will change prices multiple times a day, although it's nothing like the swings before the Spot bidding overhaul.

In practice using the aggressive bidding policy makes little sense anymore, unless you actually want to trigger replacements in order to test some code paths.

This is exactly what I've been using it for. I think there also may be case to use it instead of OnDemandPriceMultiplier, but I don't know what it would be.

gabegorelick avatar Jan 30 '20 03:01 gabegorelick

This is no longer relevant, Spot prices are no longer in a bidding model so won't trigger instance terminations anymore

cristim avatar Mar 06 '23 16:03 cristim