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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
690
SelfIntroduction
nakanishitetsuhiro
0
65
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
67
社会人による社会人のための友達づくりのすゝめ
nakanishitetsuhiro
0
59
RancherにDocker初心者がチャレンジしてみた!.pdf
nakanishitetsuhiro
0
440
Other Decks in Technology
See All in Technology
20260912_スクフェス三河
kgnkhkr
0
300
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
680
Gitは怖い?共有ワークスペースから始めるSnowflakeチーム開発
coco_se
0
150
DEFCON_CHV_CTF_Write-up.pdf
bata_24
0
140
Reactの設計論
uhyo
14
8.2k
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
110
あるけみー式LTスライド作成術
alchemy1115
1
180
生成AIのテナント制御とシャドーMCP対策 | AIを"止めずに"、情報を守る
yukun
0
150
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
260
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
260
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
160
2026_devsumi_ozono.pdf
o3
2
400
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Building an army of robots
kneath
306
46k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
GraphQLとの向き合い方2022年版
quramy
50
15k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Amusing Abliteration
ianozsvald
1
290
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Ruling the World: When Life Gets Gamed
codingconduct
0
330
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