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.6k
Monorepo on AWS
ymatsuwitter
0
260
Tech behind LayerX SaaS products
ymatsuwitter
0
3k
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
役立つログに取り組もう
irof
28
9.6k
Jakarta EE meets AI
ivargrimstad
0
610
Ethereum_.pdf
nekomatu
0
460
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
EventSourcingの理想と現実
wenas
6
2.3k
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
210
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
What's new in Ruby 2.0
geeforr
343
31k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Building an army of robots
kneath
302
43k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Facilitating Awesome Meetings
lara
50
6.1k
Speed Design
sergeychernyshev
25
620
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Navigating Team Friction
lara
183
14k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
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