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
ScalaとPerlでMicroservices in production / Buildi...
Search
aereal
September 28, 2017
Technology
0
5.3k
ScalaとPerlでMicroservices in production / Building microservices with Perl and Scala in production
aereal
September 28, 2017
Tweet
Share
More Decks by aereal
See All by aereal
How to send distibuted traces to Datadog using build own OpenTelemetry-Lambda distribution
aereal
3
180
好きな技術《コト》で、 生きていく技術 / life with what you like
aereal
5
2.1k
qron: Cloud Native Cron Alternativeの今
aereal
2
1.9k
自動作曲入門 / introduction to programatic music composition
aereal
1
530k
はてなブログ タグとCDK / The epic of AWS CDK and Hatena Blog Tag
aereal
3
200k
はてなブログ タグの技術選択 / The technical details of Hatena Blog Tag
aereal
3
200k
ブログサービスのHTTPS化を支えたAWSで作るピタゴラスイッチ / The construction of large scale TLS certificates management system with AWS
aereal
3
400k
AWSではてなブログの常時HTTPS配信をバーンとやる話 / The Epic of migration from HTTP to HTTPS on Hatena Blog with AWS
aereal
14
17k
Scalaで自動作曲の練習 / A study of automatic composition in Scala
aereal
1
390k
Other Decks in Technology
See All in Technology
Oracle GoldenGate 23ai 導入Tips
oracle4engineer
PRO
1
270
トークナイザー入門
payanotty
2
950
【swonet.conf_】NOCメンバーが語るSTMの実態!! ~ShowNetから若者への贈り物~
shownet
PRO
0
310
入門 KRR
donkomura
0
110
Perlで始めるeBPF: 自作Loaderの作り方 / Getting started with eBPF in Perl_How to create your own Loader
takehaya
1
870
過去のインプットとアウトプットを振り返る
diggymo
0
110
Webセキュリティのあるきかた
akiym
31
9.9k
【shownet.conf_】革新と伝統を融合したファシリティ
shownet
PRO
0
340
【shownet.conf_】3Dアプローチで守るセキュリティ
shownet
PRO
0
380
【shownet.conf_】多様化するネットワーク環境を柔軟に統合するルーティングテクノロジー
shownet
PRO
0
380
LINEヤフー新卒採用 コーディングテスト解説 アルゴリズム問題編
lycorp_recruit_jp
0
13k
Strict Concurrencyにしたらdeinitでクラッシュする話
0si43
0
130
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.1k
BBQ
matthewcrist
85
9.2k
Statistics for Hackers
jakevdp
796
220k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Designing Experiences People Love
moore
138
23k
Clear Off the Table
cherdarchuk
91
320k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
The Mythical Team-Month
searls
218
43k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
25
660
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Robots, Beer and Maslow
schacon
PRO
157
8.2k
Transcript
ScalaͱPerlͰ Microservices in production id:aereal @ Cookpad Tech Kitchen #11
feat. ͯͳ
ࣗݾհ • id:aereal • גࣜձࣾͯͳ (2012ʙ) • ͯͳϒοΫϚʔΫ • ͯͳϒϩά
(ςοΫϦʔυ) • Perl, Ruby, Scala, Shell Script
ͯͳʹ͓͚ΔςοΫϦʔυɺ ͦͯ͠αʔϏεϓϥοτϑΥʔϜνʔϜͷ ςοΫϦʔυʹ͍ͭͯ http://developer.hatenastaff.com/entry/2017/09/28/110000
ΞδΣϯμ • Microserviceͱͯ͠࡞ͬͨ৽αʔϏεʹ͍ͭͯ • ຊ൪ೖͯ͠ͷ࠾ • Ψόφϯε • ڍ͍͛ͯͨ՝ղܾ͞Ε͔ͨ
৽αʔϏεʹ͍ͭͯ
http://hatenablog.com/
“ͯͳϒϩάΛͬͱຊ֨తʹ͍͍ͨํͷͨ Ίʹɺ༗ྉϓϥϯʮͯͳϒϩάProʯΛ༻ҙ͠ ͓ͯΓ·͢ɻࠂͷඇදࣔಠࣗυϝΠϯػೳ ͳͲɺͯͳϒϩάΛΑΓศརʹ͓͍͍ͨͩ ͚·͢ɻ” http://hatenablog.com/guide/pro
ͯͳϙΠϯτ ΫϨδοτΧʔυ ίϯϏχৼࠐ ۜߦৼࠐ ༻ https://www.hatena.ne.jp/shop/point/list
http://hatena.g.hatena.ne.jp/hatena/20150529/1432869070
վम or ࡞Γ͠ • چγεςϜϞϊϦγοΫ • ܾࡁͯͯ͠ͳϙΠϯτΛνϟʔδ͢Δ • ͯͳϙΠϯτΛͬͯߪೖ͢Δ •
༷Λཧ͢Δ͍͍ػձͰ͋Δ
ܾࡁߦαʔϏε (֎෦) ͯͳͷαʔϏε (ϒοΫϚʔΫͳͲ) ݱߦܾࡁγεςϜ ϙΠϯτཧ ڞ༗Ϟδϡʔϧ ༗ྉϓϥϯཧ ґଘ ͯͳͷαʔϏε
ґଘ ͯͳͷαʔϏε ґଘ etc. ΞΧϯτ چܾࡁγεςϜͷߏ
چܾࡁγεςϜͷߏ • ܾࡁγεςϜ: WebΞϓϦέʔγϣϯ • APIͳ͘HTMLͷϑΥʔϜ͕͋ΔͷΈ • ڞ༗Ϟδϡʔϧ: ܾࡁߦαʔϏεͱ௨৴͢Δ࣮ •
ͨ͘͞ΜͷϦϙδτϦ͔Βґଘ͞Ε͍ͯΔ • ڞ༗DBΛૢ࡞͢Δ
چܾࡁγεςϜͷվम? • ΄ͱΜͲݱ࣮తͰͳ͍ • ޓੑʹؔ͢ΔεΩʔϜ͕ͳ͍ • શޙํޓ or die •
ෳͷυϝΠϯ͕ೖΓཚΕ͍ͯΔ • ݱࡏͷ༷ʹӨڹΛڧ͘ड͚Δ • վળ͕·ΘΒͳ͍
ϑϧεΫϥον
৽ܾࡁγεςϜ • ܾࡁߦαʔϏεͷήʔτΣΠͱͯ͠ಇ͘ • ͯͳϒϩάProͷ༩ͳͲ֤αʔϏεʹҠৡ • JSON over HTTPͳAPIͷΈΛఏڙ͢Δ •
ରSSKDs (= small set of known developers)
৽ܾࡁγεςϜ ߏਤ ܾࡁߦαʔϏε (֎෦) ͯͳͷαʔϏε ༗ྉϓϥϯͷ ঢ়ଶཧ ৽ܾࡁγεςϜ UI API
http://staff.hatenablog.com/entry/2017/07/10/160000
ຊ൪ೖͯ͠ͷ࠾
ͦͷલʹৼΓฦΓ
ϚΠΫϩαʔϏεͰ࡞Δ͔ • 1ʙ3ষʹ͔͚ͯϝϦοτ ʮ༏ΕͨαʔϏεʯʹ͍ͭͯ ड़ΒΕ͍ͯΔ • ϚΠΫϩαʔϏεʹΑͬͯ αʔϏεΑΓΑ͘ͳΔͷ͔ • ΨόφϯεͳͲɺ
ίετ͑ΔͩΖ͏͔ https://www.oreilly.co.jp/books/9784873117607/
ૄ݁߹ͱߴڽूੑ 1. ϞϊϦγοΫͰखΛೖΕͮΒ͍ (ີ݁߹) 2. ৽ͨʹ༗ྉϓϥϯΛಋೖ͍ͨ͠αʔϏε࠶࣮ 3. υϝΠϯ͕ࣝྲྀग़ (ڽूੑ) 4.
࣋ଓՄೳʹ࡞Γ (ͳ͓͠) ͍ͨ • είʔϓΛখ͘͞໌ྎʹอͭ • ૄ݁߹ (ʰϚΠΫϩαʔϏεΞʔΩςΫνϟʱ3.2.1) • ߴڽूੑ
(ʰϚΠΫϩαʔϏεΞʔΩςΫνϟʱ3.2.2) • ׂ౷࣏͢Δ • ٕज़ҟ࣭ੑ • σϓϩΠͷϥΠϑαΠΫϧΛૣΊΔ
͏·͍ͬͨ͘? • Ψόφϯε͏·͍͔ͬͨ͘ • ૄ݁߹ʹͳ͔ͬͨ • ߴڽूʹͳ͔ͬͨ
Ψόφϯε: ̋ • ͯͳϒϩάͱ৽ܾࡁγεςϜΛ ڠௐͤͯ͞มߋ͢Δඞཁ͕͋Δ • → νʔϜΛϞϊϦγοΫʹ͢Δ͜ͱͰஅΛ͛ͨ • ଞνʔϜͱͷ࿈ܞ͓͓ΉͶى͖ͳ͔ͬͨ
• ৽ܾࡁγεςϜͷϏδϣϯΛڞ༗͍ͯͨ͠ • → ͍͖ͳΓγεςϜ͕ૠ͛ସΘΔ͜ͱͳ͔ͬͨ
ϞϊϦγοΫͳνʔϜ • ͯͳϒϩάଆͷ։ൃͱ৽ܾࡁγεςϜͷ։ൃϝϯόʔΛ Ұகͤͨ͞ • (ॳɺͯͳϒϩάଆΛଞͷϝϯόʔʹ͓ئ͍͢Δ͜ͱ ݕ౼͍ͯͨ͠) • → ͕ࣝڽू͞ΕɺຊʹඞཁͳͷΛదʹ࡞Εͨ
ૄ݁߹: ̋ • UIͱAPIΛผͷݴޠͰ࣮͢Δ͜ͱͰஅ • UI = Perl, API =
Scala • → چγεςϜͰͱͳͬͨڞ༗ΧʔωϧԽΛ͙ • ޓ͕ඞཁͳೝূΛUIʹཹΊΒΕͨ • → ݁Ռͱͯ͠UI͕APIʹର͢ΔഊࢭʹͳΔ
ߴڽूੑ: ˚ • UIͱAPIͷσϓϩΠλΠϛϯάΛἧ͑Δඞཁ͕͋Δ • → ͚ͩ͜͜ݟΔͱ࣌ظঘૣͩͬͨײ͋Δ • ʮ࠷ॳͷ30ؒແྉͰར༻Ͱ͖Δʯͱ͍͏ใɺ ͯͳϒϩάʹด͍ͯ͡ΔͷͰച্ूܭ͕͍͠
• → ϞσϦϯάదͩͬͨͱࢥ͏ͷͰɺ ूܭํ๏ͷվળͳͲͰΞϓϩʔν͍ͨ͠
࠾: 70 • ͋ͱ͔ΒϦΧόʔͮ͠Β͍ (ྫ: Ψόφϯε) ઌʹखΛଧͯͨ • Ұํɺٕज़తͳΞϓϩʔν
(ྫ: σϓϩΠɺ౷߹ςετ) ·ͩ·ͩΕΔ͜ͱ͕͋Δ
·ͱΊ
MicroservicesԽΞϦ͔ • ৽ܾࡁγεςϜͰ࠾༻ͨ͠ͷਖ਼ղͩͬͨ • MicroservicesܥΛ࡞ΔͨΊͷσβΠϯ • = νʔϜ (ਓɺ৫) ·ͰϚΠΫϩʹׂ͢Δඞཁͳ͍
• ͦͷΘΓ͖ͪΜͱࢠΛඃΓͤͳ͍ͱ͍͚ͳ͍