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
13
1.6k
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
Jane & Webby
odolbeau
0
300
Translating a monolingual application
odolbeau
2
430
DX: Developer eXperience
odolbeau
0
54
DX: Developer eXperience
odolbeau
0
420
EasyAdminBundle introduction
odolbeau
0
140
REX API Platform
odolbeau
0
1.1k
Features flags at BlaBlaCar
odolbeau
4
880
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
1
390
Be gentle with your prod!
odolbeau
1
630
Other Decks in Programming
See All in Programming
How to use Macrobenchmark
veronikapj
0
160
[After Kotlin Fest 2024 LT Night @ Sansan] もっともっとKotlinを好きになる!K2 Compiler Pluginで遊んでみよう!
kitakkun
2
260
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
リハビリmruby
kishima
1
160
Clean Architecture by TypeScript & NestJS
ryounasso
0
150
CSC307 Lecture 13
javiergs
PRO
0
150
開発部に不満を持っていたCSがエンジニアにジョブチェンしてわかった「勝手に諦めない」ことの大切さ
sakuraikotone
28
16k
日付と正規化
megmogmog1965
0
140
Rust.Nagoya #1
codemountains
0
170
小さな開発会社を作った理由
polidog
0
1.9k
スクラムマスターって孤独じゃないですか?
yoshitaroyoyo
1
140
AWSでゲームサーバーを運用! Amazon GameLiftのお話
iriikeita
0
200
Featured
See All Featured
Designing for Performance
lara
604
67k
Music & Morning Musume
bryan
43
5.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
652
58k
Into the Great Unknown - MozCon
thekraken
20
1.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
26
1.8k
The Cost Of JavaScript in 2023
addyosmani
31
4.7k
GitHub's CSS Performance
jonrohan
1026
450k
Speed Design
sergeychernyshev
9
270
Producing Creativity
orderedlist
PRO
340
39k
A designer walks into a library…
pauljervisheath
201
24k
Designing on Purpose - Digital PM Summit 2013
jponch
113
6.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
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