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
Golangで学ぶHot deployの仕組み
Search
tsurubee
June 28, 2018
Programming
2
1.3k
Golangで学ぶHot deployの仕組み
Server::Starterの仕組みを学び、Golangでミニマムで 実装してみた
tsurubee
June 28, 2018
Tweet
Share
More Decks by tsurubee
See All by tsurubee
言語モデルによるAI創薬の進展 / Advancements in AI-Driven Drug Discovery Using Language Models
tsurubee
2
420
AIトップカンファレンスからみるData-Centric AIの研究動向 / Research Trends in Data-Centric AI: Insights from Top AI Conferences
tsurubee
3
2.7k
DeepCrysTet: A Deep Learning Approach Using Tetrahedral Mesh for Predicting Properties of Crystalline Materials
tsurubee
0
1.1k
3次元メッシュで表現した結晶構造を用いた材料物性の予測に向けた深層学習モデルの設計 / Design of Deep Learning Model for Predicting Material Properties Using Crystal Structure Represented by Three-Dimensional Mesh
tsurubee
1
2.3k
分散システムの性能異常に対する機械学習の解釈性に基づく原因診断手法 / A Method for Diagnosing the Causes of Performance Issues in Distributed Systems Based on the Interpretability of Machine Learning
tsurubee
0
1.5k
機械学習の解釈性に関する研究動向とシステム運用への応用 / A Survey on Interpretable Machine Learning and Its Application for System Operation
tsurubee
0
350
機械学習モデルの局所的な解釈に着目したシステムにおける異常の原因診断手法の構想
tsurubee
0
7.9k
アニーリングマシンを活用したエッジAIにおける 生成モデルの学習効率化のためのアーキテクチャ
tsurubee
0
1.5k
さくらインターネット研究所で研究に再挑戦した私の半年間の取り組み
tsurubee
1
3k
Other Decks in Programming
See All in Programming
管你要 trace 什麼、bpftrace 用下去就對了 — COSCUP 2025
shunghsiyu
0
470
ワープロって実は計算機で
pepepper
2
1.4k
State of CSS 2025
benjaminkott
1
120
CSC305 Summer Lecture 12
javiergs
PRO
0
130
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
220
ゲームの物理
fadis
5
1.5k
コーディングエージェント時代のNeovim
key60228
1
110
実践!App Intents対応
yuukiw00w
1
360
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
15
8.4k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
200
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.1k
Langfuseと歩む生成AI活用推進
licux
3
300
Featured
See All Featured
Site-Speed That Sticks
csswizardry
10
790
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
283
13k
How GitHub (no longer) Works
holman
315
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Agile that works and the tools we love
rasmusluckow
329
21k
Building Applications with DynamoDB
mza
96
6.6k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Scaling GitHub
holman
462
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Transcript
!UTVSVCFF(.01FQBCP *OD भΠϯϑϥަྲྀษڧձ ,JYT 7PM (PMBOHͰֶͿ )PUEFQMPZͷΈ
(.0ϖύϘɹΠϯϑϥΤϯδχΞ !UTVSVCFF
݄(.0ϖύϘೖࣾ ΠϯϑϥΤϯδχΞྺϲ݄
࣍ w)PUEFQMPZͱʁͳͥඞཁ͔ʁ w)PUEFQMPZͷΈ w(PMBOHͰ࣮ͯ͠Έͨ
͍͑ͨ͜ͱ wμϯλΠϜθϩΛࢧ͑Δ)PUEFQMPZͷΈͷҰྫ w(PMBOHΛ௨ͯ͡ϨΠϠʔͷٕज़ΛֶͿ͜ͱͰɺ ΤϯδχΞͱͯ͠ͷ෯͕͕ΔͷͰʁ wٕज़ॻಡΜͰ;Ή;Ή͢ΔΑΓ࣮ͯ͠Έͨํ͕ཧղ ͍͢͠
)PUEFQMPZͱʁ ͳͥඞཁ͔ʁ
)PUEFQMPZͱʁ wΞϓϦέʔγϣϯʹϩδοΫઃఆͷมߋΛՃ͑ͨࡍ ʹɺϦΫΤετͷॲཧΛଓ͚ଓ͚ͳ͕Βɺมߋͷ༰Λ ө͢ΔͨΊͷखஈ
)PUEFQMPZͱʁ wΞϓϦέʔγϣϯʹϩδοΫઃఆͷมߋΛՃ͑ͨࡍ ʹɺϦΫΤετͷॲཧΛଓ͚ଓ͚ͳ͕Βɺมߋͷ༰Λ ө͢ΔͨΊͷखஈ ҰൠతͳσϓϩΠʢ/05)PUEFQMPZʣ 4PVSDFDPEF DIBOHF (PMBOHͷ߹ɺ όΠφϦͷ্ॻ͖
)PUEFQMPZͱʁ wΞϓϦέʔγϣϯʹϩδοΫઃఆͷมߋΛՃ͑ͨࡍ ʹɺϦΫΤετͷॲཧΛଓ͚ଓ͚ͳ͕Βɺมߋͷ༰Λ ө͢ΔͨΊͷखஈ ҰൠతͳσϓϩΠʢ/05)PUEFQMPZʣ 4PVSDFDPEF DIBOHF "QQMJDBUJPO 4UPQ (PMBOHͷ߹ɺ
όΠφϦͷ্ॻ͖
)PUEFQMPZͱʁ wΞϓϦέʔγϣϯʹϩδοΫઃఆͷมߋΛՃ͑ͨࡍ ʹɺϦΫΤετͷॲཧΛଓ͚ଓ͚ͳ͕Βɺมߋͷ༰Λ ө͢ΔͨΊͷखஈ ҰൠతͳσϓϩΠʢ/05)PUEFQMPZʣ 4PVSDFDPEF DIBOHF "QQMJDBUJPO 4UPQ "QQMJDBUJPO
4UBSU (PMBOHͷ߹ɺ όΠφϦͷ্ॻ͖ ࠶ىಈ
)PUEFQMPZͱʁ wΞϓϦέʔγϣϯʹϩδοΫઃఆͷมߋΛՃ͑ͨࡍ ʹɺϦΫΤετͷॲཧΛଓ͚ଓ͚ͳ͕Βɺมߋͷ༰Λ ө͢ΔͨΊͷखஈ ҰൠతͳσϓϩΠʢ/05)PUEFQMPZʣ 4PVSDFDPEF DIBOHF "QQMJDBUJPO 4UPQ "QQMJDBUJPO
4UBSU (PMBOHͷ߹ɺ όΠφϦͷ্ॻ͖ ϦΫΤετΛॲཧ Ͱ͖ͳ͍͕࣌ؒൃੜ ࠶ىಈ
)PUEFQMPZ͕ͳͥඞཁ͔ʁ wΘ͔ͣͳؒͰՔಇ͍ͯ͠ΔαʔϏεΛࢭΊͨ͘ͳ͍ w)PUEFQMPZΛಋೖ͢Δ͜ͱͰɺγεςϜӡ༻ʹ͓͚Δ อकੑ্͕͠ɺਝͳ։ൃαΠΫϧ͕࣮ݱͰ͖Δ
)PUEFQMPZͷΈ
4FSWFS4UBSUFS w؆୯ʹ)PUEFQMPZͰ͖ΔΑ͏ʹ͢ΔͨΊͷDQBONPEVMF w1FSMͰ࣮͞Ε͍ͯΔ͕ɺγάφϧͱڥมΛͬͨ ൚༻ੑͷߴ͍ΈͷͨΊɺ͞·͟·ͳݴޠͰར༻Մೳ
4FSWFS4UBSUFS w؆୯ʹ)PUEFQMPZͰ͖ΔΑ͏ʹ͢ΔͨΊͷDQBONPEVMF w1FSMͰ࣮͞Ε͍ͯΔ͕ɺγάφϧͱڥมΛͬͨ ൚༻ੑͷߴ͍ΈͷͨΊɺ͞·͟·ͳݴޠͰར༻Մೳ ಈ࡞Λݴ༿Ͱઆ໌͢Δͱɾɾ ʮ৽͍͠ϓϩηεΛىಈͯ͠৽͍͠ϦΫΤετΛͦͪΒʹ ྲྀͭͭ͠ɺݹ͍ϓϩηεͷϦΫΤετ͕ྃͨ͠Βਖ਼͘͠ ऴྃͤ͞Δʯ
4FSWFS4UBSUFS w؆୯ʹ)PUEFQMPZͰ͖ΔΑ͏ʹ͢ΔͨΊͷDQBONPEVMF w1FSMͰ࣮͞Ε͍ͯΔ͕ɺγάφϧͱڥมΛͬͨ ൚༻ੑͷߴ͍ΈͷͨΊɺ͞·͟·ͳݴޠͰར༻Մೳ ಈ࡞Λݴ༿Ͱઆ໌͢Δͱɾɾ ʮ৽͍͠ϓϩηεΛىಈͯ͠৽͍͠ϦΫΤετΛͦͪΒʹ ྲྀͭͭ͠ɺݹ͍ϓϩηεͷϦΫΤετ͕ྃͨ͠Βਖ਼͘͠ ऴྃͤ͞Δʯ (SBDFGVM3FTUBSUʢ༏խͳ࠶ىಈʣ
)PUEFQMPZͷΈʢ؆қ൛ʣ TUBSU@TFSWFS 1BSFOU start_server —-port 8888 —- ./server TFSWFS $IJME
TPDLFU GPSLFYFD TPDLFUΛڞ༗ BDDFQU TUBSU@TFSWFSɿ(SBDFGVMSFTUBSUͷͨΊͷϓϩάϥϜ TFSWFSɿ࣮ߦ͍ͨ͠ϓϩάϥϜ
)PUEFQMPZͷΈʢ؆қ൛ʣ TUBSU@TFSWFS 1BSFOU start_server —-port 8888 —- ./server TFSWFS $IJME
TPDLFU GPSLFYFD TPDLFUΛڞ༗ BDDFQU TUBSU@TFSWFSɿ(SBDFGVMSFTUBSUͷͨΊͷϓϩάϥϜ TFSWFSɿ࣮ߦ͍ͨ͠ϓϩάϥϜ ᶃϓϩάϥϜʹมߋʂ
)PUEFQMPZͷΈʢ؆қ൛ʣ kill -HUP <master pid> TPDLFU BDDFQU TUBSU@TFSWFS 1BSFOU TFSWFS
$IJME TUBSU@TFSWFSɿ(SBDFGVMSFTUBSUͷͨΊͷϓϩάϥϜ TFSWFSɿ࣮ߦ͍ͨ͠ϓϩάϥϜ ᶄ4*()61 ᶃϓϩάϥϜʹมߋʂ
)PUEFQMPZͷΈʢ؆қ൛ʣ kill -HUP <master pid> TPDLFU GPSLFYFD TFSWFS $IJME ᶄ4*()61
BDDFQU BDDFQU TUBSU@TFSWFS 1BSFOU TFSWFS $IJME ᶅ৽ϓϩάϥϜͰىಈ ᶃϓϩάϥϜʹมߋʂ
)PUEFQMPZͷΈʢ؆қ൛ʣ kill -HUP <master pid> TPDLFU ऴྃ͢Δલʹʜ ᶃ৽نϦΫΤεड ɹͷఀࢭ ᶄݱࡏॲཧதͷ
ϦΫΤετͷྃ GPSLFYFD (SBDFGVM4IVUEPXO BDDFQU BDDFQU TUBSU@TFSWFS 1BSFOU TFSWFS $IJME ᶅ৽ϓϩάϥϜͰىಈ ᶄ4*()61 ᶆ4*(5&3. TFSWFS $IJME ᶃϓϩάϥϜʹมߋʂ
)PUEFQMPZͷΈʢ؆қ൛ʣ TUBSU@TFSWFS 1BSFOU kill -HUP <master pid> TPDLFU GPSLFYFD TFSWFS
$IJME BDDFQU ᶆ4*(5&3. ᶅ৽ϓϩάϥϜͰىಈ ᶄ4*()61 TFSWFS $IJME ᶃϓϩάϥϜʹมߋʂ ऴྃ͢Δલʹʜ ᶃ৽نϦΫΤεड ɹͷఀࢭ ᶄݱࡏॲཧதͷ ϦΫΤετͷྃ (SBDFGVM4IVUEPXO
࣮ͯ͠Έͨ
ϛχϚϜͰ࣮ͯ͠Έͨ IUUQTHJUIVCDPNUTVSVCFFHSBDFGVMSFTUBSUHP
࣮ϙΠϯτ̍ʙγάφϧϋϯυϥ func waitSignal(l net.Listener) { c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM) go func() { sig := <-c switch sig { case syscall.SIGTERM: signal.Stop(c) l.Close() } }() } γάφϧͱϓϩηεؒ௨৴ͷҰछ ϓϩηεʹγάφϧΛૹ৴͢Δͱɺͦͷϓϩηεͷਖ਼ৗॲཧʹׂΓࠐΜͰɺ γάφϧݻ༗ͷॲཧΛ࣮ߦͰ͖Δ ͓खܰʹγάφϧͷϋϯυϦϯά͕ Ͱ͖Δ
࣮ϙΠϯτ̍ʙγάφϧϋϯυϥ func waitSignal(l net.Listener) { c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM) go func() { sig := <-c switch sig { case syscall.SIGTERM: signal.Stop(c) l.Close() } }() } γάφϧͱϓϩηεؒ௨৴ͷҰछ ϓϩηεʹγάφϧΛૹ৴͢Δͱɺͦͷϓϩηεͷਖ਼ৗॲཧʹׂΓࠐΜͰɺ γάφϧݻ༗ͷॲཧΛ࣮ߦͰ͖Δ HPSPVUJOFͰγάφϧΛͪड͚Δ ͓खܰʹγάφϧͷϋϯυϦϯά͕ Ͱ͖Δ
࣮ϙΠϯτ̎ʙϑΝΠϧσΟεΫϦϓλ func forkExec(l *net.TCPListener) (*os.Process, error) { progName, _ :=
exec.LookPath(os.Args[0]) pwd, _ := os.Getwd() f, _ := l.File() defer f.Close() files := []*os.File{os.Stdin, os.Stdout, os.Stderr, f} fdEnv := fmt.Sprintf("%s=%d", "FD_KEY", len(files)-1) return os.StartProcess(progName, os.Args, &os.ProcAttr{ Dir: pwd, Env: append(os.Environ(), fdEnv), Files: files, }) } ϑΝΠϧσΟεΫϓϦΫλɺϑΝΠϧιέοτͳͲΛநԽͨ͠Έ ϓϩηεΛGPSLͨ͠ࡍɺϓϩηεͷϑΝΠϧσΟεΫϦϓλΛҾ͖ܧ͙
·ͱΊ w4FSWFS4UBSUFSͷΈΛֶͼɺ(PMBOHͰϛχϚϜͰ ࣮ͯ͠Έͨ wγάφϧϑΝΠϧσΟεΫϦϓλͱ͍ͬͨ֓೦ٕज़ॻΛಡ ΜͰ;Ή;Ή͢ΔΑΓɺ࣮ͯ͠Έͨ΄͏͕ཧղ͔ͬͨ͢͠ w(PMBOHଟ͘ͷ04ͷػೳΛ؆ܿͳίʔυͰѻ͑ΔͨΊɺ ࣗͷؔ৺ྖҬΛΑΓ͍ϨΠϠʔʹ͍͛ͯͨ͘Ίʹ దͨ͠ݴޠͩ
͋Γ͕ͱ͏͍͟͝·ͨ͠ʂʂ