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
Redisでバッチ処理を冗長化しつつ排他制御
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ryonext
September 17, 2014
Programming
2.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Redisでバッチ処理を冗長化しつつ排他制御
ryonext
September 17, 2014
More Decks by ryonext
See All by ryonext
AWS Lambda の Ruby 対応
ryonext
0
280
TwitterのList編集しやすいやつ作った
ryonext
0
1.8k
validationについて
ryonext
1
870
AWS Lambda と API GatewayでRails使わずに済んだ話
ryonext
8
4.4k
capistrano-bundle_rsync使ったらオートスケールが高速化した話
ryonext
8
2.6k
PumaとUnicornで最近自分が理解したこと
ryonext
13
9.6k
Hubot事例
ryonext
1
1.7k
CircleCIとwercker
ryonext
3
1.3k
rubykaigi 3day interactive white board
ryonext
2
410
Other Decks in Programming
See All in Programming
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.3k
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
[2026-10-14](C)Re:ゼロから始める異世界生活〜始まりの終わりと終わりの始まり〜
tosite
0
110
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
Workers Cache を知る
syumai
0
370
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.5k
R8 の設定見直しでアプリサイズ削減
andpad
0
220
Jetpack Compose Mechanisms
skydoves
3
820
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
220
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
0
100
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Facilitating Awesome Meetings
lara
57
7.2k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
630
A Modern Web Designer's Workflow
chriscoyier
699
190k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
370
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
330
We Are The Robots
honzajavorek
0
400
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
So, you think you're a good person
axbom
PRO
2
2.2k
Transcript
3FEJTͰόονॲཧΛ Խͭͭ͠ഉଞ੍ޚ
ࣗݾհ
͜͏͍͏ύλʔϯ ͓Εͷ3BJMT"QQ ֎෦ͷ"1* 6TFS
ຖճ"1*ϦΫΤετ͢Δͱ w ԠతʹͭΒ͍ w "1*αʔόʹෛՙ͕͔͔Δ
͜͏͍͏෩ʹ͢Δ ͓Εͷ3BJMT"QQ ֎෦ͷ"1* 6TFS ϢʔβʔϦΫΤετ όονॲཧ
3BJMTͳΒ w XIFOFWFS DBQJTUSBOPͰBQQαʔόʹσϓϩ ΠͷλΠϛϯάͰDSPO࡞Ͱ͖ͯḿΔ
㵺㱿㵺 ɻP ͯΑʁ"QQαʔόͬͯԽ͞ΕͯΔΑͳʁ
c"QQ "QQcᵎ ☋ʆ ᵊࡾ
◠㷩◠ ☛Ͳͬͪʹొ͓͍ͯͨ͠Αʔ # Begin Whenever generated tasks for: oreno_app PATH=/var/www/oreno_app/shared/bundle/ruby/2.1.0/bin:/usr/local/rbenv/
versions/2.1.2/bin:/usr/local/rbenv/libexec:/usr/local/sbin:/usr/local/ bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games ! 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /var/www/ oreno_app/releases/20140917060508 && RAILS_ENV=production bundle exec rake kankore:ensei --silent >> log/crontab.log 2>&1' ! # End Whenever generated tasks for: oreno_app
‧▓▒░ `Т` ░▒▓‧͏Θ͋͋͋͋͋͋
ՕॴͰΔͱ w ࢿݯͷແବݣ͍ײ w Կ͔ΛΠϯΫϦϝϯτ͢ΔͳͲɺͭͬͨΒக ໋తͳॲཧͩͱࢮ͵
͜ΕͰղܾʂʁ ͓Εͷ3BJMT"QQ ͓Εͷ3BJMT"QQ όον࣮ߦαʔό
͍͕ͭ͜མͪͨΒࢮ͵ όον࣮ߦαʔό ʀŋAТŋ
ͦ͜Ͱ3FEJT task nanika: :environment do sleep(rand(5)) # 実行時間をずらす redis =
Redis.new unless redis.get(‘task_executed') redis.setex('task_executed', 300, Time.now) # やりたいタスクを書く end end
͜͏͢Δ͜ͱͰ w ઌʹಈ͍ͨํ3FEJTʹΩʔ͕ͳ͚ΕΩʔΛ ࡞ͬͯλεΫ࣮ߦ w Ωʔ͕͋ͬͨΒଈ࠲ʹΊΔ w ΩʔҰఆ࣌ؒͰʢ࣍ͷDSPO࣮ߦ·Ͱʹʣফ͑ Δ w
ͭ·ΓɺԽͭͭ͠ഉଞ੍ޚͰ͖Δ
ͱ͍͏͜ͱΛͬͯ͘ΕΔ(FN ͕͋Γ·ͨ͠ w IUUQTHJUIVCDPNLFOOSFEJTNVUFY
͜͏͍͏ײ͡Ͱॻ͚·͢ Redis::Classy.db = Redis.new() mutex = Redis::Mutex.new('lock_access', expire: 180) begin
mutex.lock! # やりたい処理を書く rescue Redis::Mutex::LockError puts 'locked' end
͓͠·͍