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
Asynchronous tasks in PHP
Search
Olivier Dolbeau
June 24, 2014
Programming
12
1.8k
Asynchronous tasks in PHP
Why & how making asynchronous tasks in PHP
PHPTour Lyon 2014 - 24/06/2014
Olivier Dolbeau
June 24, 2014
Tweet
Share
More Decks by Olivier Dolbeau
See All by Olivier Dolbeau
Throw new \Exception(); Oui, mais laquelle ?
odolbeau
1
240
Jane & Webby
odolbeau
0
440
Translating a monolingual application
odolbeau
2
600
DX: Developer eXperience
odolbeau
1
100
DX: Developer eXperience
odolbeau
1
550
EasyAdminBundle introduction
odolbeau
0
180
REX API Platform
odolbeau
0
1.3k
Features flags at BlaBlaCar
odolbeau
5
1.1k
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
2
560
Other Decks in Programming
See All in Programming
CloudflareのSandbox SDKを試してみた
syumai
0
160
ノーコードからの脱出 -地獄のデスロード- / Escape from Base44
keisuke69
0
710
Phronetic Team with AI - Agile Japan 2025 closing
hiranabe
2
610
Dive into Triton Internals
appleparan
0
490
関数の挙動書き換える
takatofukui
3
540
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
13
12k
「正規表現をつくる」をつくる / make "make regex"
makenowjust
1
430
Chart.jsで長い項目を表示するときのハマりどころ
yumechi
0
110
Querying Design System デザインシステムの意思決定を支える構造検索
ikumatadokoro
1
1.1k
All(?) About Point Sets
hole
0
150
OSS開発者の憂鬱
yusukebe
12
4.2k
開発生産性が組織文化になるまでの軌跡
tonegawa07
0
170
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
We Have a Design System, Now What?
morganepeng
54
7.9k
How GitHub (no longer) Works
holman
315
140k
Why Our Code Smells
bkeepers
PRO
340
57k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
The Pragmatic Product Professional
lauravandoore
36
7k
Become a Pro
speakerdeck
PRO
29
5.6k
4 Signs Your Business is Dying
shpigford
186
22k
Transcript
Making asynchronous tasks in PHP
None
Olivier Dolbeau @odolbeau Web Architect About me
RIDESHARING Cost of motoring 100€ 25€ 25€ 25€ 25€ @BlaBlaCar_FR
ALONE
A fast growing community
A European phenomenon
None
None
None
None
None
Your visitors don’t want to wait! and if they have
to, they don’t want to know it
For you :
Your web servers want to make their job! (they don’t
care about emails other boring tasks)
None
Separating concerns Serveur web Consumer Consumer Consumer Consumer Consumer
Separating concerns
None
How Rabbit work?
With more consumers
You can add simple routing logic
Or more complex logic
How your app talks to RabbitMQ?
With the PECL extension Thanks to Pieter de Zwart See:
pdezwart/php-amqp Use librabbitmq (alanxz/rabbitmq-c)
How to connect to RabbitMQ?
How to publish a message?
How to consume a message?
None
None
None
None
It’s a trap !
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
Wait 30 seconds and retry!
Wait 3 minutes and retry!
Wait half an hour and retry!
None
None
None
None
Swarrot
Existing processors
None
None
None
Last tip !
None
None
Making asynchronous tasks is good (even in PHP)
@odolbeau https://joind.in/ 11237 https://github.com/swarrot/swarrot https://speakerdeck.com/odolbeau/asynchronous-tasks-in-php