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
UW Advanced Rails Week 5
Search
Ben Woodall
April 30, 2015
Programming
0
47
UW Advanced Rails Week 5
Ben Woodall
April 30, 2015
Tweet
Share
More Decks by Ben Woodall
See All by Ben Woodall
UW Advanced Rails Week 9
benwoodall
0
34
UW Advanced Rails Week 8
benwoodall
0
42
UW Advanced Rails Week 7
benwoodall
0
40
Week 6
benwoodall
0
40
UW Advanced Rails Week 4
benwoodall
0
60
UW Advanced Rails Week 3
benwoodall
0
63
UW Advanced Rails Week 2
benwoodall
0
87
UW Advanced Rails Week 1
benwoodall
0
93
A Bit More Git
benwoodall
1
5k
Other Decks in Programming
See All in Programming
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
520
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
240
PostmanでAPIの動作確認が楽になった話
h455h1
0
180
Ruby Pattern Matching
bkuhlmann
0
930
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
9
1.4k
効率化に挑戦してみたらモバイル開発が少し快適になった話
ryunakayama
0
140
Apache Hive 4 on Treasure Data
ryukobayashi
1
420
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
120
Ruby GitHub Packages
bkuhlmann
0
640
Tailwind CSSを本気でカスタマイズする方法
fsubal
14
5.5k
ゆるい個人開発のススメ
kuroppe1819
10
1k
Going beyond Apache Parquet's default settings
xhochy
0
130
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
12
2.4k
Docker and Python
trallard
35
2.7k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.2k
GitHub's CSS Performance
jonrohan
1025
450k
How to Ace a Technical Interview
jacobian
273
22k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
20
1.6k
Designing for Performance
lara
601
67k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
17
2.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
14
1.5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
A designer walks into a library…
pauljervisheath
201
23k
Transcript
Questions from Week 4? 1
Week 5: Background Jobs Spring 2015 2
What are Background Jobs? 3
What are Background Jobs? Process that are run in the
background Independent from our Rails app 4
When should you use Background Jobs? 5
When should you use Background Jobs? 6
Long Running Requests/ Processes 7
Long Running Requests/ Processes HTTP requests outside of your app
Image/Video Processing 8
Tasks to be Run at a Later Date 9
Tasks to be Run at a Later Date Mailers Billing
Analytics Building Cleanup 10
How do Background Jobs Work? Queueing systems First In, First
Out (FIFO) 11
Active Job Introduced in Rails 4 Provides an interface for
queueing backends 12
Common Queueing Adapters Delayed Job github.com/collectiveidea/delayed_job Resque github.com/resque/resque Sidekiq http://sidekiq.org/
13
Delayed Job Pros Created by Shopify Very mature product. Well
maintained. Very simple to add, no external services Uses ActiveRecord for queueing 14
Delayed Job Cons Uses ActiveRecord for queueing Requires a separate
worker to check queues No Web-ui 15
Resque Pros Created by Github Well maintained. Asynchronous Doesn’t use
ActiveRecord Built in Web-ui Uses Redis 16
Resque Cons Harder to setup* Redis dependency 17
Sidekiq Pros Built in Web-ui Multi-threaded Uses Redis for queueing
18
Sidekiq Cons Harder to setup Redis dependency Thread Safety Not
Guaranteed! 19
Using Background Jobs in Shortener 20
Background Jobs Welcome Email Tweeting when creating links Weekly User
Stats 21
Adding sidekiq 22 Gemfile config/application.rb
Procfile with Foreman 23 Gemfile .foreman
Sidekiq Web View 24 Gemfile config/routes.rb
Sending Mail Later 25 app/controllers/users_controller.rb
Generate a Job 26
Twitter Job 27 app/controllers/links_controller.rb app/jobs/twitter_job.rb
Running Twitter Jobs 28 app/controllers/links_controller.rb
Failing Specs :( 29
30 specs/controllers/users_controller_spec.rb
31 app/controllers/links_controller_spec.rb
Cron Based Jobs 32 app/controllers/links_controller.rb config/schedule.rb
Cron Based Jobs 33 lib/tasks/email/weekly_tasks.rake