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
6
3.7k
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
Tweet
Share
More Decks by Olivier Dolbeau
See All by Olivier Dolbeau
Throw new \Exception(); Oui, mais laquelle ?
odolbeau
1
290
Jane & Webby
odolbeau
0
470
Translating a monolingual application
odolbeau
2
670
DX: Developer eXperience
odolbeau
1
120
DX: Developer eXperience
odolbeau
1
570
EasyAdminBundle introduction
odolbeau
0
210
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
650
Other Decks in Programming
See All in Programming
Java 21/25 Virtual Threads 소개
debop
0
160
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
140
SourceGeneratorのマーカー属性問題について
htkym
0
210
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
200
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
120
Feature Toggle は捨てやすく使おう
gennei
0
160
OTP を自動で入力する裏技
megabitsenmzq
0
120
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記 / "It’s Not Working!" A Struggle with Error Handling in API Platform using DI
mkmk884
0
110
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8.2k
安いハードウェアでVulkan
fadis
0
650
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
Ruby and LLM Ecosystem 2nd
koic
1
1.2k
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
340
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
85
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
A Tale of Four Properties
chriscoyier
163
24k
Paper Plane
katiecoart
PRO
0
48k
Design in an AI World
tapps
0
170
Building AI with AI
inesmontani
PRO
1
810
Faster Mobile Websites
deanohume
310
31k
Music & Morning Musume
bryan
47
7.1k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
560
How GitHub (no longer) Works
holman
316
150k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
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