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
2016/05/16 adtech x scala meetup のLT
Search
Tomohisa Omagari
July 03, 2016
Programming
1
77
2016/05/16 adtech x scala meetup のLT
Tomohisa Omagari
July 03, 2016
Tweet
Share
More Decks by Tomohisa Omagari
See All by Tomohisa Omagari
事業貢献を考えるための技術改善の目標設計と改善実績 / Targeted design of technical improvements to consider business contribution and improvement performance
oomatomo
0
150
プロダクト開発の貢献をアピールするための目標設計や認知活動 / Goal design and recognition activities to promote product development contributions.
oomatomo
5
1.3k
多様性のあるプロダクトチームを目指した共創の3年間の変化 / Three Years of Co-Creation for Diverse Product Teams Change
oomatomo
1
98
事業貢献を見据えた モダナイゼーションへの挑戦
oomatomo
1
59
UXへの投資と組織変革 ─ ビジネスに貢献するUXチームの飛躍 ─
oomatomo
1
43
Finagleを使った広告配信基盤
oomatomo
0
470
Finagleを使った Perl -> Scalaへの移行
oomatomo
0
1.9k
Other Decks in Programming
See All in Programming
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
810
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
960
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
350
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
Spatial Rendering for Apple Vision Pro
warrenm
0
150
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
103 Early Hints
sugi_0000
1
260
テストコード書いてみませんか?
onopon
2
210
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
950
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
8
1.9k
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Side Projects
sachag
452
42k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
RailsConf 2023
tenderlove
29
940
How to train your dragon (web standard)
notwaldorf
88
5.7k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
170
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Fireside Chat
paigeccino
34
3.1k
Visualization
eitanlees
146
15k
Transcript
ͳΔͬͯଟ͍ΑͶʁ
ࣗݾհ େۂஐٱ
͋Δػೳͷ ( D: σΟϨΫλʔɺE:ΤϯδχΞ) ▸ Dʮ͜ͷػೳɺཧը໘͕มߋ͞ΕͨΒߋ৽ͯ͠΄͍͠ɻ ɹɹ͋ͱɺؔ࿈͢Δσʔλมߋͯ͠΄͍͠ɻʯ ▸ Eʮ͜ͷػೳͷߋ৽සɺͲΕ͘Β͍ʹ͠·͢ʁʯ ▸
DʮͳΔͰʯ ▸ E ʮ10͝ͱͰ͍͍Ͱ͔͢ʁʯ ▸ Dʮ͏ʙΜɺͬͱͳΔͰʯ ▸ Eʮ̑ʯ ▸ Dʮ͏ʙΜɺͬͱͳΔͰʯ
͋Δػೳͷ ( D: σΟϨΫλʔɺE:ΤϯδχΞ) ▸ Eʮ̍ʯ ▸ Dʮ͏ʙΜɾɾɾɾʯ ▸ EʮϚδ͔ʯ
͋Δػೳͷ ( D: σΟϨΫλʔɺE:ΤϯδχΞ) ▸ E ʮ30ඵʯ(͏Ͳ͏ʹͰͳΕʣ ▸ Dʮ͓͓͓ʯ ▸
Eʮ10ඵʯ ▸ Dʮʯ ▸ Eʮ1ඵʯ ▸ Dʮ࠷ߴʯ
Θ͔͍ͬͯΔ͜ͱ ▸ όονॲཧͰͦ͠͏ ▸ ΩϡʔॲཧͰΕɺ͍ΖΜͳλΠϛϯάͰॲཧͰ͖ͦ͏ ▸ ॲཧ͕ॏෳ͠ͳ͍Α͏ʹ͢Δ
ઃܭͷΠϝʔδਤ
ઃܭͷΠϝʔδਤ ͜͜ͷ෦Λ࡞Δ
Γ͍ͨ͜ͱ ▸ όονॲཧͰɺݫ͍ͨ͠ΊσʔϞϯԽ͢Δ ▸ ͍͍ײ͡ʹΩϡʔॲཧͷ࣮ߦ࣌ؒΛมߋͰ͖Δ ▸ ΩϡʔॲཧͷछྨΛىಈ࣌ͷίϚϯυͰ ࢦఆͰ͖ΔΑ͏ʹ͍ͨ͠
ͬͨ͜ͱ ແݶϧʔϓ ▸ PerlͰ࣮͍ͯͨ͠Έ͍ͨʹ࣮ ▸ SIGTERMͷΩϟονͯ͠ ແݶϧʔϓΛऴྃͤ͞Δ
݁Ռ ແݶϧʔϓ ▸ ॲཧ͕࣌ʑɺ͖ͪΜͱऴྃͨ͠Γ͠ͳ͔ͬͨΓͨ͠ɻ (SIGTERM ͷνΣοΫ͕͓͔͔ͬͨ͠ͷ͔ɻɻ) ຖճͷ࠶ىಈ͕ා͔ͬͨɻɻ ▸ ࣗͰσʔϞϯͷϓϩηε͕ಈ͍͍ͯΔ͔ νΣοΫ͢Δඞཁ͕͋ͬͨ
▸ ৭ʑͱਏ͔ͬͨ
ͬͨ͜ͱ Play + akka scheduler ▸ PlayͷϞδϡʔϧͱͯ͠ ActorͷॲཧΛ࣮ߦ͢ΔΑ͏ʹͨ͠ ▸ Playͱͯ͠ͷػೳɺಛʹར༻͍ͯ͠ͳ͍
(Controllerͱ͔) ▸ ىಈ࣌ͷҾͰॲཧͷछྨΛมߋ
ͬͨ͜ͱ Play + akka scheduler
ͬͨ͜ͱ Play + akka scheduler ActorΛఀࢭ͢ΔλΠϓɺStopʹ͍ͯ͠Δ ཧ༝ɿϝοηʔδɺ͋͘·ͰॲཧΛ࣮ߦ͢ΔͨΊͷτϦΨʔͱׂͯ͠ PoisonPill Stop
ͬͨ͜ͱ Play + akka scheduler Actorͷઃఆ ɾϝοηʔδ͕ᷓΕͨΒແࢹ͢Δ ɾDead LetterΛແࢹ͢Δ ɾฒྻԽ͠ͳ͍
ͬͨ͜ͱ Play + akka scheduler ManagerActor ɾҾΛݩʹ࣮ߦ͍ͨ͠childActorΛࢦఆ͢Δ ɾchildActor͕ఀࢭ͍ͯΔ͔Ͳ͏͔ͷ ɹεςʔλεΛ͍࣋ͬͯΔ
ɹ(isAliveChildActorͷ෦) ɾManagerActorͷఀࢭΛड͚ͨΒɺ ɹ࣮ߦ͍ͯ͠ΔchildActorΛstop͢Δ ɹTerminatedͨ͠߹ɺεςʔλεΛ ɹfalseʹ͢Δ
ͬͨ͜ͱ Play + akka scheduler Playىಈ࣌ͷManagerActorͷॲཧ
ͬͨ͜ͱ Play + akka scheduler PlayΛఀࢭ͢Δࡍͷॲཧ ɾManagerActorͷఀࢭΛ֬ೝ ͢Δ·Ͱແݶϧʔϓ
ͬͨ͜ͱ Play + akka scheduler ▸ ىಈ࣌ͷίϚϯυ test1ͷॲཧΛ࣮ߦ͍ͨ͠߹ɿ activator run
-Ddaemon-process=test1 test2ͷॲཧΛ࣮ߦ͍ͨ͠߹ɿ activator run -Ddaemon-process=test2
݁Ռ Play + akka scheduler ▸ σʔϞϯԽָ͕ (σʔϞϯͰ໘ͳ෦ΛPlay͕ͬͯ͘ΕΔʣ ▸ Ҿ͝ͱʹ࣮ߦ͍ͨ͠ActorΛબͰ͖Δ
▸ JVMͷOld Memory͕ཷ·Γଓ͚͍ͯΔͷͰɺ ̍Ұճ࠶ىಈ͍ͯ͠·͢ɻ ʢ͍͔͍ͭͨ͠ʣ
Play + akka schedulerΛ͑ɻɻ( D: σΟϨΫλʔɺE:ΤϯδχΞ) ▸ Dʮ͜ͷػೳɺཧը໘͕มߋ͞ΕͨΒߋ৽ͯ͠΄͍͠ʯ ▸ Eʮ͜ͷػೳͷߋ৽සɺͲΕ͘Β͍ʹ͠·͢ʁʯ
▸ DʮͳΔͰʯ ▸ E ʮ͡Όɺ50msͰ͍͍Ͱ͔͢ʁʯ ▸ Dʮ͑ʂʁ͗͢͡ΌͶʁʯ
Έͳ͞ΜɺͲ͏ͬͯ·͔͢ʁ ڭ͍͑ͯͩ͘͞ɻ
ऴΘΓ αϯϓϧίʔυ https://github.com/oomatomo/scala-akka-daemon