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
background job patterns
Search
Matt Yoho
May 23, 2012
Programming
520
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
background job patterns
Matt Yoho
May 23, 2012
Transcript
36 slides
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
More Decks by Matt Yoho
See All by Matt Yoho
Working with Git and GitHub
mattyoho
4
320
Qualitative Analysis of Algorithms
mattyoho
5
450
Metaprogramming Ruby
mattyoho
19
700
Exploiting The Resource Idiom
mattyoho
2
430
testing revisited - outside-in
mattyoho
1
130
shared_auth.pdf
mattyoho
0
2.3k
Request-Response cycle
mattyoho
5
200
Intro to Rest
mattyoho
6
600
Other Decks in Programming
See All in Programming
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
210
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
140
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
370
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
420
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
170
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
360
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
2
180
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
190
AI Augmentation Techniques with Liberty
ivargrimstad
1
510
はじめてのPLATEAU
nokonoko1203
1
660
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
2.3k
imagewebp()の向こう側: WebPはなぜ JPEG・PNGより軽いのか
yuzneri
0
130
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
5
4.1k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
750
Are puppies a ranking factor?
jonoalderson
2
4.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
680
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
810
AI: The stuff that nobody shows you
jnunemaker
PRO
12
1.3k
Documentation Writing (for coders)
carmenintech
77
5.6k
Building an army of robots
kneath
307
47k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
360
Chasing Engaging Ingredients in Design
codingconduct
0
400