Spot auction mechanics
How Foundry allocates spot compute
Last updated
How Foundry allocates spot compute
Last updated
Foundry allocates spot instances through a blind second-price auction to ensure fair and efficient distribution. This article provides a deep dive into the mechanics of this auction and how it handles allocation in various cases.
In a second-price auction, all participants submit sealed bids noting the maximum price (known as the limit price) they are willing to pay for the item without knowing the value of the other bids. Those who win the auction do not pay their limit price but the limit price of the highest losing bid. This mechanism encourages participants to bid their true valuation for the item because overbidding does not increase the price they pay if they win.
Consider a simple example where there are 3 (identical) spot instances available in a hypothetical region-a
and 6 bids, each for a single instance:
Bid | Bid limit price ($/instance/hr) | Price paid ($/instance/hr) |
---|---|---|
In this example, bids A
, B
, and C
are allocated, and they each pay $13.00/instance/hr, the limit price of the highest losing bid, as long as their instance remains allocated.
It is important to note that in this case, $13.00 becomes the spot price for region-a
, but a new bid (X
) with a limit price of $13.01 would not be successful:
Bid | Bid limit price ($/instance/hr) | Price paid ($/instance/hr) |
---|---|---|
While bid X
was higher than the previous spot price, it is not higher than the lowest winning bid, C
, at $16.00. When bid X
is placed, it is not allocated, but it does raise the current spot price to $13.01, since it is becomes the highest losing bid.
To support distributed workloads, a single bid can request multiple instances. Bids for multiple instances are all-or-nothing, meaning the bid will not be successful if there aren't enough spot instances remaining to allocate the entire bid. In certain cases, this can mean bids with lower limit prices will be allocated even when higher bids are not:
In this case, bid B
is unsuccessful because it requests 2 instances, but there is only 1 instance remaining in the spot pool after all higher bids are allocated (bid A
, in this case) . Bid C
is then allocated because it only requests 1 instance.
Although bid B
is unsuccessful, it does not qualify as the "highest losing bid" for the purposes of setting the spot price because there are successful bids below it.
The Foundry spot auction is fully dynamic, meaning that allocation and prices can change in real time based supply and demand. Concretely, changes are triggered when:
Capacity is added or removed from the spot pool (supply)
Bids are created or canceled (demand)
Consider the table below as the initial state of the spot market in a specific region:
Each of the sections below introduces a change to the market and examines how it would affect allocation and spot prices.
Two additional instances are added to the spot pool.
Outcome(s):
Bids D
and E
are allocated
The spot price decreases from $13.00 to $8.00
One instance is removed from the spot pool. (Capacity reduced from 3 instances to 2)
Outcome(s):
Bid C
is preempted (with a 5-minute warning)
The spot price increases from $13.00 to $16.00
Bids X
and Y
are created.
Outcome(s):
Bid C
is preempted (with a 5-minute warning)
Bid X
is allocated
The spot price increases from $13.00 to $16.00
Bids A
and C
are canceled.
Outcome(s):
Bids D
and E
are allocated
The spot price decreases from $13.00 to $8.00
Bid | # of instances | Bid limit price | Price paid | Instances remaining |
---|---|---|---|---|
Bid | # of instances | Bid limit price | Price paid | Instances remaining |
---|---|---|---|---|
Bid | # of instances | Bid limit price | Price paid | Instances remaining |
---|---|---|---|---|
Bid | # of instances | Bid limit price | Price paid | Instances remaining |
---|---|---|---|---|
Bid | # of instances | Bid limit price | Price paid | Instances remaining |
---|---|---|---|---|
Bid | # of instances | Bid limit price | Price paid | Instances remaining |
---|---|---|---|---|
A ✅
$23.00
$13.00
B ✅
$21.00
$13.00
C ✅
$16.00
$13.00
D ❌
$13.00
--
E ❌
$12.00
--
F ❌
$8.00
--
A ✅
$23.00
$13.01
B ✅
$21.00
$13.01
C ✅
$16.00
$13.01
X ❌
$13.01
--
D ❌
$13.00
--
E ❌
$12.00
--
F ❌
$8.00
--
--
--
--
--
3
A ✅
2
$23.00
$13.00
1
B ❌
2
$21.00
--
1
C ✅
1
$16.00
$13.00
0
D ❌
1
$13.00
--
0
E ❌
1
$12.00
--
0
F ❌
1
$8.00
--
0
--
--
--
3
A ✅
$23.00
$13.00
2
B ✅
$21.00
$13.00
1
C ✅
$16.00
$13.00
0
D ❌
$13.00
--
0
E ❌
$12.00
--
0
F ❌
$8.00
--
0
--
--
--
5
A ✅
$23.00
$8.00
4
B ✅
$21.00
$8.00
3
C ✅
$16.00
$8.00
2
D ✅
$13.00
$8.00
1
E ✅
$12.00
$8.00
0
F ❌
$8.00
--
0
--
--
--
2
A ✅
$23.00
$16.00
1
B ✅
$21.00
$16.00
0
C ❌
$16.00
--
0
D ❌
$13.00
--
0
E ❌
$12.00
--
0
F ❌
$8.00
--
0
--
--
--
3
A ✅
$23.00
$16.00
2
X ✅
$22.00
$16.00
1
B ✅
$21.00
$16.00
0
C ❌
$16.00
--
0
D ❌
$13.00
--
0
Y ❌
$12.00
--
0
E ❌
$12.00
--
0
F ❌
$8.00
--
0
--
--
--
3
B ✅
$21.00
$8.00
2
D ✅
$13.00
$8.00
1
E ✅
$12.00
$8.00
0
F ❌
$8.00
--
0