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
Laravel5でjobque実装した話
Search
NakanishiTetsuhiro
March 06, 2019
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Laravel5でjobque実装した話
NakanishiTetsuhiro
March 06, 2019
More Decks by NakanishiTetsuhiro
See All by NakanishiTetsuhiro
コメントの書き方から見る 良いコードについての考察
nakanishitetsuhiro
0
700
SelfIntroduction
nakanishitetsuhiro
0
68
Laravelで設計する際の ベストプラクティスを探る
nakanishitetsuhiro
0
2.3k
MackerelでECS on Fargate 監視してみた
nakanishitetsuhiro
0
950
WebエンジニアによるWebエンジニアのための今だからこそおすすめしたいLinux環境
nakanishitetsuhiro
1
110
本番環境をECSで構築した話
nakanishitetsuhiro
0
930
Laravel5でJob_Queue実装した話_v1.0.1
nakanishitetsuhiro
1
68
社会人による社会人のための友達づくりのすゝめ
nakanishitetsuhiro
0
60
RancherにDocker初心者がチャレンジしてみた!.pdf
nakanishitetsuhiro
0
450
Other Decks in Technology
See All in Technology
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
3
610
Coil3を内部実装から読み解く~キャッシュ戦略とAVIF画像の描画〜/nikkei-tech-talk50
nikkei_engineer_recruiting
0
120
AIに会社の文脈を理解させる技術~上流工程・非エンジニアにも広げるハーネスエンジニアリング実践~
ochtum
0
170
AI Native Platform Engineering 〜PlatformとAgileで“作る速さ”を“価値”へ〜
uya116
0
370
企業の現実世界をグラフで写し取る
sansantech
PRO
0
170
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
3
21k
Databricksメトリクスビューはじめてのもくもく会
taka_aki
0
120
ボードゲームの遊び相手をFoundation Modelsで作る / iOSDC Japan 2026
genda
0
220
CI/CDではもう遅い - 人とAIが迂回しないDevSecOps Verify基盤の再設計 -
kintotechdev
1
380
Amazon Bedrock Agents ClassicからAmazon Bedrock AgentCoreへ移行した際、ガードレール設定が2箇所に割れた話
matsunobu
0
150
AI coding 整合正規方法
philipz
0
560
音声コミュニティを守るAI監視基盤_ 90%以上の入力削減を支えたServerless設計と運用判断
shuheioka123
0
110
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
25k
30 Presentation Tips
portentint
PRO
1
410
Color Theory Basics | Prateek | Gurzu
gurzu
1
480
The Mindset for Success: Future Career Progression
greggifford
PRO
0
520
Docker and Python
trallard
47
4.2k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Faster Mobile Websites
deanohume
310
32k
Technical Leadership for Architectural Decision Making
baasie
3
580
Building an army of robots
kneath
307
47k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
270
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Transcript
Laravel5Ͱ jobque࣮ͨ͠ גࣜձࣾRe:Build ͯͭ (Twitter: @kaoru6strings) 20193݄4ʢਫʣ Larval Meetup Okinawa
#08 https://laravel-meetup-okinawa.connpass.com/event/122396/
ࣗݾհ • த େʢͯͭ͞Μ or ͯͬͪΌΜʣ • גࣜձࣾRe:BuildɿWebΤϯδχΞ • ϦϞʔτϫʔΫͯ͠·͢
• Laravel + Vue.js, Ruby on rails @kaoru6strings
ຊjob queͷ͓ @kaoru6strings
ॏ͍ॲཧผϓϩηεͰ ಈ͔͢บΛ͚ͭͯ LaravelྗΛΞοϓ͠Α͏ʂ @kaoru6strings
Job queͷ͍ॴ • ϝʔϧૹ৴ • Ϣʔβͷಋઢʹؔͷͳ͍ॏ͍ͨॲཧ • ฒྻ࣮ߦ͕ඞཁͳόονॲཧ @kaoru6strings
Ϣʔβʔ͕ϒϥβ͔ΒҙͷλΠϛϯάͰ όονΛ࣮ߦ͢Δ߹ Ϣʔβͷಋઢ ͱͳΔϓϩηε @kaoru6strings ϫʔΧʔ
όονॲཧͷjobΛΩϡʔʹೖ que +PC +PC +PC +PC +PC
ࣄલ४උ̍ • app/Console/Kernel.phpͷscheduleʹԼهΛ Ճ • $schedule->command('queue:work --tries=1 -- timeout=0’)->withoutOverlapping(); @kaoru6strings
ࣄલ४උ̎ • crontab -e ͰԼهΛՃ • * * * *
* php /var/www/project_name/artisan schedule:run >> / dev/null 2>&1 • php artisan make:job ProcessSomething Ͱ ੜͨ͠ app/jobs/ProcessSomething.phpʹ ॲཧΛՃ @kaoru6strings
ࣄલ४උ̏ • LaravelϓϩδΣΫτͷ͓͖ͳॴʹԼهͷ ίϚϯυΛॻ͍ͯɺqueʹjobΛՃ • ProcessSomething::dispatch(); @kaoru6strings
͔͜͜Β͕ϋϚͬͨ ϙΠϯτͷհ @kaoru6strings
ࣄҊ̍: Τϥʔϩά͕ग़ྗ͞Εͳ͍ • /storage/logs/laravel.log ͷॻ͖ࠐΈݖݶΛ nginxϢʔβͷΈ͕อ͍࣋ͯͨͨ͠Ίɺϫʔ ΧʔΛ࣮ߦ͍ͯ͠ΔϢʔβ͕ΤϥʔϩάΛॻ ͖ࠐΊͣʹ͍ͨ • setfacl
-Rdm u::rwx,g::rwx,o::rwx storage @kaoru6strings
ࣄҊ̎: ্ཱͪ͛ͨϫʔΧʔ͕ͩ Μ·Γಥવࢮ͢Δ • Laravel, phpͷϩάʹԿग़ྗ͞Εͳ͍ @kaoru6strings
্ཱͪ͛ͨϫʔΧʔ͕ͩΜ·Γ ಥવࢮ͢Δ • λΠϜΞτ͍ͯ͠Δͷ͕ݪҼͩͬͨΈ͍ͨ • ϫʔΧʔ্ཱͪ͛࣌ͷίϚϯυʹԼهΦϓγϣ ϯΛࢦఆͯ͠λΠϜΞτ͠ͳ͍Α͏ʹͨ͠ • - -timeout=0
@kaoru6strings https://stackoverflow.com/questions/25877752/laravel-queue-process-timeout-error
Tips @kaoru6strings
ϫʔΧʔ͕ਖ਼ৗʹ͕͍ͨͪ͋ͬͯΔ͔֬ೝ͍ͨ͠ • ps -aef | fgrep php @kaoru6strings
ςετڥͰϫʔΧʔͷॲཧ͕ʂʂ • ·ͣਂݺٵ • ps -aef | fgrep php ͰϓϩηεidΛ֬ೝͨ͠Β
3024൪ͩͬͨ • Kill -9 3024 @kaoru6strings
Laravelͷ.envͰQUEUE_DRIVERΛઃఆ͢Δํ ๏Ͱjobͷཧํ๏ΛมߋͰ͖Δ • QUEUE_DRIVER=sync • ςετ༻ • QUEUE_DRIVER=database • Laravel͕ར༻͍ͯ͠ΔDBͰҰॹʹjobΛཧ
• QUEUE_DRIVER=redis • RedisͰjobΛཧ @kaoru6strings
վળɾٙ • ࠓճKernelʹίϚϯυΛՃͯ͠ϫʔΧʔ Λىಈͤ͞Δํ๏Λͱ͕ͬͨɺຊ SupervisorΛઃఆͨ͠΄͏͕͍͍Β͍͠ • Laravel forge(https://forge.laravel.com/)Λ ͬͨΒઃఆ͕؆୯Β͍͚͠Ͳɺͬͨ͜ ͱ͋Δਓ͍·͔͢ʁ
@kaoru6strings
ΈΜͳͰJob que͓͏ʂ @kaoru6strings
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ @kaoru6strings