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
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
110
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
910
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
690
php-conference-japan-2024
tasuku43
0
350
Recoilを剥がしている話
kirik
5
7k
Haze - Real time background blurring
chrisbanes
1
520
Exploring: Partial and Independent Composables
blackbracken
0
100
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
150
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
910
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
130
103 Early Hints
sugi_0000
1
250
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Code Reviewing Like a Champion
maltzj
521
39k
Typedesign – Prime Four
hannesfritz
40
2.4k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Navigating Team Friction
lara
183
15k
Optimising Largest Contentful Paint
csswizardry
33
3k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Mobile First: as difficult as doing things right
swwweet
222
9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
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