Slide 1

Slide 1 text

ScalaͱPerlͰ
 Microservices in production id:aereal
 @ Cookpad Tech Kitchen #11 feat. ͸ͯͳ

Slide 2

Slide 2 text

ࣗݾ঺հ • id:aereal • גࣜձࣾ͸ͯͳ (2012ʙ) • ͸ͯͳϒοΫϚʔΫ • ͸ͯͳϒϩά (ςοΫϦʔυ) • Perl, Ruby, Scala, Shell Script

Slide 3

Slide 3 text

͸ͯͳʹ͓͚ΔςοΫϦʔυɺ
 ͦͯ͠αʔϏεϓϥοτϑΥʔϜνʔϜͷ ςοΫϦʔυʹ͍ͭͯ http://developer.hatenastaff.com/entry/2017/09/28/110000

Slide 4

Slide 4 text

ΞδΣϯμ • Microserviceͱͯ͠࡞ͬͨ৽αʔϏεʹ͍ͭͯ • ຊ൪౤ೖͯ͠ͷ࠾఺ • Ψόφϯε • ڍ͍͛ͯͨ՝୊͸ղܾ͞Ε͔ͨ

Slide 5

Slide 5 text

৽αʔϏεʹ͍ͭͯ

Slide 6

Slide 6 text

http://hatenablog.com/

Slide 7

Slide 7 text

“͸ͯͳϒϩάΛ΋ͬͱຊ֨తʹ࢖͍͍ͨํͷͨ Ίʹɺ༗ྉϓϥϯʮ͸ͯͳϒϩάProʯΛ༻ҙ͠ ͓ͯΓ·͢ɻ޿ࠂͷඇදࣔ΍ಠࣗυϝΠϯػೳ ͳͲɺ͸ͯͳϒϩάΛΑΓศརʹ͓࢖͍͍ͨͩ ͚·͢ɻ” http://hatenablog.com/guide/pro

Slide 8

Slide 8 text

͸ͯͳϙΠϯτ ΫϨδοτΧʔυ ίϯϏχৼࠐ ۜߦৼࠐ ࢖༻ https://www.hatena.ne.jp/shop/point/list

Slide 9

Slide 9 text

http://hatena.g.hatena.ne.jp/hatena/20150529/1432869070

Slide 10

Slide 10 text

վम or ࡞Γ௚͠ • چγεςϜ͸ϞϊϦγοΫ • ܾࡁͯ͠͸ͯͳϙΠϯτΛνϟʔδ͢Δ • ͸ͯͳϙΠϯτΛ࢖ͬͯߪೖ͢Δ • ࢓༷Λ੔ཧ͢Δ͍͍ػձͰ΋͋Δ

Slide 11

Slide 11 text

ܾࡁ୅ߦαʔϏε
 (֎෦) ͸ͯͳͷαʔϏε (ϒοΫϚʔΫͳͲ) ݱߦܾࡁγεςϜ ϙΠϯτ؅ཧ ڞ༗Ϟδϡʔϧ ༗ྉϓϥϯ؅ཧ ґଘ ͸ͯͳͷαʔϏε ґଘ ͸ͯͳͷαʔϏε ґଘ etc. ΞΧ΢ϯτ چܾࡁγεςϜͷߏ੒

Slide 12

Slide 12 text

چܾࡁγεςϜͷߏ੒ • ܾࡁγεςϜ: WebΞϓϦέʔγϣϯ • API͸ͳ͘HTMLͷϑΥʔϜ͕͋ΔͷΈ • ڞ༗Ϟδϡʔϧ: ܾࡁ୅ߦαʔϏεͱ௨৴͢Δ࣮૷ • ͨ͘͞ΜͷϦϙδτϦ͔Βґଘ͞Ε͍ͯΔ • ڞ༗DBΛૢ࡞͢Δ

Slide 13

Slide 13 text

چܾࡁγεςϜͷվम? • ΄ͱΜͲݱ࣮తͰ͸ͳ͍ • ޓ׵ੑʹؔ͢ΔεΩʔϜ͕ͳ͍ • ׬શޙํޓ׵ or die • ෳ਺ͷυϝΠϯ͕ೖΓཚΕ͍ͯΔ • ݱࡏͷ࢓༷ʹӨڹΛڧ͘ड͚Δ • վળ͕·ΘΒͳ͍

Slide 14

Slide 14 text

ϑϧεΫϥον

Slide 15

Slide 15 text

৽ܾࡁγεςϜ • ܾࡁ୅ߦαʔϏεͷήʔτ΢ΣΠͱͯ͠ಇ͘ • ͸ͯͳϒϩάProͷ෇༩ͳͲ͸֤αʔϏεʹҠৡ • JSON over HTTPͳAPIͷΈΛఏڙ͢Δ • ର৅͸SSKDs (= small set of known developers)

Slide 16

Slide 16 text

৽ܾࡁγεςϜ
 ߏ੒ਤ ܾࡁ୅ߦαʔϏε
 (֎෦) ͸ͯͳͷαʔϏε ༗ྉϓϥϯͷ ঢ়ଶ؅ཧ ৽ܾࡁγεςϜ UI API

Slide 17

Slide 17 text

http://staff.hatenablog.com/entry/2017/07/10/160000

Slide 18

Slide 18 text

ຊ൪౤ೖͯ͠ͷ࠾఺

Slide 19

Slide 19 text

ͦͷલʹৼΓฦΓ

Slide 20

Slide 20 text

ϚΠΫϩαʔϏεͰ࡞Δ͔ • 1ʙ3ষʹ͔͚ͯϝϦοτ΍ ʮ༏ΕͨαʔϏεʯʹ͍ͭͯ ड़΂ΒΕ͍ͯΔ • ϚΠΫϩαʔϏεʹΑͬͯ
 αʔϏε͸ΑΓΑ͘ͳΔͷ͔ • ΨόφϯεͳͲɺ
 ίετ͸෷͑ΔͩΖ͏͔ https://www.oreilly.co.jp/books/9784873117607/

Slide 21

Slide 21 text

ૄ݁߹ͱߴڽूੑ 1. ϞϊϦγοΫͰखΛೖΕͮΒ͍ (ີ݁߹) 2. ৽ͨʹ༗ྉϓϥϯΛಋೖ͍ͨ͠αʔϏε͸࠶࣮૷ 3. υϝΠϯ஌͕ࣝྲྀग़ (௿ڽूੑ) 4.

Slide 22

Slide 22 text

࣋ଓՄೳʹ࡞Γ (ͳ͓͠) ͍ͨ • είʔϓΛখ͘͞໌ྎʹอͭ • ૄ݁߹ (ʰϚΠΫϩαʔϏεΞʔΩςΫνϟʱ3.2.1) • ߴڽूੑ (ʰϚΠΫϩαʔϏεΞʔΩςΫνϟʱ3.2.2) • ෼ׂ౷࣏͢Δ • ٕज़ҟ࣭ੑ • σϓϩΠͷϥΠϑαΠΫϧΛૣΊΔ

Slide 23

Slide 23 text

͏·͍ͬͨ͘? • Ψόφϯε͸͏·͍͔ͬͨ͘ • ૄ݁߹ʹͳ͔ͬͨ • ߴڽूʹͳ͔ͬͨ

Slide 24

Slide 24 text

Ψόφϯε: ̋ • ͸ͯͳϒϩάͱ৽ܾࡁγεςϜΛ
 ڠௐͤͯ͞มߋ͢Δඞཁ͕͋Δ • → νʔϜΛϞϊϦγοΫʹ͢Δ͜ͱͰ෼அΛ๷͛ͨ • ଞνʔϜͱͷ࿈ܞ΋͓͓ΉͶ໰୊͸ى͖ͳ͔ͬͨ • ৽ܾࡁγεςϜͷϏδϣϯΛڞ༗͍ͯͨ͠ • → ͍͖ͳΓγεςϜ͕ૠ͛ସΘΔ͜ͱ͸ͳ͔ͬͨ

Slide 25

Slide 25 text

ϞϊϦγοΫͳνʔϜ • ͸ͯͳϒϩάଆͷ։ൃͱ৽ܾࡁγεςϜͷ։ൃϝϯόʔΛ Ұகͤͨ͞ • (౰ॳɺ͸ͯͳϒϩάଆΛଞͷϝϯόʔʹ͓ئ͍͢Δ͜ͱ ΋ݕ౼͍ͯͨ͠) • → ஌͕ࣝڽू͞Εɺຊ౰ʹඞཁͳ΋ͷΛద੾ʹ࡞Εͨ

Slide 26

Slide 26 text

ૄ݁߹: ̋ • UI૚ͱAPI૚ΛผͷݴޠͰ࣮૷͢Δ͜ͱͰ෼அ • UI૚ = Perl, API૚ = Scala • → چγεςϜͰ໰୊ͱͳͬͨڞ༗ΧʔωϧԽΛ๷͙ • ޓ׵͕ඞཁͳೝূΛUI૚ʹཹΊΒΕͨ • → ݁Ռͱͯ͠UI૚͕API૚ʹର͢Δ෗ഊ๷ࢭ૚ʹͳΔ

Slide 27

Slide 27 text

ߴڽूੑ: ˚ • UI૚ͱAPI૚ͷσϓϩΠλΠϛϯάΛἧ͑Δඞཁ͕͋Δ • → ͚ͩ͜͜ݟΔͱ࣌ظঘૣͩͬͨײ͸͋Δ • ʮ࠷ॳͷ30೔ؒ͸ແྉͰར༻Ͱ͖Δʯͱ͍͏৘ใ͸ɺ
 ͸ͯͳϒϩάʹด͍ͯ͡ΔͷͰച্ूܭ͕΍΍೉͍͠ • → ϞσϦϯά͸ద੾ͩͬͨͱࢥ͏ͷͰɺ
 ूܭํ๏ͷվળͳͲͰΞϓϩʔν͍ͨ͠

Slide 28

Slide 28 text

࠾఺: 70఺ • ͋ͱ͔ΒϦΧόʔͮ͠Β͍఺ (ྫ: Ψόφϯε) ͸
 ઌʹखΛଧͯͨ • Ұํɺٕज़తͳΞϓϩʔν (ྫ: σϓϩΠɺ౷߹ςετ) ͸ ·ͩ·ͩ΍ΕΔ͜ͱ͕͋Δ

Slide 29

Slide 29 text

·ͱΊ

Slide 30

Slide 30 text

MicroservicesԽ͸ΞϦ͔ • ৽ܾࡁγεςϜͰ࠾༻ͨ͠ͷ͸ਖ਼ղͩͬͨ • Microservices͸ܥΛ࡞ΔͨΊͷσβΠϯ • = νʔϜ (ਓɺ૊৫) ·ͰϚΠΫϩʹ෼ׂ͢Δඞཁ͸ͳ͍ • ͦͷ୅ΘΓ͖ͪΜͱ๧ࢠΛඃΓ௚ͤͳ͍ͱ͍͚ͳ͍

Slide 31

Slide 31 text

׬