$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
background job patterns
Search
Matt Yoho
May 23, 2012
Programming
2
500
background job patterns
Matt Yoho
May 23, 2012
Tweet
Share
More Decks by Matt Yoho
See All by Matt Yoho
Working with Git and GitHub
mattyoho
4
310
Qualitative Analysis of Algorithms
mattyoho
5
430
Metaprogramming Ruby
mattyoho
19
680
Exploiting The Resource Idiom
mattyoho
2
400
testing revisited - outside-in
mattyoho
1
120
shared_auth.pdf
mattyoho
0
2.3k
Request-Response cycle
mattyoho
5
190
Intro to Rest
mattyoho
6
580
Other Decks in Programming
See All in Programming
ゲームの物理 剛体編
fadis
0
330
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
370
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
230
Cap'n Webについて
yusukebe
0
130
TypeScript 5.9 で使えるようになった import defer でパフォーマンス最適化を実現する
bicstone
1
1.3k
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
1k
Integrating WordPress and Symfony
alexandresalome
0
150
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
380
配送計画の均等化機能を提供する取り組みについて(⽩⾦鉱業 Meetup Vol.21@六本⽊(数理最適化編))
izu_nori
0
150
AWS CDKの推しポイントN選
akihisaikeda
1
240
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
110
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
160
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
Git: the NoSQL Database
bkeepers
PRO
432
66k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Why Our Code Smells
bkeepers
PRO
340
57k
How to Ace a Technical Interview
jacobian
280
24k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.7k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
96
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
4 Signs Your Business is Dying
shpigford
186
22k
Transcript
Approaches to Background Jobs Wednesday, May 23, 12
Architectures Wednesday, May 23, 12
“one soul, two bodies” Wednesday, May 23, 12
Wednesday, May 23, 12
prenuptial agreement Wednesday, May 23, 12
Wednesday, May 23, 12
Types of Jobs Wednesday, May 23, 12
Run-once (Resque, DelayedJob) Wednesday, May 23, 12
Event occurs, job enqueued Worker instantiate job model Load AR
object(s) model Create AR object(s) Hit API job {id, token} job goes away Wednesday, May 23, 12
Recurring jobs (Recursive queuing) Wednesday, May 23, 12
Event occurs, job enqueued Worker instantiate job model Load AR
object(s) model Create AR object(s) Hit API job {id, token} Wait 90s re-enqueue self Wednesday, May 23, 12
Scheduled jobs (resque-scheduler, cron) Wednesday, May 23, 12
Event occurs, job scheduled Worker instantiate job model Load AR
object(s) model Create AR object(s) Hit API job {id, token} job goes away 90s enqueue job Wednesday, May 23, 12
CancelAbandonedOrders: cron: "*/5 * * * *" clear_leaderboards_contributors: cron: "30
6 * * 1" class: ClearLeaderboards queue: low args: contributors description: "Reset the weekly leaders" Wednesday, May 23, 12
Approach can work, but is a bit kludgy Wednesday, May
23, 12
Difficult or impossible to adjust intervals programmatically (dynamically) Wednesday, May
23, 12
May want to respond to traffic, load, rate-limiting, by adding
or subtracting workers, changing interval Wednesday, May 23, 12
Are we meeting the SLA? Wednesday, May 23, 12
Service Level Agreement Wednesday, May 23, 12
Service Level Agreement “At least every 5 minutes” Wednesday, May
23, 12
Hypothetical: SLA: 30 seconds Mean job time: 5 seconds Wednesday,
May 23, 12
Increased complexity and decision making around when to run “jobs”
Wednesday, May 23, 12
Sounds like an app Wednesday, May 23, 12
models, views, controllers, jobs, client libs Wednesday, May 23, 12
models, views, controllers, jobs, client libs jobs, client libraries Wednesday,
May 23, 12
models, views, controllers jobs, client libraries Wednesday, May 23, 12
models, views, controllers jobs, client libraries Wednesday, May 23, 12
models, views, controllers jobs, client libraries message queue Wednesday, May
23, 12
models, views, controllers jobs, client libraries message queue Emits event
messages Wednesday, May 23, 12
models, views, controllers jobs, client libraries message queue m “User
123 linked twitter account with token ‘abc’” Wednesday, May 23, 12
models, views, controllers jobs, client libraries message queue m “User
123 linked twitter account with token ‘abc’” Wednesday, May 23, 12
models, views, controllers jobs, client libraries message queue m Consumes
messages, acts Wednesday, May 23, 12
models, views, controllers jobs, client libraries message queue m Consumes
messages, acts Wednesday, May 23, 12
models, views, controllers jobs, client libraries message queue m “Every
30 seconds, I’ll hit the twitter api with token ‘abc’ and then the feed engine api for user 123” Wednesday, May 23, 12
Wednesday, May 23, 12
pros: increased flexibility & control horizontal scaling smaller apps fewer
specs per app cons: burden of complexity on you Wednesday, May 23, 12