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
Making asynchronous tasks in PHP
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Olivier Dolbeau
April 07, 2014
Programming
3.7k
6
Share
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
More Decks by Olivier Dolbeau
See All by Olivier Dolbeau
Throw new \Exception(); Oui, mais laquelle ?
odolbeau
1
310
Jane & Webby
odolbeau
0
500
Translating a monolingual application
odolbeau
2
690
DX: Developer eXperience
odolbeau
1
130
DX: Developer eXperience
odolbeau
1
580
EasyAdminBundle introduction
odolbeau
0
230
REX API Platform
odolbeau
0
1.4k
Features flags at BlaBlaCar
odolbeau
5
1.2k
25+ million members in 22 countries, how to scale with Symfony2
odolbeau
2
670
Other Decks in Programming
See All in Programming
色即是空、空即是色、データサイエンス
kamoneggi
1
200
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
250
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
390
Spec-Driven Development with AI-Agents: From High-Level Requirements to Working Software
antonarhipov
2
370
GitHub Copilot CLIのいいところ
htkym
2
1.1k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
250
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
940
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
850
AIとRubyの静的型付け
ukin0k0
0
140
~ 秘伝のタレ化した『神スプシ』と戦う ~ 関数型パラダイムで壊れない仕組みへ
h0r15h0
1
130
AI Agent と正しく分析するための環境作り
yoshyum
3
610
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
110
Featured
See All Featured
The browser strikes back
jonoalderson
0
1.1k
The Cost Of JavaScript in 2023
addyosmani
55
9.9k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
390
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
150
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
450
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
140
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
A Tale of Four Properties
chriscoyier
163
24k
How to build a perfect <img>
jonoalderson
1
5.5k
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