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
Qudoを使ったJob queue system
Search
shibayu36
March 18, 2012
Technology
2
2.3k
Qudoを使ったJob queue system
Kyoto.pm Tech Talks #01で
shibayu36
March 18, 2012
Tweet
Share
More Decks by shibayu36
See All by shibayu36
今の生産性改善活動で大切にしている考え方
shibayu36
8
8.4k
エンジニアメンター制度の効果的な運用を目指して/improve-mentor-system
shibayu36
27
10k
グレードイメージ具体化のため昇格理由を公開する
shibayu36
8
5.8k
新機能作成時に開発ブランチに細かくmergeしていく戦略/merge-strategy-for-new-feature
shibayu36
6
17k
一から始めるJavaScriptユニットテスト/js-unit-test-from-scratch
shibayu36
8
33k
技術ブログを書くことについて/writing-tech-blog
shibayu36
17
26k
はてなと技術研修
shibayu36
1
6.3k
はてなブログチームの開発フローとGitHub
shibayu36
145
76k
課題をテストで解決する
shibayu36
2
2.3k
Other Decks in Technology
See All in Technology
深層学習と3Dキャプチャ・3Dモデル生成(土木学会応用力学委員会 応用数理・AIセミナー)
pfn
PRO
0
450
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
820
My small contributions - Fujiwara Tech Conference 2025
ijin
0
1.4k
When Windows Meets Kubernetes…
pichuang
0
300
Building Scalable Backend Services with Firebase
wisdommatt
0
110
KMP with Crashlytics
sansantech
PRO
0
240
AWS re:Invent 2024 re:Cap Taipei (for Developer): New Launches that facilitate Developer Workflow and Continuous Innovation
dwchiang
0
150
2025年のARグラスの潮流
kotauchisunsun
0
790
Formal Development of Operating Systems in Rust
riru
1
420
Git scrapingで始める継続的なデータ追跡 / Git Scraping
ohbarye
5
470
AWSマルチアカウント統制環境のすゝめ / 20250115 Mitsutoshi Matsuo
shift_evolve
0
100
完全自律型AIエージェントとAgentic Workflow〜ワークフロー構築という現実解
pharma_x_tech
0
320
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
96
5.3k
We Have a Design System, Now What?
morganepeng
51
7.3k
Why Our Code Smells
bkeepers
PRO
335
57k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Making Projects Easy
brettharned
116
6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
350
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
Typedesign – Prime Four
hannesfritz
40
2.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
Transcript
2VEPΛͬͨ KPCRVFVFTZTUFN id:shiba_yu36 2012/03/17 Kyoto.pm Tech Talks #01 20123݄18༵
ࣗݾհ 20123݄18༵
TIJCB@ZV TIJCBZV PSFUD 20123݄18༵
!גࣜձࣾͯͳ • ՝ۚλΠϜϥΠϯͳͲϓϥοτ ϑΥʔϜ෦Λ୲ • ֎෦αʔϏε࿈ܞ • ςετڥඋ 20123݄18༵
QFSM w,ZPUPQN w$1"/ w8FC4FSWJDF#JUMZ w%#*Y%BUB'BDUPSZ w1SF1"/ͨ·ʹखͬͯ·͢ 20123݄18༵
1SF1"/։ൃͰKPCRVFVFTZTUFNΛ ͏ػձ͕͋ͬͨͷͰɺͦͷΈͱ 2VEPʹΑΔ࣮Λհ͠·͢ɻ 20123݄18༵
ΞδΣϯμ wKPCRVFVFTZTUFN w2VEPΛ࣮ͬͨ wͬͯΈͯ ͋·ΓKPCRVFVFTZTUFNΛ ͬͨ͜ͱͷͳ͍ਓ͚ 20123݄18༵
20123݄18༵
KPCRVFVFTZTUFNʁ ΞϓϦέʔγϣϯͷόοΫάϥϯ υଆͰඇಉظͰॲཧΛ࣮ߦ͢ΔͨΊ ͷΈ 20123݄18༵
ϝϦοτ wॲཧΛޙճ͠ wϦΞϧλΠϜੑ͕ඞཁͳ͍ͷ wΤϥʔϋϯυϦϯά wϦτϥΠ wεέʔϧ 20123݄18༵
KPCRVFVFTZTUFNͷߏ w+PCΛFORVFVF͢Δ෦ DMJFOU w+PCͷॲཧຊମ XPSLFS w+PCͷ࣮ߦͷཧ XPSLFSNBOBHFS 20123݄18༵
Ұྫ 20123݄18༵
QFSMͰͷ KPCRVFVFTZTUFN w(FBSNBO wதؒEBFNPOར༻ w5IF4DIXBSU[ w3%#.4Λ͏ wଟ͘ͷ࣮͕͋Δ 20123݄18༵
QFSMͰͷ KPCRVFVFTZTUFN w 2VEP OFLPLBL͞Μ NBTBSU[͞Μ w ܰྔKPCRVFVFTZTUFN w +POL
w ࠷ݶͷKPCRVFVF"1*Λ࣮ w $MVUDI w EJTUSJCVUFEKPCRVFVF w DMJFOU͕ॲཧ͢ΔXPSLFSΛܾఆ 20123݄18༵
2VEPΛ࣮ͬͨ 20123݄18༵
ͳͥ2VEP w1SF1"/ͰNPEVMF͕ߘ͞ΕͨΒɺ͍ ͍ײ͡ʹ௨͍ͨ͠ wHJUIVCͷϑΥϩʔ wΩʔϫʔυʹϚονͰ௨ wॲཧ͕গ͠ॏ͍ͷͰɺ·ͣKPCRVFVF TZTUFNΛಋೖ͔ͨͬͨ͠ 20123݄18༵
ͳͥ2VEP w5IF4DIXBSU[ΦʔόʔεϖοΫײ wͨ͘͞ΜΧελϚΠζ͍ͨ͠Θ͚Ͱ ͳ͍ 2VEP͕ͪΐ͏ͲΑͦ͞͏ 20123݄18༵
%#४උ RVEPECRVEPVTFSSPPU SECNTNZTRMVTF@JOOPEC 20123݄18༵
$MJFOU 20123݄18༵
$MJFOU package Sample::Qudo::Client; use parent qw(Qudo); sub new { my
($class, $args) = @_; $class->SUPER::new( databases => [+{ dsn => 'dbi:mysql:qudo_sample', username => 'root', password => '', }], default_hooks => ['Qudo::Hook::Serialize::JSON'], ); } 20123݄18༵
$MJFOU $qudo->enqueue( "Sample::Qudo::Worker::Echo", { arg => {message => 'hoge'} },
); 20123݄18༵
8PSLFS 20123݄18༵
8PSLFS package Sample::Qudo::Worker::Echo; use parent qw(Qudo::Worker); sub work { my
($self , $job ) = @_; my $arg = $job->arg; my $message = $arg->{message}; sleep 2; # heavy task... warn $message; $job->completed(); # or $job->abort } 20123݄18༵
8PSLFS.BOBHFS 20123݄18༵
8PSLFS.BOBHFS # worker.pl my $qudo = Qudo->new( databases => [+{
dsn => 'dbi:mysql:qudo_sample', username => 'root', password => '', }], default_hooks => ['Qudo::Hook::Serialize::JSON'], manager_abilities => [qw/Sample::Qudo::Worker::Echo/], ); $qudo->work; 20123݄18༵
8PSLFS.BOBHFS QBSBMMFM my $manager = Qudo::Parallel::Manager->new( databases => ..., default_hooks
=> ..., manager_abilities => ..., work_delay => 5, max_workers => 3, min_spare_workers => 3, auto_load_worker => 1, ); $manager->run; 20123݄18༵
%FNP XPSLFSNBOBHFS QBSBMMFM XPSLFSJOTFSU͞ΕͨใΛXBSO͢Δ͚ͩ 20123݄18༵
EFQMPZ QFSMXPSLFSQM 20123݄18༵
EFQMPZ EBFNPOUPPMT # run.sh #!/bin/sh exec 2>&1 cd /path/Sample-Worker ||
exit 1 exec setuidgid app /usr/bin/perl worker.pl svc -u /etc/service/Sample-Worker #start svc -d /etc/service/Sample-Worker #stop 20123݄18༵
ͬͯΈͯ 20123݄18༵
ಛ ͱʹ͔͘؆୯ ͙͢ʹKPCRVFVFͷΈΛ ͬͯΈ͍ͨͳΒ࠷ద 20123݄18༵
ͨͩ͠ wΘΕ͍ͯΔͱ͜Ζͦ͜·Ͱଟ͘ͳ ͍ w5IF4DIXBSU[ͱ͔ w+PCཧͷΈࣗମΛΧελϚΠζ͠ Α͏ͱ͢Δͱ͍͠ w+POLͱ͔ 20123݄18༵
wKPCRVFVFTZTUFNͱ͔ͬͨ͜ͱແ ͍ wखܰʹKPCRVFVFTZTUFNΛͬͯΈ ͍ͨ Ұ2VEPΛͬͯΈΔͱྑ͍Ͱ͢ʂ 20123݄18༵
20123݄18༵
·ͱΊ wKPCRVFVFTZTUFNͷ؆୯ͳઆ໌ w2VEPͰͷ࣮ͱͦͷಛͷհ wͱʹ͔͘؆୯ w৴པੑ5IF4DIXBSU[ wΧελϚΠζ+POL 20123݄18༵