GunosyでのMicroservicesの現状とGoの使いどころ
by
y_matsuwitter
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
GunosyͰͷ Microservisesͷݱঢ়ͱ Goͷ͍Ͳ͜Ζ @y_matsuwitter
Slide 2
Slide 2 text
ࣗݾհ • ։ൃຊ෦ࣥߦһࡶ༻ • iOS, Android, Infrastructure, Web • Golangڭ • ਖ਼࠲ • ࠷ۙؾʹͳΔͷ: MQTT
Slide 3
Slide 3 text
࠷ۙίʔυॻ͚ͯ·ͤΜ…
Slide 4
Slide 4 text
ࠓͷ • GunosyͰӡ༻͍ͯ͠ΔMicroservicesͷ • ͦͷதͰGoΛͲ͏͍ͬͯΔ͔
Slide 5
Slide 5 text
Microservices = খ͞ͳαʔϏεͷΈ߹Θͤ
Slide 6
Slide 6 text
What is microservices? • <=> Monolithic • దͳنͷϏδωευϝΠϯ͝ͱʹ෦αʔϏεΛׂ • ΞϓϦέʔγϣϯଆ͔Β֤छAPIΛݺͼग़͢ • αʔϏεʹ߹Θٕͤͨज़બఆΛ࣮ࢪ • SOAͷম͖͠
Slide 7
Slide 7 text
Why microservices? • Ϗδωεʹ߹ΘͤͨνʔϜͷׂɾฤ • খ͞ͳαʔϏεʹΑΔଐਓੑͷرബԽ • Ϗδωεཁٻʹର͢ΔॊೈͳରԠ • ͍Βͳ͍ͷΛࣺͯΒΕΔ ϞϊϦγοΫͳγεςϜͰɺϏδωε͕͢Δʹै͍վम ίετ͕૿Ճ͍ͯ͘͠
Slide 8
Slide 8 text
ࣄྫ: Soundcloud • طଘͷϞϊϦγοΫ͕͋ͬͨ • ϦϑΝΫλϦϯάͷஈ֊ͰαʔϏεΛੳ • ϏδωευϝΠϯ͝ͱʹMicroserviceΛߏங • FinagleϕʔεͷRPCͰେྔͷJVM্ͷΞϓϦΛ݁߹ • ͦͷ্Ͱ༷ʑͳݴޠΛӡ༻ ࢀߟ: Building Products at SoundCloud
Slide 9
Slide 9 text
MicroservicesͷதͰੜ ͖ΔGo
Slide 10
Slide 10 text
ͳͥGoͳͷ͔ • ֎෦ґଘͷͳ͍όΠφϦ • ܰྔ͔ͭϋΠύϑΥʔϚϯε • ڞ௨ϥΠϒϥϦΓग़ָ͕͠
Slide 11
Slide 11 text
GunosyͰͷ
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
• άϊγʔͱ͍͏୯ҰͷχϡʔεΞϓϦ • ෦ϏδωευϝΠϯ͝ͱʹׂ • PlatformߏʹΑΓ෦ͷϏδωευϝΠϯຖ݄̎ͭ΄Ͳ ૿͍͑ͯΔ
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
ࣾMicroserviceͷߏཁૉ • API༻HTTPαʔό • όονॲཧܥαʔό • ཧը໘ • Πϯϑϥߏɾཧπʔϧ
Slide 16
Slide 16 text
No content
Slide 17
Slide 17 text
APIαʔό • ༻ҙ͞ΕͨσʔλΛదͳυϝΠϯϩδοΫʹͯฦ٫ • େͷAPI͕Golang
Slide 18
Slide 18 text
APIαʔόɺ͍ͬͯΔͷ • Kami ... WebFramework • mogi ... SQL stub ϞσϧͳͲΛڞ༗ύοέʔδʹΓग़͠ɺ͍·Θ͢
Slide 19
Slide 19 text
ύοέʔδߏ • ϏδωευϝΠϯ͝ͱʹ1ϦϙδτϦ • ෦ߋʹࡉ͔͚ͨ͘υϝΠϯ͝ͱʹύοέʔδΛΔ example-service-1 ├── domain-1 ├── domain-2 ├── main.go └── routes.go common-package ├── domain-1 ├── domain-2 └── main.go
Slide 20
Slide 20 text
No content
Slide 21
Slide 21 text
όονॲཧ • ࣌ʹେྔͷσʔλΛɺAPIར༻KPIूܭͷͨΊʹར༻ • ෳαʔόͰͷฒྻॲཧ͕ඞཁͳ໘ଟʑ
Slide 22
Slide 22 text
όονॲཧ w/ Go • Goฐࣾͷόονॲཧʹࠓͷͱ͜Ζ΄΅ར༻͞Εͣ • େPython • ෳαʔόʹ·͕ͨΔͷPython + Celery • APIͱͷڞ௨ॲཧ͕͋Γɺ1ΠϯελϯεͰࡁΉॲཧͷΈGo • ʢCacheσʔλͷੜͳͲʣ
Slide 23
Slide 23 text
No content
Slide 24
Slide 24 text
ཧը໘ • σʔλεΩʔϚʹԠͯ͡ॊೈʹϑΥʔϜɾϦετΛੜɺॲ ཧ • ༷ʑͳόονॲཧΛΩοΫ͢Δ
Slide 25
Slide 25 text
ཧը໘ w/ Golang • ݴޠͷੑ࣭Ώ͑ɺॊೈͳϑΥʔϜੜɾӡ༻ʹ͍ͨπʔϧ গͳ͍ • ࣾͷཧܥDjango͔Rails͕ओ • APIܦ༝ͰGoAPIΛؒతʹར༻͢Δ͜ͱ͕ଟ͍ • νϟοτͷॲཧͳͲ
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
Πϯϑϥཧܥ • ֤छΞϓϦέʔγϣϯͷσϓϩΠ • ϞχλϦϯά
Slide 28
Slide 28 text
Πϯϑϥ w/ Go • ཧܥπʔϧͰGoͷͷଟ͍ • GoΛॻ͘͜ͱগͳ͍ • શମͷߏཧOpsworksͰ࣮ࢪ
Slide 29
Slide 29 text
σϓϩΠ w/ Go • go build͠ɺOpsworksʹΑΓඞཁͳϑΝΠϧ܈ΛS3ܦ༝Ͱ Β·͘ • CapistranoͷΓํʹ͍ۙσϓϩΠϑϩʔ /path/to/service ├── shared │ ├── logs │ ├── tmp │ └── config ├── 20150306085540 │ ├── bin │ ├── public │ └── etc... ├── 20150306090324 └── current -> /path/to/service/releases/20150306090324
Slide 30
Slide 30 text
·ͱΊ • ϏδωευϝΠϯ͝ͱʹҰͭͷαʔϏε܈Λ࡞ • GoʹͯύϑΥʔϚϯεΛ֬อͭͭ͠υϝΠϯؒɾϨΠϠʔؒ Ͱ࿈ܞ • ݱঢ়ͰαʔϏεͷՃʹ༨༟͕ग़ͯ͘Δఔʹ
Slide 31
Slide 31 text
Go + MicroservicesͰ αΫαΫαʔϏε֦େ
Slide 32
Slide 32 text
Future works... • gRPCͷར༻ʹΑΔαʔόؒ݁߹ • ΠϕϯτۦಈܕMicroservices(Reactive Microservices) • ৽͍͠هࣄ͕Ճ͞Εͨ => ֤αʔϏε͝ͱʹউखʹඞཁ ͳॲཧ։࢝