Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
rails + serverengineで お手軽daemon
Search
threetreeslight
October 02, 2015
Technology
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
rails + serverengineで お手軽daemon
threetreeslight
October 02, 2015
More Decks by threetreeslight
See All by threetreeslight
実録 採用一投入魂
threetreeslight
0
50
Bottleneck is You
threetreeslight
0
140
Japan Office Society オフィスはスタートアップの成長を助長するのか?阻害するのか?
threetreeslight
0
140
スタートアップは見極められたくない
threetreeslight
0
65
VPoEの責務とは
threetreeslight
0
110
CiecleCIでもくもく会を支える技術
threetreeslight
0
70
Ego vs higher self
threetreeslight
0
53
Performance Hack 101
threetreeslight
0
120
複数のスタートアップを 通して得た失敗と学び
threetreeslight
0
95
Other Decks in Technology
See All in Technology
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.3k
自分で立ててみるLLMサービス
y_sera15
0
160
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.5k
SREでアラート疲れを 解決しよう!
kairim0
1
230
全人類(ほぼ)AWS Organizations の上でAWSを利用している、その世界を知る話
htan
1
140
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.2k
USB PDを使ってスマホを労わりたい
raspython3
0
160
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
3
860
転んだ話が背中を預ける理由になる / A_story_about_falling_down_gives_you_a_reason_to_watch_each_other_s_backs.pdf
pauli
3
360
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
Jetson Orin Nanoとk3sとローカルLLMで音声文字起こしシステム作ってみた
y_sera15
0
120
Getting Started with Google Antigravity
glaforge
0
210
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Scaling GitHub
holman
464
140k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
A designer walks into a library…
pauljervisheath
211
25k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
590
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
67k
The Curious Case for Waylosing
cassininazir
1
570
Building Adaptive Systems
keathley
44
3.2k
Claude Code のすすめ
schroneko
67
230k
Transcript
rails + serverengineͰ ͓खܰdaemon Akira Miki Repro Inc. shinjuku.rb #29@metaps
Sep 30, 2015
Akira Miki Repro @treetreeslight
None
ղੳ͔Βղܾ·ͰαΫοͱ
About job
ReproͰ͍ͬͯΔjob܈ serverengine sidekiq AWS lambda ࢹͯ͠ൃՐ੍ޚ͍ͨ͠ ฒྻΛ੍ݶ͍ͨ͠ ฒྻΛ੍ݶ͠ͳ͍ ΨϯΨϯॲཧ͍ͨ͠ 4ͳͲͷ"84πʔϧ܈
ͱγʔϜϨεͳ࿈ܞͯ͠ ΨγΨγॲཧ͍ͨ͠
ͲΜͳ͜ͱʹͬͯΔͷʁ serverengine sidekiq AWS lambda w ಈըͷม w ղੳσʔλΩϟογϡ w
ఆظܾࡁ w QVTI༧ͷࢹ w *O"QQରऀͷߋ৽ FUDʜ w ϝʔϧΛૹΔ w ղੳσʔλΛૹΔ w ৴σʔλͷ࡞ FUDʜ w 1VTIૹΔ FUDʜ
ͲΜͳ͜ͱʹͬͯΔͷʁ serverengine sidekiq AWS lambda w ಈըͷม w ղੳσʔλΩϟογϡ w
ఆظܾࡁ w QVTI༧ͷࢹ w *O"QQରऀͷߋ৽ FUDʜ w ϝʔϧΛૹΔ w ղੳσʔλΛૹΔ w ৴σʔλͷ࡞ FUDʜ w 1VTIૹΔ FUDʜ
બఆܦҢΛϓϩτλΠϓ࣌ͷ ʮஏ͔ͣ͠ʙʙʙ͍ʯ ࣦഊஊ౿·͑ͯ
ϓϩτλΠϓͩ͠ͱΓ͋͑ͣ cron Rake script SQS SDK ̍୯ҐͩΑ͒
͋ΕʁϝϞϦᷓΕͯͶʁ
ͦΓΌrailsrequireͯ͠rakeୟͱ ϝϞϦΊͬͪΌ৯͏ΑͶ!! ϓϩτλΠϓͱ͍͑ࡶ͗ͨ͢!!!
ϓϩτλΠϓͱ͍͑ ͪΐͬͱؾΛ͓͔ͬͯ͘ cron SQS SDK Server Ӆ͠URL
CPUΔ͖ͩͯ͠Δɾɾɾʁ
ffmpegͬͯݶք·Ͱ CPU͏͔ΒͶʂ ϓϩτλΠϓͱ͍͑ࡶ͗ͨ͢!!!
ͪΌΜͱ͢Δظ • railsͷmodelࢿ࢈Λ͍·Θ͠ • ffmpeg͕CPUΛ৯͍ਚ͘͢ͷͰฒྻ੍ݶͭͭ͠ • Rails requireͷϝϞϦͷΦʔόʔϔου࠷খݶʹ • ࣗલͰdaemonϥούʔॻ͍ͯྑ͍͚Ͳɺγάφ
ϧ੍ޚܥͱ͔ॻ͘ͷΊΜͲ͍ <- Ұ൪ίϨ
serverengine
serverengine ͍͢!!! SQS SDK serverengine long poling wΔ͜ͱʹ߹ΘͤͯXPSLFSௐͭͭ͠ wTVQFSWJTFSࢠͱ͍͏ૉఢߏ wϩά·ΘΓγάφϧʹΑΔϓϩηε੍ޚ·ͰόονϦ
ؾΛ͚ͭͨ͜ͱ
Exception def cycle invoke end def invoke( *arguments )
execute( *arguments ) rescue => error report_exception(error) end def execute( *arguments ) raise NotImplementedError end def report_exception(error) # logging, rollbar, newrelic ... end • handle͠ͳ͕Βࢭ·Βͣલਐ
Avoid memory leak • ʢrubyͷઃఆͰղܾͰ͖Δͱࢥ͏͚Ͳʣfragmentation͕ ཷ·ΔͷͰఆظతʹڧ੍GC class worker … def
run begin GC.stop cycle ensure GC.start end rescue Exception => error report_exception error end … end
Zombi process • long polingதʹdeployΛ࿈ଓ͢Δͱɺzombi͕Ͱ͖Δ serverengine serverengine.pid Kill Kill ̍ճ
2ճ start start pollingத serverengine.pid Override
Memory Usage • serverengineprocess modelͳͷͰɺrailsશ෦͚ͬͯ ΔͱϓϩηεϝϞϦΛ͍ͬͺ͍৯Δɻ worker worker server supervisor
͜Εࢹܥ͡Όͳ͍͠ sidekiqͰΑ͔ͬͨΜ͡Όʁ
Ͱͨ͠ serverengine sidekiq AWS lambda w ಈըͷม w ղੳσʔλΩϟογϡ w
ఆظܾࡁ w QVTI༧ͷࢹ w *O"QQͷλʔήοτߋ ৽ w ಈըͷม w ϝʔϧΛૹΔ w ղੳσʔλΛૹΔ w ৴σʔλͷ࡞ FUDʜ w 1VTIૹΔ FUDʜ
·ͱΊ • serverengine͏ͱdaemon͕α ΫοͱͰ͖Δ