Contenu connexe
Similaire à EC2 Spot in 104 (20)
Plus de Cliff Chao-kuan Lu (14)
EC2 Spot in 104
- 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
呂昭寬(Cliff)
104首席技術顧問 / AWS台灣Community Hero
EC2 Spot 在104 的深度實踐
- 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 Spot 在 104 的深度實踐
Spot Instance 為何
設計上的改變
費用比較
近期變動
- 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Instance
Amazon EC2 Spot 執行個體是 AWS 雲端中的備用運算容量,可提供相對於隨需價格
更高的折扣。EC2 Spot 執行個體可優化 AWS 雲端成本,您可以相同的預算將應用程式的輸
送量擴展高達 10 倍。您只需在啟動 EC2 執行個體時選擇 Spot,就能將成本降到隨需價格
的十分之一。
隨需執行個體與 Spot 執行個體的唯一差異是,當 EC2 需要收回容量時,EC2 只需在
前 2 分鐘前通知即可中斷 Spot 執行個體。EC2 Spot 執行個體可運用在各種容錯和彈性應用
程式,像是測試與開發環境、無狀態 Web 伺服器、影像轉譯、影片轉碼,以及執行分析、
機器學習及高效能運算 (HPC) 工作負載。EC2 Spot 執行個體與 EMR、Auto Scaling、
Elastic Container Service (ECS)、CloudFormation、Data Pipeline 及 AWS Batch 等其他
AWS 服務緊密整合,可讓您自由選擇如何啟動和維護 Spot 執行個體上執行的應用程式。
AWS 還提供可自動管理 Spot 執行個體的 Spot 叢集。您只需告知 Spot 叢集需要多少
容量,叢集就會處理其餘的部分。
https://aws.amazon.com/tw/ec2/spot/
- 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Spot Instance使用須知
• 運算中斷
• 冪等性 (Idempotency)
• 非同步調用:排程
• 同步調用: 重試
• 長時間運算: 儲存狀態
• 出價金額
• Auto Scaling :: Launch Configurations
• Spot Fleet / EC2 Fleet
- 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
應用程式特性
• 每月 4-10M 次請求
• 明顯的淡旺季、週週期
• 每日 Peak / Trough: 5-10x
• 可快取
- 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
雙 Auto Scaling Group
ECS CPU %Reservation0 100
Spot
On demand
- 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Usage
2017/08 2017/09 2017/10 2017/11 2017/12 2018/01 2018/02 2018/03 2018/04 2018/05
od-qty spot-qty
- 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
費用節省
30
40
50
60
70
80
90
100
2017/08 2017/09 2017/10 2017/11 2017/12 2018/01 2018/02 2018/03 2018/04 2018/05
spot-pct
% Saving (OD)
- 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
利用率 …… !!??
- 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
改進
• 解耦
• 提升各 Task 行為的一致性
• 更容易選擇 Task Scaling 調控參數
• EC2 Fleet
• 簡化 Spot / On-Demand 調度
• Fargate
• 一站式服務
• 省卻管理 EC2 的麻煩
- 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
改進: EC2 Fleet
https://aws.amazon.com/blogs/aws/ec2-fleet-manage-thousands-of-on-demand-and-spot-instances-with-one-request/
- 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Take Home Message
1. EC2 Spot 費用划算;搭配 EC2 Fleet 易學易用
但要對運算中斷做好準備
2. Managed Service 未必較貴,但肯定省麻煩
3. 歡迎加入 AWS User Group Taiwan (fb: awsugtw)
記得參加我們攤位的挑戰!
- 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank You!
- 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
0
- 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
0xDEADBEEF
Notes de l'éditeur
- 運算中斷: 正常 Server 也會發生
- 2016 年開發
使用 ECS ,靠應用層參數進行 Auto Scaling
- 4-10M requests / mo
- EC2 Fleet: 強化原本 Spot Fleet,5/2 推出
Fargate 比起 ECS / EC2 較貴,但不用預留 task 成長的 buffer
- 6/26 因 Spot out-bid 引入