Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
コンテナをSpot Fleetで起動するという選択肢
Search
Kazuma Watanabe
December 14, 2016
Technology
2
1k
コンテナをSpot Fleetで起動するという選択肢
JAWS-UG コンテナ支部 #7
Kazuma Watanabe
December 14, 2016
Tweet
Share
More Decks by Kazuma Watanabe
See All by Kazuma Watanabe
SmartHRにおけるBiTemporal Data Modelの実践のその後 / After the practice of BiTemporal Data Model in SmartHR
wata727
1
2.3k
PHPを検査するPHPを書く / Write PHP inspection by PHP
wata727
1
2.1k
快適なコードレビューを目指して / For a comfortable code review
wata727
1
590
現実世界でのコンテナの運び方
wata727
3
1.1k
Lintの付き合い方とPahoutのご紹介
wata727
0
150
Querlyで始めるコードレビューの自動化
wata727
2
440
エンジニア向けSaaSを支えるInfrastructure as Code
wata727
5
2.3k
SideCIのインフラ構築を自動化した話
wata727
1
2.1k
Other Decks in Technology
See All in Technology
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Engineer Career Talk
lycorp_recruit_jp
0
160
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
Platform Engineering for Software Developers and Architects
syntasso
1
520
いざ、BSC討伐の旅
nikinusu
2
780
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.6k
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
990
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
GraphQLとの向き合い方2022年版
quramy
43
13k
Designing the Hi-DPI Web
ddemaree
280
34k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Bash Introduction
62gerente
608
210k
Building Your Own Lightsaber
phodgson
103
6.1k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Fireside Chat
paigeccino
34
3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Six Lessons from altMBA
skipperchong
27
3.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Transcript
ίϯςφΛSpot FleetͰ ্ཱͪ͛Δͱ͍͏બࢶ JAWS-UG ίϯςφࢧ෦ #7 @wata727
@wata727 • Kazuma Watanabe • Engineer in Actcat, Inc. •
AWS Solution Architect • https://twitter.com/wata727_
Containers in SideCI
Sandbox Containers • ࣮ߦڥΛίϯςφԽ͙ͯ͢͠ഁغ͢Δ • 5,000 containers / day EPDLFS
Ubuntu Host GitHub Clone Comment
Sandbox Containers • ࣮ߦڥΛίϯςφԽ͙ͯ͢͠ഁغ͢Δ • 5,000 containers / day EPDLFS
Ubuntu Host GitHub Clone Comment
Spot Fleet ?
εϙοτΠϯελϯεΛ ຊ൪ͰͬͯΔํʁ ʢ༧: 10%ʣ ※ه: 5%͘Β͍Ͱͨ͠
Amazon Spot Instance • ༧උͷEC2ίϯϐϡʔςΟϯάੑೳʹೖࡳ • ͓͍҆ʂʂʂ • ͱ͋Δc4.2xlargeͷྫ: $0.39
→ $0.06 ڻ͖ͷ
ͨͩ͠… • ೖࡳՁ֨ΛԼճΔͱམͪΔ • ߴ͘ͳͬͨΒผͷϓʔϧʢAZͱΠϯελϯε λΠϓͷΈ߹ΘͤʣͷεϙοτΠϯελϯ εΛىಈ͢Δ is ͍͠ •
ͦΜͳʹ͍ͳ͍͔…
Spot Fleet • εϙοτΠϯελϯεͷλʔήοτ༰ྔΛҡ ࣋͢ΔͨΊͷΈ • Ճྉۚແ͠ • ஈ͕ߴಅͨ͠ΒɺผͷϓʔϧͰҰ൪͍҆ε ϙοτΠϯελϯε͕ࣗಈͰ্ཱ͕ͪΔ
Spot Fleetͷઓུ • lowest: બͨ͠தͰৗʹҰ൪͍҆ϓʔϧ͔Β ىಈ͢Δɺ͍͕҆ߴಅ͢Δͱશ෦མͪΔ • diversified: ՄೳͳݶΓϓʔϧΛࢄͭͭ͠ɺ ͍҆ॱʹىಈ͢Δɺߴ͍ͱ͖͋Δ͕ɺ
Խͱߴಅ࣌ͷϦεΫܰݮ͕ظͰ͖Δ
͡Ί͔ͨ • ެࣜͷνϡʔτϦΞϧ͕͔ͳΓஸೡͳͷͰɺ ͦΕʹैͬͯ࡞ͬͯΈΔͱྑͦ͞͏ • ͦΕ͢Β໘ͳਓ • https://github.com/wata727/ tf_aws_ecs_on_spotfleet
Demo
Spot Fleet in SideCI
EC2ΛSpot Fleetʹ͠·ͨ͠
Spot Fleetʹ͢ΔͨΊʹ • ಥવΠϯελϯε͕མͪͯࠔΒͳ͍Α͏ʹ ઃܭ͢ΔʢϦτϥΠͱ͔ʣ • ىಈͨ͠Βɺ͙͢ʹαʔϏεΠϯͰ͖ΔΑ͏ ʹϢʔβσʔλͱ͔ઃఆ͓ͯ͘͠ • େମAutoScalingʹඞཁͳͷͱಉ͡ɺඞવత
ʹোʹڧ͍ઃܭʹͳΔ
҆ఆͯ͠Քಇͤ͞ΔͨΊͷTips • diversifiedͱlowestͰ͚Δ
҆ఆͯ͠Քಇͤ͞ΔͨΊͷTips • Spot Fleet ؒͷೖࡳՁ֨ʹࠩΛ͚ͭΔ • ೖࡳՁ֨Λ͑ͨ࣌ͰผͷҰ൪͍҆ϓʔϧ ͔ΒΠϯελϯε͕ىಈ͢Δ͜ͱΛར༻͢Δ • ೖࡳՁ͕͚֨҆ΕɺఆظతʹҰ൪͍҆Πϯ
ελϯεϓʔϧͷ࠶ׂΓ͕ͯߦΘΕΔ
Ձ֨҆ͨ͘͠Β͙͢མͪͳ͍ʁ • EC2ͷ՝ۚ୯Ґ1࣌ؒ͝ͱ͔ͩΒɺִ͍ؒ Ͱ࠶ىಈͨ͠Β༨ܭʹߴ͘ͳΔΜ͡Ό… • ࣮ىಈ1࣌ؒҎʹεϙοτՁ֨ͷߴಅͰڧ ੍λʔϛωʔτ͞Εͨ߹ର֎ʹͳΔ • http://aws.typepad.com/sajp/2016/11/aws- black-belt-online-seminar-amazon-ec2-spot-
instances.html
Ͱɺ҆ఆͯ͠·͔͢ʁ • ҙ֎ͱ҆ఆͯ͠·͢ • 2िؒ͘Β͍ฏؾͰੜ͖ͬͯΔΠϯελϯε ͞Μ͍·ͨ͠
ͱ͋Δm4.2xlargeͷ1
Spot Fleet ӡ༻Ͱ ϋϚͬͨ͜ͱ
ಥવͷىಈΤϥʔ • Spot FleetͰΠϯελϯε͕ىಈ͠ͳ͘ͳͬͨ • VPCͰIPΞυϨε͕֬อͰ͖ͯͳ͍…ʁ • ͦΜͳഅࣛͳͱࢥ͍ͭͭVPCΛ֬ೝ
ʊਓਓਓਓਓਓਓਓਓਓʊ ʼɹར༻ՄೳͳIP: 1ɹʻ ʉY^Y^Y^Y^Y^Y^Y^Yʉ
VPCͷIP͕ރׇ • /25Ͱ128͋ΔͣͷIP͕ރׇ • ݪҼେྔʹੜ͞Ε͍ͯͨENI (!) • TerraformͰىಈͨ͠Spot Fleetಛఆͷ݅ ԼͰ
DeleteOnTermination ͕falseͷΠϯελ ϯεΛىಈ͢Δ
PR͛·ͨ͠ • ͰϚʔδ͞ΕΔ༧ײແ͠
Ձ֨ͷҟৗͳཚߴԼ • Ұ࣌ظɺͬͯΔϓʔϧͷஈ͕ݢฒΈߴಅ ͯ͠શવ҆ఆͯ͠ΠϯελϯεΛ֬อͰ͖ͳ ͍࣌ظ͕͋ͬͨ • ΦϯσϚϯυฒྻىಈͯ྇͗͠·ͨ͠ • ถେ౷ྖબͷλΠϛϯά͕͔ؔͯͨ͠…
diversifiedͳͷʹภΔ • ͳ͔ͥdiversifiedͰىಈ͢ΔΠϯελϯε͕ಉ ͡ϓʔϧ͔Βىಈ͍ͯ͠Δ • AWSͷํʹฉ͍ͨͱ͜Ζɺࢄ͢ΔͳΒ3 Ҏ্ඞཁΒ͍͠ • ఆظతʹΠϯελϯεΛআͰ͖Εɺ࠷҆ ͷϓʔϧ͔Βىಈ͢ΔͷͰࢄ͢Δ͔…ʁ
Chaos Monkeyͷػӡ
ͪͳΈʹ • Chaos Monkey in Lambda͋ΔΑ
·ͱΊ
·ͱΊ • ͓҆͘ͳΔͷͪΖΜɺෆྀͷোΛఆ ͨ͠ઃܭΛ༨ّͳ͘͞ΕΔͷͰɺΞʔΩςΫ νϟ͕ڧਟʹͳΔ • ੲεϙοτΠϯελϯεҰ࣌తͳόον ॲཧ͖͕ͩͬͨɺSpot Fleet͕ঢ়گΛม͑ͨ •
࠷ߴͳͷͰΈΜͳ͓͏ʂʂ