Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Making asynchronous tasks in PHP
Olivier Dolbeau
April 07, 2014
Programming
6
3.2k
Making asynchronous tasks in PHP
Why & how making asynchronous tasks in PHP
SFLIve2014 - 04/07/2014 with Grégoire Pineau
Olivier Dolbeau
April 07, 2014
Tweet
Share
More Decks by Olivier Dolbeau
See All by Olivier Dolbeau
Jane & Webby
odolbeau
0
230
Translating a monolingual application
odolbeau
2
330
DX: Developer eXperience
odolbeau
0
43
DX: Developer eXperience
odolbeau
0
320
EasyAdminBundle introduction
odolbeau
0
100
REX API Platform
odolbeau
0
820
Features flags at BlaBlaCar
odolbeau
4
750
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
1
330
Be gentle with your prod!
odolbeau
1
480
Other Decks in Programming
See All in Programming
How to Fight Production Incidents?
asatarin
0
230
Unity+C#で学ぶ! メモリレイアウトとvtableのすゝめ 〜動的ポリモーフィズムを実現する仕組み〜
rossam
1
360
ITエンジニア特化型Q&Aサイトteratailを 言語、DB、クラウドなど フルリプレイスした話
leveragestech
0
460
Remote SSHで行うVS Codeリモートホスト開発とトラブルシューティング
smt7174
1
520
Amazon QuickSightのアップデート -re:Invent 2022の復習&2022年ハイライト-
shogo452
0
250
Makuakeの認証基盤とRe-Architectureチーム
bmf_san
0
640
ちょうぜつ改め21世紀ふつうのソフトウェア設計
tanakahisateru
7
6.5k
OSSから学んだPR Descriptionの書き方
fugakkbn
4
140
AWSとCPUのムフフな関係
cmdemura
0
480
T3 Stack and TypeScript ecosystem
quramy
3
800
まだ日本国内で利用できないAppActionsにトライしてみた / MoT TechTalk #15
mot_techtalk
0
150
ポケモンで学ぶiOS 16弾丸ツアー 🚅
giginet
PRO
1
620
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
20
9.9k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
Web development in the modern age
philhawksworth
197
9.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
109
16k
A designer walks into a library…
pauljervisheath
199
16k
How to Ace a Technical Interview
jacobian
270
21k
Intergalactic Javascript Robots from Outer Space
tanoku
261
26k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
50k
Making the Leap to Tech Lead
cromwellryan
117
7.7k
How to name files
jennybc
47
73k
Ruby is Unlike a Banana
tanoku
93
9.6k
Code Review Best Practice
trishagee
50
11k
Transcript
Making asynchronous tasks in PHP The easy way
Olivier Dolbeau Dev @odolbeau Who ? Grégoire Pineau Dev @lyrixx
Summary • Why? • How? • Problems? Solutions! • Tips
None
None
None
None
None
None
Your visitors don’t want to wait! (and if they have
to, they don’t want to know it) First reason to do asynchronous
Your web servers want to make their job! (they don’t
care about emails other boring tasks) Second reason to do asynchronous
None
Separating concerns Serveur web Consumer Consumer Consumer Consumer Consumer
None
How Rabbit work?
With more consumers
You can add simple routing logic
Or more complex logic
None
How your app talks to RabbitMQ?
With the PECL extension Thanks to Pieter de Zwart See:
pdezwart/php-amqp Use librabbitmq (alanxz/rabbitmq-c)
With videlalvaro/php-amqplib
None
</troll>
How to connect to RabbitMQ?
How to publish a message?
How to consume a message?
None
None
None
None
None
get > consume • consume is a blocking call •
you don’t want blocking calls in your application ! • Use “get” method with a poll-interval
None
None
None
None
None
None
None
None
None
None
Wait 30 seconds and retry!
Wait 3 minutes and retry!
Wait half an hour and retry!
None
None
None
None
None
None
<troll>
None
None
None
You can take a look at the code ! https://github.com/odolbeau/sflive2014-workers
Swarrot https://github.com/swarrot/swarrot
None