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.7k
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
150
Jane & Webby
odolbeau
0
350
Translating a monolingual application
odolbeau
2
500
DX: Developer eXperience
odolbeau
1
67
DX: Developer eXperience
odolbeau
1
510
EasyAdminBundle introduction
odolbeau
0
160
REX API Platform
odolbeau
0
1.2k
Features flags at BlaBlaCar
odolbeau
5
990
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
2
460
Other Decks in Programming
See All in Programming
責務と認知負荷を整える! 抽象レベルを意識した関心の分離
yahiru
1
200
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
550
もう僕は OpenAPI を書きたくない
sgash708
4
1.5k
Spring gRPC について / About Spring gRPC
mackey0225
0
220
WebDriver BiDiとは何なのか
yotahada3
1
140
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
210
TokyoR116_BeginnersSession1_環境構築
kotatyamtema
0
110
なぜイベント駆動が必要なのか - CQRS/ESで解く複雑系システムの課題 -
j5ik2o
10
3.6k
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
130
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.2k
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
550
チームリードになって変わったこと
isaka1022
0
200
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Why Our Code Smells
bkeepers
PRO
336
57k
Thoughts on Productivity
jonyablonski
69
4.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
100
18k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
How GitHub (no longer) Works
holman
314
140k
Bash Introduction
62gerente
611
210k
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Site-Speed That Sticks
csswizardry
4
380
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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