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
210
Translating a monolingual application
odolbeau
2
320
DX: Developer eXperience
odolbeau
0
43
DX: Developer eXperience
odolbeau
0
310
EasyAdminBundle introduction
odolbeau
0
89
REX API Platform
odolbeau
0
760
Features flags at BlaBlaCar
odolbeau
4
720
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
1
310
Be gentle with your prod!
odolbeau
1
440
Other Decks in Programming
See All in Programming
Cloudflare WorkersでGoのHTTPサーバーを動かすライブラリを作った話
syumai
0
140
Isar勉強会
hoddy3190
0
300
OSS貢献を気軽にしたい Let's Go Talk #1
yuyaabo
2
230
There's an API for that!
mariatta
PRO
0
100
kintoneでランダム取得を作ってみた(imoniCamp 2022-07-27)
shokun1108
0
130
ちょっとつよい足トラ
logilabo
0
330
Windows コンテナ Dojo 第5回 OpenShift で学ぶ Kubernetes 入門
oniak3ibm
PRO
0
120
アジャイルで不確実性に向き合うための開発タスクの切り方
tanden
4
1.1k
Atomic Design とテストの○○な話
takfjp
2
790
Pythonで鉄道指向プログラミング
usabarashi
0
110
How GitHub Supports Vim License Detection, The Five Years Journey
othree
1
320
Rust on Lambda 大きめCSV生成
atsuyokota
1
390
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_i
25
15k
Done Done
chrislema
174
14k
The MySQL Ecosystem @ GitHub 2015
samlambert
239
11k
A Philosophy of Restraint
colly
192
15k
Bash Introduction
62gerente
598
210k
Docker and Python
trallard
27
1.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
181
15k
Statistics for Hackers
jakevdp
782
210k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
11
4.8k
How to Ace a Technical Interview
jacobian
266
21k
Learning to Love Humans: Emotional Interface Design
aarron
261
37k
Become a Pro
speakerdeck
PRO
3
900
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