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
resque-scheduler
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Fumiaki MATSUSHIMA
November 30, 2016
Programming
200
0
Share
resque-scheduler
Shinjuku.rb #43 発表資料
https://shinjukurb.connpass.com/event/44524/
Fumiaki MATSUSHIMA
November 30, 2016
More Decks by Fumiaki MATSUSHIMA
See All by Fumiaki MATSUSHIMA
Learning from performance improvements on GraphQL Ruby
mtsmfm
1
1.3k
Ruby で作る Ruby (物理)
mtsmfm
1
270
GraphQL Ruby benchmark
mtsmfm
1
900
タイムアウトにご用心 / Timeout might break application state
mtsmfm
6
2.7k
Build REST API with GraphQL Ruby
mtsmfm
0
390
GraphQL Ruby をちょっとだけ速くした / Make graphql-ruby faster a bit
mtsmfm
1
780
Gaming PC on GCP
mtsmfm
0
800
How to introduce GraphQL to an existing React-Redux application
mtsmfm
1
310
Canary release in StudySapuri
mtsmfm
0
3.2k
Other Decks in Programming
See All in Programming
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
490
Making the RBS Parser Faster
soutaro
0
710
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1k
PHPer、Cloudflare に引っ越す
suguruooki
1
160
Firefoxにコントリビューションして得られた学び
ken7253
2
160
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
450
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
140
Road to RubyKaigi: Play Hard(ware)
makicamel
1
570
継続的な負荷検証を目指して
pyama86
3
1.1k
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.7k
Are We Really Coding 10× Faster with AI?
kohzas
0
150
JCON - Create Agentic AI Apps, The Easy Way!
kdubois
1
110
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
250
My Coaching Mixtape
mlcsv
0
120
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
390
YesSQL, Process and Tooling at Scale
rocio
174
15k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
310
The Cult of Friendly URLs
andyhume
79
6.9k
Amusing Abliteration
ianozsvald
1
160
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Transcript
(株)永和システムマネジメント @mtsmfm 松島 史秋 resque-scheduler
松島 史秋 GitHub, Twitter @mtsmfm
ポケモン S/M まっちまー フレコ 1907-9185-9222
None
resque- scheduler
https://github.com/resque/resque-scheduler
大きく2つの 機能
- Delay - Schedule
- Delay - 10分後に実行 - Schedule - cron
resque 単体だと できない
ActiveJob
http://edgeguides.rubyonrails.org/active_job_basics.html#enqueue-the-job
ActiveJob が やってくれたり してないかな
Emoji provided free by Emoji One
https://github.com/mtsmfm/ resque-scheduler-example
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque- scheduler.rb#L4
挙動が違う
https://github.com/jmettraux/rufus-scheduler/blob/master/lib/rufus- scheduler.rb
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/tasks.rb#L17-L18
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/cli.rb#L117
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L59-L70
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L65-L67
Lock
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L3-L50
- master プロセスが落ちたときに複数回 enqueue されないための機構 - Redis の SETNX を使っている
- Delayed job は SETNX で単純な十分 - Scheduled job (cron っぽい方) は頻繁に master が変わると、マシンの時間がずれて いる場合に厳しい - (デフォルトだと) 3 分ごとに lock をとる - 2 回走ってもいいときや時間の同期がきっち りされているなら短くするとよい
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L59-L70
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L181-L190
Schedule job は?
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L3-L50
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler/locking.rb#L28-L30
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L49-L53
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L89-L104
https://github.com/resque/resque-scheduler/blob/v4.3.0/lib/resque/ scheduler.rb#L124-L163
学び
- 概要のわかる ドキュメント大事 - resque-scheduler は 多重実行されるくらいなら job が失われた方がいいという方 針
- Lock 機構難しい