Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Asynchronous tasks in PHP
Olivier Dolbeau
June 24, 2014
Programming
13
1.4k
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
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
なぜRubyコミュニティにコミットするのか?
luccafort
0
320
Prácticas de Seguridad en Kubernetes
pablokbs
0
130
23年のJavaトレンドは?Quarkusで理解するコンテナネイティブJava
tatsuya1bm
1
140
和暦を正しく扱うための暦の話
nagise
10
6.6k
Swift Observation
shiz
4
290
AWSとCPUのムフフな関係
cmdemura
0
480
Workshop on Jetpack compose
aldefy
0
140
Functional Data Engineering - A Blueprint for adopting functional principles in data pipeline
vananth22
0
190
xarray-Datatree: Hierarchical Data Structures for Multi-Model Science
tomnicholas
0
230
The State of Kotlin | FOSDEM 2023
prof18
1
110
Findy - エンジニア向け会社紹介 / Findy Letter for Engineers
findyinc
2
42k
Excelの助けを借りて楽にシナリオを作ろう
rpa_niiyama
0
340
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
217
21k
Side Projects
sachag
451
37k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
657
120k
Principles of Awesome APIs and How to Build Them.
keavy
117
15k
10 Git Anti Patterns You Should be Aware of
lemiorhan
643
54k
What’s in a name? Adding method to the madness
productmarketing
12
1.9k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
270
12k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
349
27k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
24
4.6k
Art, The Web, and Tiny UX
lynnandtonic
284
18k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
38
3.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
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