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
When to use golang in production
Search
y_matsuwitter
March 11, 2015
Programming
3
9.5k
When to use golang in production
白ヤギ勉強会発表資料
y_matsuwitter
March 11, 2015
Tweet
Share
More Decks by y_matsuwitter
See All by y_matsuwitter
Product Utilization of Large Language Models Starting Today
ymatsuwitter
3
2.1k
経営・意思・エンジニアリング
ymatsuwitter
23
19k
LLM in 2023 and 2024
ymatsuwitter
8
5.2k
Turbulent Technological Changes and Career Strategies
ymatsuwitter
2
2.5k
LLM in toB Service and Its UX
ymatsuwitter
6
9.9k
Agent and small LLM validation
ymatsuwitter
7
2.9k
Information management for a culture of speed: The story of Notion and LayerX
ymatsuwitter
4
9.7k
Monorepo on AWS
ymatsuwitter
0
260
Tech behind LayerX SaaS products
ymatsuwitter
0
3k
Other Decks in Programming
See All in Programming
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
3
1.2k
Amazon Qを使ってIaCを触ろう!
maruto
0
420
ヤプリ新卒SREの オンボーディング
masaki12
0
130
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
3
320
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Functional Event Sourcing using Sekiban
tomohisa
0
100
CSC509 Lecture 11
javiergs
PRO
0
180
Vapor Revolution
kazupon
1
170
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Jakarta EE meets AI
ivargrimstad
0
660
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
120
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
How GitHub (no longer) Works
holman
310
140k
Docker and Python
trallard
40
3.1k
Speed Design
sergeychernyshev
25
620
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Producing Creativity
orderedlist
PRO
341
39k
Code Review Best Practice
trishagee
64
17k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Transcript
When to use golang in production @y_matsuwitter 1
ࣗݾհ • ։ൃຊ෦ࣥߦһࡶ༻ • iOS, Android, Infrastructure, Web • Golang!!
Docker!! • ਖ਼࠲ 2
ࠓͷ • ҰൠతͳWeb/AppαʔϏεʹ͓͚ΔGoݴޠͷӡ༻ʹ͍ͭͯ 3
Goݴޠͷಛ • CPUɾϝϞϦ྆໘͔Βݟͯܰྔ • Ͳ͜Ͱಈ࡞͢ΔόΠφϦ • ੩తܕ͚ݴޠ • ฒߦɾฒྻॲཧ͕ॻ͖͍͢ (goroutine)
4
Goݴޠͷۤखͳͷ • LL΄ͲͷॊೈੑͨͤͮΒ͍ʢreflectͱ͔͋Δ͚Ͳʣ 5
Α͋͘ΔWeb/Appͷߏ 6
ࢀߟ: GunosyͷΠϯ ϑϥ AWS ಋೖࣄྫɿGunosyגࣜձࣾΑΓ 7
NativeApp iOS/AndroidͰಈ࡞͢ΔόΠφϦΛੜ͢Δ • go.mobile • go v1.4͔ΒAndroidΞϓϦ࡞Ε·͢ • go v1.5͔ΒiOSαϙʔτ։࢝
8
NativeApp: GunosyͰͷ • go-mobileΛɺGoͱ֤छΫϥΠΞϯτͷϞσϧपΓڞ௨Խʹ ͏ݕ౼ ͔͠͠ࠓͷͱ͜Ζ࣮༻తͰͳ͍ 9
Web App ֤ϖʔδͷHTMLඳը • text͚ɺhtml͚ͦΕͧΕͷTemplateΛඪ४Ͱඋ͍͑ͯ· ͢ • net/httpͰେࣄΓ·͢ ͨͩ͠ɺRailsDjangoͷϖʔδϨϯμϦϯάػߏͱൺΔͱ ॊೈੑ͘ɺΓͳ͍
10
Web Appʹ͍ͭͯ SPA͕ओྲྀʹͳ͍ͬͯΔ͜ͱΛߟ͑ΔͱɺϖʔδͷϗεςΟϯά ʹͦΕ΄Ͳߴػೳඞཁͳ͍ ϑΝΠϧΛฦ͚ͩ͢Ͱ͋ΕGolangͰे ϖʔδͷ։ൃjsͷ্ʹ͔ͬΖ͏ 11
Web Appʹ͍ͭͯ: GunosyͰͷ ฐࣾͷWebApp։ൃͰ • ϖʔδϋϯυϥGo • ϑϩϯτΤϯυʢHTML, JS, CSSʣશͯgulpͰ։ൃ
• σʔλجຊతʹAPIܦ༝Ͱͷऔಘ ͱ͍͏ܗࣜʹ͍ͯ͠·͢ɻ APIܦ༝ʹ౷Ұ͢Δ͜ͱͰωΠςΟϒΞϓϦͱWebͷ༷Λڞ௨ 12
API ओλεΫ: ύϥϝλΛड͚औΓదͳϏδωεϩδοΫΛܦͯ JSONͳͲΛฦ٫͢Δ • Go͕Ұ൪׆༂ • ϋΠύϑΥʔϚϯεͳAPIΛظؒͰߏங͍͢͠ 13
API: GunosyͰͷ • ࣗࣾWebFWͷKamiΛར༻ • ڞ௨ॲཧΛผϦϙδτϦͰཧ͠go get • nginx͔ΒϓϩΩγ͢Δ߹͋Δ •
WebSocketར༻ͷ߹DNSϥϯυϩϏϯͰৼΓ͚͠ GoͰड͚͢Δ 14
ؓٳ: GoͷORMʹ͍ͭͯ • GunosyͰORMΛ͓ͬͯΓ·ͤΜ • GORM͕ओྲྀͳ༷ • ւ֎൛ͷAPIʹͯGorpΛར༻͍ͯ͠Δ 15
AdminApp ओλεΫ: ΞϓϦέʔγϣϯཧऀ͕DB্ͷσʔλɺKPIͳͲ ͷཧΛߦ͏ • GoͷදݱྗͰߏஙͷͨΊʹશͯͷϩδοΫΛهड़͢Δ͜ͱ ͕ଟ͍ • ͜ͷΜdjango-adminRailsAdminΛ͏΄͏͕ͤ 16
AdminApp: GunosyͰͷ • ͓͓ΑͦDjango-admin͕ར༻͞Εͭͭ͋Γ·͢ • KPIμογϡϘʔυʹGeckoBoardMackerelΛݕ౼ɾར ༻͠ӡ༻ίετݮ • Goཧը໘͕Ұ͚ͭͩ͋Γ·͕͢ɺ΄΅ෳࡶͳػೳͷΈʹ ಛԽʢνϟοτΛฦ͢ͳͲʣ
17
ूܭɾόονॲཧ ఆظతʹɺ࣌ʹେنͳσʔλॲཧΛߦ͏ • Goࣗମͷॲཧੑೳߴ͍͕ɺॊೈ͞ʹ͔͚Δ • ෳHostͰεέʔϧͤ͞Α͏ͱ͢ΔͱGoʹ·ͩ͜ͳΕͨ Έ͕ͳ͍ • ...gRPC? 18
ूܭɾόονॲཧ: GunosyͰͷ • ΄ͱΜͲPython + CeleryͰॲཧ͍ͯ͠Δ • େCeleryͰͷࢄ͕εέʔϧ͘͢͠Pythonࢿ࢈͋ ΔͷͰָ •
Ұ෦ͷΩϟογϡΛࡌͤΔΑ͏ͳॲཧAPIͰ༻ͨ͠Goͷ ϞσϧΛ͏͜ͱ 19
ؓٳ: Goͱػցֶश • աڈminhashͱ͔࡞ͬͯΈͨ • ྻॲཧ͕ͭΒ͍ • δΣωϦΫεແ͍ͷͰΧίΠΠmapͳ͍ • Golearnͱ͔͋Γ·͕͢…
20
Πϯϑϥཧɾࢹ • ߏཧChef/AnsibleͳͲΛ͑Δͷͳ͍ • GoΠϯϑϥπʔϧࣗମ૿͍͑ͯΔ • πʔϧΛ͏͜ͱ͋ͬͯɺGoΛ͏͜ͱׂͱগͳ͍ 21
Πϯϑϥཧɾࢹ: GunosyͰͷ • GoͰͨ͠πʔϧಛʹ͋Γ·ͤΜ • ࣾ࠾༻ͷGoπʔϧ܈ Mackerel-agent, Docker, ...etc 22
Ҏ্౿·͑ͯͷఏҊత·ͱΊ • ΞϓϦ։ൃͦΕͧΕͷSDK • WebSPAલఏͰΔ߹ʹGo • APIΛGoɺϋΠύϑΥʔϚϯε͔ͭσϓϩΠ͍͢͠ • ཧը໘django-adminͳͲϑϧελοΫFWָ͕ 23
Ҏ্౿·͑ͯͷఏҊత·ͱΊ(͖ͭͮ) • ूܭɾόονPython + CeleryͳͲطଘࢿ࢈Λ͏΄͏͕Α ͍ • ΠϯϑϥGoπʔϧͷ׆༂͕૿͑Δ 24
࠷ޙʹ • খنͳίʔυϕʔεʹ͑ΔͳΒɺύϑΥʔϚϯεͷ໘͔ ΒݟͯGo࠷ߴ 25