Contenu connexe Similaire à Save up to 90% and Run Production Workloads on Spot - CMP307 - re:Invent 2017 (20) Plus de Amazon Web Services (20) Save up to 90% and Run Production Workloads on Spot - CMP307 - re:Invent 20171. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENT
S a v e u p t o 9 0 % a n d R u n P r o d u c t i o n W o r k l o a d s o n
S p o t
B o y d M c G e a c h i e , S e n i o r P r o d u c t M a n a g e r , E C 2 S p o t I n s t a n c e s
N o v e m b e r 2 9 , 2 0 1 7
2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fundamentals of Amazon EC2 Spot Instances
What Spot is and how it works
3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
On-Demand
Pay for compute capacity by
the second or hour with no
long-term commitments
For spiky workloads,
or apps being developed or
tested on EC2 for the first
time
AWS EC2 consumption models
Reserved
Reserved Instances provide you
with a significant discount
compared to On-Demand
instance pricing
For applications that have steady
state or predictable usage,
Reserved Instances can provide
significant savings compared to
using On-Demand instances
Spot
Spot Instances allow you to
request spare Amazon EC2
computing capacity for up to 90%
off the On-Demand price
For fault-tolerant instance-flexible
or time-insensitive workloads
4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spare capacity at scale
5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer example—Clemson University
vCPU Distribution
c4.2xlarge c3.8xlarge c4.8xlarge i3.4xlarge
m4.4xlarge c4.4xlarge r4.4xlarge m4.2xlarge
m3.2xlarge r4.8xlarge m4.16xlarge x1.16xlarge-
200,000
400,000
600,000
800,000
1,000,000
1,200,000
Concurrent vCPU
6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Spare capacity at scale
7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Low, Predictable Prices Eliminate the bid! No need to learn new APIs Pause & Resume with
Stop/Start & Hibernate
Spot – Predictable Prices, Pause & Resume
8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
With Spot, the rules are simple [OLD]
Markets where the price of
compute changes based on
supply and demand.
You’ll never pay more than
your bid. When the market
exceeds your bid you get 2
minutes to wrap up your work.
9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
With Spot the rules are simple [NEW]
The price changes infrequently
based on supply and demand
of spare capacity
Just request capacity and pay
the current rate. When we
need the capacity back you’ll
get a 2 minute warning
10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Capacity pools
AZ1
AZ2
Seoul Capacity Example
D2 C4 M4 I2 R3 R4
Shared
Shared
11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
$0.37 $0.29$0.50
1b 1c1a
8XL
$0.40 $0.16$0.214XL
$0.13 $0.13$0.182XL
$0.05 $0.06$0.06XL
$0.01 $0.04$0.02L
R4
$2.128
On
Demand
$1.064
$0.532
$.266
$0.133
Each instance family
Each instance size
Each Availability Zone
In every region
Is a separate Spot pool
Show me the pools!
12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Instance flexible Time flexible Region flexible
Flexibility is crucial
13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Flexibility is crucial—instance
• m4.xlarge capacity is different from m4.large. Use as many sizes as you can efficiently!
Instance Size
• If you’re using the c4.large, you can almost certainly use m4.large and r4.large. They
have the same number of vCPUs, just with some extra memory!
Instance Family
• Availability Zones consist of one or more discrete data centers. US-East-2a and US-
East-2b capacity is different! If your application can use multiple AZs, do it!
Availability Zone
14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Flexibility is crucial—time
15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
6 more regions and 17 more
Availability Zones announced!
44 Availability Zones
16 Regions
Flexibility is crucial—region
16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Nature of a Spot application
Common application requirements to be successful in using Spot Instances
17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. examples
• Experiments
• Development
• Testing
• One-time queries
• Model training
T i m e i n s e n s i t i v eT i m e s e n s i t i v e
Nature of Spot applicationsexamples
• Web services
• APIs
• Production big data
• Production grid computing
• Production sequencing
18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive best practices
Fault tolerance
for Spot
Stateless Multi-AZ Loosely coupled
Instance
flexibility
19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—capacity pools
Instance
Sizes
Instance
Families
Availability
Zones
Capacity
Pools
20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—capacity pools how many?
3
Capacity
Pools
21
21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—Spot Fleet
Launch thousands of Spot Instances
with one RequestSpotFleet call.
Diversify your resources automatically using
the fleet diversified strategy. Grow your availability.
Apply custom weighting.
Create your own capacity unit based on your
application needs.
22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—Spot Advisor
23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer Examples—Yelp
• Seagull is Yelp’s distributed system for concurrent task execution
• Seagull’s infrastructure costs were reduced by 85% by moving to
Spot Instances
Seagull
Infrastructure
Cost
Timeline (May 2015–April 2016)
55% reduction in costs after initial transition
to Spot Instances
Additional 60% savings
after transition to Spot +
autoscaling complete
24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
SupportedOS
• Amazon
Linux
• Ubuntu
• Windows
Time insensitive – use hibernate!
Supportedinstances
• C3
• C4
• M4
• R3
• R4
25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer examples—Guttman Lab, Caltech
26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Tools and practical examples
The common tools leveraged by Spot customers and how they use them
27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS
CloudFormation
AWS
OpsWorks
Amazon
EMR
Amazon
ECS
AWS Data
Pipeline
AWS BatchAuto Scaling
Spot in action on AWS
28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Containers
Often stateless
Fault tolerant
Instance flexible
29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Container Service—Console
30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Container Service—Console
31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—capacity pools
Instance
Sizes
Instance
Families
Availability
Zones
Capacity
Pools
32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—capacity pools
1 5 2 10
33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Container Service—CloudFormation
34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
#!/bin/bash
while sleep 5; do
if [ -z $(curl -Isf http://169.254.169.254/latest/meta-data/spot/termination-time) ];
then
/bin/false
else
ECS_CLUSTER=$(curl -s http://localhost:51678/v1/metadata | jq .Cluster | tr -d ")
CONTAINER_INSTANCE=$(curl -s http://localhost:51678/v1/metadata
| jq .ContainerInstanceArn | tr -d ")
aws ecs update-container-instances-state --cluster $ECS_CLUSTER
--container-instances $CONTAINER_INSTANCE --status DRAINING
fi
done
Elastic Container Service—interruptions
35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Our ECS cluster in action
50 instances requested
over 30 days
- Never dropped
below 45 instances
- 85% discount if you
wanted 50 and
could withstand
dropping to 45
0
0.02
0.04
0.06
0.08
0.1
0.12
30
35
40
45
50
55
Instances Average Price Per Instance
- If you only wanted
45, the discount is
still 83%
36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer examples—Mapbox
37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer examples—Mapbox
38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Big data
Capable of being accelerated
Fault tolerant
Instance flexible
39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hadoop components
Master
TaskCore
40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Hadoop components
Master
TaskCore
41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
T i m e f l e x i b l eI n s t a n c e f l e x i b l e
Hadoop—time sensitive or insensitive?
42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic MapReduce—time sensitive
43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic MapReduce—instance fleets
44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—capacity pools
Instance
Sizes
Instance
Families
Availability
Zones
Capacity
Pools
45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Time sensitive—capacity pools
2 2 1 4
46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Requested 1000
vCPUs over 30 days
Minimum 848 vCPUs
Mode 1008 vCPUs
Average 1005 vCPUs
Average Price of
$0.0118 per vCPU
Savings of over 81%
Our EMR Instance Fleets cluster in action
47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer examples—FINRA
48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!