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
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
860
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
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
140
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
710
Jetpack Compose メカニズム
skydoves
0
420
新卒PdEのリアル
ryu1013
1
500
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
140
App Intentsのビルドプロセスを支える技術
kntkymt
0
380
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.8k
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2k
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
320
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
240
Are APIs Still Relevant in the AI Era?
soyuka
0
230
Intent as Code
shoppingjaws
6
1k
Featured
See All Featured
Heart Work Chapter 1 - Part 1
lfama
PRO
10
36k
Ethics towards AI in product and experience design
skipperchong
2
380
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
460
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Design in an AI World
tapps
1
320
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Scaling GitHub
holman
464
140k
Designing Experiences People Love
moore
143
24k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
300
Faster Mobile Websites
deanohume
310
32k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
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
͓͠·͍