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.2k
経営・意思・エンジニアリング
ymatsuwitter
23
19k
LLM in 2023 and 2024
ymatsuwitter
8
5.3k
Turbulent Technological Changes and Career Strategies
ymatsuwitter
2
2.6k
LLM in toB Service and Its UX
ymatsuwitter
6
10k
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
270
Tech behind LayerX SaaS products
ymatsuwitter
0
3k
Other Decks in Programming
See All in Programming
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
740
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
talk-with-local-llm-with-web-streams-api
kbaba1001
0
180
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
103 Early Hints
sugi_0000
1
230
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
740
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
180
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
ドメインイベント増えすぎ問題
h0r15h0
2
290
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
The Language of Interfaces
destraynor
154
24k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
170
Producing Creativity
orderedlist
PRO
341
39k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Music & Morning Musume
bryan
46
6.2k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
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