SlideShare une entreprise Scribd logo
1  sur  33
It’s all about eXperience
Gaetano Giunta
Gilles Guirand
Forum PHP
Paris
2015/11/24
Rabbits, indians and...
Symfony meets
queueing brokers
Brokers, don’t they work in Wall Street?
Brokers, don’t they work in Wall Street?
Message brokers are a building block of Message oriented middleware.
[wikipedia]
Brokers, don’t they work in Wall Street?
Message brokers are a building block of Message oriented middleware.
[wikipedia]
Message oriented middleware (MOM) is software or hardware
infrastructure supporting the sending and receiving of messages
between distributed systems
[same as above]
• RabbitMQ
• ActiveMQ
• Apollo
• Kafka
• Kestrel
• Amazon SQS
• ZeroMQ*
• And many more…
Let’s try again: can you name any broker?
What do they do?
Where do they differ?
• Protocol support (amqp, stomp, …)
• Libraries exist for writing clients using standard protocols
• Other offer their own SDK
• Routing
• Amqp has exchanges and queues, Stomp only queues
• Wildcards in queue names are supported by most systems
• Delivery guarantees
• Possible double delivery?
• Out of order dispatch
Where do they differ?
• Surviving failures
• Are messages sent before the client is started buffered or lost?
• What happens when a client crashes?
• Support for ACK/NACK mechanisms
• Clustering
• And if the server crashes?
• Performances
• Batch send/receive – prefetch
• Polling vs. persistent connections
Everything clear so far?
Everything clear so far?
A case study: generating MSOffice docs
The needs
• Produce content in Microsoft Office formats
• Many formats for each document
• Both Word and Excel docs
• XML content generated by CMS
• LibreOffice used to generate MS Office and PDF versions
• Has anyone tried generating OOXML by hand?
A case study: generating MSOffice docs
Reality bites
• Slooow
• Rest assured that some of the docs will be pretty big
• Unreliable
• Depending on version, LO crashes from a-bit to
almost-always
• Race-prone
• Two conversion jobs in parallel step on each other
A case study: generating MSOffice docs
…and the results are:
• Ugly code: lots of polling, copying of files around, manual
locking
• Does not scale at all: only one conversion process active at
any given time
Web
server
PHP
Libre
Office
Waiting processes
TextBook scenario for introducing queues
Web
server
Consumer
Rabbit
MQ
Libre
Office
PHP
TextBook scenario for introducing queues
Web
server
Consumer
?
Rabbit
MQ
Libre
Office
PHP
TextBook scenario for introducing queues
Web
server
PHP
!!!
Rabbit
MQ
Libre
Office
PHP
TextBook scenario for introducing queues
Web
server
PHP
!
Rabbit
MQ
Libre
Office
PHP
TextBook scenario for introducing queues
Web
server
Symfony
!!!
Rabbit
MQ
Libre
Office
Symfony
TextBook scenario for introducing queues
Web
server
Symfony
!!!
Rabbit
MQ
Libre
Office
Symfony
The rationale
• Same library handling both sides of the connection
• Easier to troubleshoot
• Sf Console component is lovely
• Everything developed in a single repository
• No need to learn new languages
• Everything which I can rewrite in PHP, I eventually will*
* = 3rd whimsical law of Gaetano
There is a bundle for that
oldsound/rabbitmq-bundle
• specific to RabbitMQ
• supports both producers and consumers
php app/console rabbitmq:consumer <name>
class FooConsumer implements ConsumerInterface
{
public function execute(AMQPMessage $msg)
{
$foo = unserialize($msg->body);
echo 'foo '.$foo->getName()." successfully downloaded!n";
}
}
Long lived php processes ?
• Fatal errors
• Memory leaks
• Database connections might become broken
• Is it in your code or in a dependency?
A new hope
• kaliop/queueingbundle
• kaliop/queueingbundle-sqs
• kaliop/queueingbundle-stomp
A design focusing on safety
• The consumer has been split in 2
• The listener is long lived; it spins up a php worker
process each time it receives a command
• The worker process is a Symfony console command
• It handles a single message then exits
Symfony
listener
Symfony
worker
Libre
Office
Queue
Does it scale ?
• The listener waits for the worker to finish before staring another
• Solution: run multiple listeners in parallel
W
Symfony
listener
Symfony
worker
Libre
Office
Queue
Symfony
listener
Symfony
worker
Libre
Office
Multiple protocol support
Kaliop Queueing Bundles
fusesource/stomp-phpaws/aws-sdk-php oldsound/rabbitmq
ActiveMQ ApolloSQS RabbitMQ
Application
Easy to use
• Message encoding taken care of (JSON by default)
• Has events your code can listen to alter the consumption
loop
Message
received
Do stuff
Consump
tion
failed
Message
consumed
Exception
Show me da code
old_sound_rabbit_mq:
connections:
default:
...
producers:
my_producer:
connection: default
exchange_options:
name: my_producer.exchange
type: topic
consumers:
my_consumer:
connection: default
exchange_options:
name: my_producer.exchange
type: topic
queue_options:
name: my_queue
callback: my_symphony_service
Show me da code
Worker
use KaliopQueueingBundleServiceMessageConsumer;
class MyConsumer extends MessageConsumer
{
/**
* @param mixed $body
*/
public function consume($body)
{
// do stuff ...
}
}
Show me da code
Lots of console commands available
php app/console kaliop_queueing:queuemessage <queuename> <msg body>
php app/console kaliop_queueing:consumer <queuename> [-i<driver>]
php app/console kaliop_queueing:managedriver list
php app/console kaliop_queueing:managequeue list-configured [-i<driver>]
php app/console kaliop_queueing:managequeue info <queuename> [-i<driver>]
Known limitations
• Assumes good security on the network
• Low throughput
• Spinning up a new php worker process takes time
• Specific features of the different protocols are not (yet) supported
• The goal remains to have a uniform API
Further evolution
• Instead of spinning off a console command for each message
received, send an http call to a php-fpm process
• Support for RPC-style calls
• Others?
• Suggestions are welcome
Symfony
listener
Symfony
worker
Libre
Office
Queue
HTTP
Web server: php
daemon
It’s all about eXperience
Thanks for
listening
The end

Contenu connexe

Tendances

Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Tim Bunce
 
Designing a Docker Stack for Symfony apps: lessons learned
Designing a Docker Stack  for Symfony apps: lessons learnedDesigning a Docker Stack  for Symfony apps: lessons learned
Designing a Docker Stack for Symfony apps: lessons learnedGaetano Giunta
 
Asynchronous Programming in Kotlin with Coroutines
Asynchronous Programming in Kotlin with CoroutinesAsynchronous Programming in Kotlin with Coroutines
Asynchronous Programming in Kotlin with CoroutinesTobias Schürg
 
JRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherJRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherCharles Nutter
 
Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTokuhiro Matsuno
 
2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with BlackfireMarko Mitranić
 
Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Charles Nutter
 
Troubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use itTroubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use itMichael Klishin
 
Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
 Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEFMichele Orru
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureAlvaro Videla
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkTomas Doran
 
A look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architectureA look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architectureAimee Maree Forsstrom
 
CBDW2014 - Down the RabbitMQ hole with ColdFusion
CBDW2014 - Down the RabbitMQ hole with ColdFusionCBDW2014 - Down the RabbitMQ hole with ColdFusion
CBDW2014 - Down the RabbitMQ hole with ColdFusionOrtus Solutions, Corp
 
I'm the butcher would you like some BeEF
I'm the butcher would you like some BeEFI'm the butcher would you like some BeEF
I'm the butcher would you like some BeEFMichele Orru
 

Tendances (20)

EhTrace -- RoP Hooks
EhTrace -- RoP HooksEhTrace -- RoP Hooks
EhTrace -- RoP Hooks
 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
 
C++ scalable network_io
C++ scalable network_ioC++ scalable network_io
C++ scalable network_io
 
Designing a Docker Stack for Symfony apps: lessons learned
Designing a Docker Stack  for Symfony apps: lessons learnedDesigning a Docker Stack  for Symfony apps: lessons learned
Designing a Docker Stack for Symfony apps: lessons learned
 
Asynchronous Programming in Kotlin with Coroutines
Asynchronous Programming in Kotlin with CoroutinesAsynchronous Programming in Kotlin with Coroutines
Asynchronous Programming in Kotlin with Coroutines
 
JRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherJRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform Further
 
Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and Testing
 
2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire
 
NullMQ @ PDX
NullMQ @ PDXNullMQ @ PDX
NullMQ @ PDX
 
Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014
 
Realtime web2012
Realtime web2012Realtime web2012
Realtime web2012
 
Troubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use itTroubleshooting RabbitMQ and services that use it
Troubleshooting RabbitMQ and services that use it
 
Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
 Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
Rooting Your Internals: Inter-Protocol Exploitation, custom shellcode and BeEF
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
A look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architectureA look at FastCgi & Mod_PHP architecture
A look at FastCgi & Mod_PHP architecture
 
Enterprise messaging
Enterprise messagingEnterprise messaging
Enterprise messaging
 
RabbitMQ
RabbitMQRabbitMQ
RabbitMQ
 
CBDW2014 - Down the RabbitMQ hole with ColdFusion
CBDW2014 - Down the RabbitMQ hole with ColdFusionCBDW2014 - Down the RabbitMQ hole with ColdFusion
CBDW2014 - Down the RabbitMQ hole with ColdFusion
 
I'm the butcher would you like some BeEF
I'm the butcher would you like some BeEFI'm the butcher would you like some BeEF
I'm the butcher would you like some BeEF
 

En vedette

De Legacy à Symfony
De Legacy à SymfonyDe Legacy à Symfony
De Legacy à SymfonyAlayaCare
 
La Console Symfony
La Console Symfony La Console Symfony
La Console Symfony Imad ZAIRIG
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravelwajrcs
 

En vedette (6)

De Legacy à Symfony
De Legacy à SymfonyDe Legacy à Symfony
De Legacy à Symfony
 
Symfony forms
Symfony formsSymfony forms
Symfony forms
 
Empezando con Twig
Empezando con TwigEmpezando con Twig
Empezando con Twig
 
La Console Symfony
La Console Symfony La Console Symfony
La Console Symfony
 
RabbitMQ y Symfony
RabbitMQ y SymfonyRabbitMQ y Symfony
RabbitMQ y Symfony
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravel
 

Similaire à How a message broker and queueing bundle improved a document generation workflow

Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message BrokersGaetano Giunta
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_monTomas Doran
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQZoran Majstorovic
 
Enterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdfEnterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdfOrtus Solutions, Corp
 
Multiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqMultiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqdevObjective
 
Multiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqMultiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqColdFusionConference
 
Data Pipelines with Apache Kafka
Data Pipelines with Apache KafkaData Pipelines with Apache Kafka
Data Pipelines with Apache KafkaBen Stopford
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoTareque Hossain
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pieTomas Doran
 
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de BruinITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de BruinOrtus Solutions, Corp
 
Multi-language/multi-OS communication using RabbitMQ
Multi-language/multi-OS communication using RabbitMQMulti-language/multi-OS communication using RabbitMQ
Multi-language/multi-OS communication using RabbitMQWil de Bruin
 
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQAlvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQTanya Denisyuk
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UKRicard Clau
 
Multi-platform Enterprise Messaging with RabbitMQ
Multi-platform Enterprise Messaging with RabbitMQMulti-platform Enterprise Messaging with RabbitMQ
Multi-platform Enterprise Messaging with RabbitMQOrtus Solutions, Corp
 
High scale flavour
High scale flavourHigh scale flavour
High scale flavourTomas Doran
 
The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP Eberhard Wolff
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPEberhard Wolff
 
AMF Flash and .NET
AMF Flash and .NETAMF Flash and .NET
AMF Flash and .NETYaniv Uriel
 

Similaire à How a message broker and queueing bundle improved a document generation workflow (20)

Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message Brokers
 
Real time system_performance_mon
Real time system_performance_monReal time system_performance_mon
Real time system_performance_mon
 
Ruby Microservices with RabbitMQ
Ruby Microservices with RabbitMQRuby Microservices with RabbitMQ
Ruby Microservices with RabbitMQ
 
Enterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdfEnterprise Messaging with RabbitMQ.pdf
Enterprise Messaging with RabbitMQ.pdf
 
Multiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqMultiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mq
 
Multiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mqMultiply like rabbits with rabbit mq
Multiply like rabbits with rabbit mq
 
Data Pipelines with Apache Kafka
Data Pipelines with Apache KafkaData Pipelines with Apache Kafka
Data Pipelines with Apache Kafka
 
Life in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with djangoLife in a Queue - Using Message Queue with django
Life in a Queue - Using Message Queue with django
 
Cooking a rabbit pie
Cooking a rabbit pieCooking a rabbit pie
Cooking a rabbit pie
 
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de BruinITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
ITB2019 Multi-language / multi-OS communication using RabbitMQ - Wil de Bruin
 
Multi-language/multi-OS communication using RabbitMQ
Multi-language/multi-OS communication using RabbitMQMulti-language/multi-OS communication using RabbitMQ
Multi-language/multi-OS communication using RabbitMQ
 
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQAlvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
Alvaro Videla, Building a Distributed Data Ingestion System with RabbitMQ
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UK
 
Multi-platform Enterprise Messaging with RabbitMQ
Multi-platform Enterprise Messaging with RabbitMQMulti-platform Enterprise Messaging with RabbitMQ
Multi-platform Enterprise Messaging with RabbitMQ
 
High scale flavour
High scale flavourHigh scale flavour
High scale flavour
 
The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP The Future of Messaging: RabbitMQ and AMQP
The Future of Messaging: RabbitMQ and AMQP
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 
AMF Flash and .NET
AMF Flash and .NETAMF Flash and .NET
AMF Flash and .NET
 
ServerSentEvents.pdf
ServerSentEvents.pdfServerSentEvents.pdf
ServerSentEvents.pdf
 

Plus de Gaetano Giunta

php day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez componentsphp day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez componentsGaetano Giunta
 
phpday 2006 - SEA case study
phpday 2006 - SEA case studyphpday 2006 - SEA case study
phpday 2006 - SEA case studyGaetano Giunta
 
phpday 2006 - WS in PHP
phpday 2006 - WS in PHPphpday 2006 - WS in PHP
phpday 2006 - WS in PHPGaetano Giunta
 
Powerful Automation Made Simple
Powerful Automation Made SimplePowerful Automation Made Simple
Powerful Automation Made SimpleGaetano Giunta
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish DatabaseGaetano Giunta
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...Gaetano Giunta
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studyGaetano Giunta
 
EzPerformancelogger & Graphite
EzPerformancelogger & GraphiteEzPerformancelogger & Graphite
EzPerformancelogger & GraphiteGaetano Giunta
 
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Gaetano Giunta
 
eZPublish meets Simfony2 - phpDay2013
eZPublish meets Simfony2  - phpDay2013eZPublish meets Simfony2  - phpDay2013
eZPublish meets Simfony2 - phpDay2013Gaetano Giunta
 
Ez performance measurement
Ez performance measurementEz performance measurement
Ez performance measurementGaetano Giunta
 
Ez Content Staging for the rest of us
Ez Content Staging for the rest of usEz Content Staging for the rest of us
Ez Content Staging for the rest of usGaetano Giunta
 
An eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchestAn eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchestGaetano Giunta
 

Plus de Gaetano Giunta (13)

php day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez componentsphp day 2008 - Introduzione agli ez components
php day 2008 - Introduzione agli ez components
 
phpday 2006 - SEA case study
phpday 2006 - SEA case studyphpday 2006 - SEA case study
phpday 2006 - SEA case study
 
phpday 2006 - WS in PHP
phpday 2006 - WS in PHPphpday 2006 - WS in PHP
phpday 2006 - WS in PHP
 
Powerful Automation Made Simple
Powerful Automation Made SimplePowerful Automation Made Simple
Powerful Automation Made Simple
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish Database
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case study
 
EzPerformancelogger & Graphite
EzPerformancelogger & GraphiteEzPerformancelogger & Graphite
EzPerformancelogger & Graphite
 
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
Symfony HTTP Kernel for refactoring legacy apps: the eZ Publish case study - ...
 
eZPublish meets Simfony2 - phpDay2013
eZPublish meets Simfony2  - phpDay2013eZPublish meets Simfony2  - phpDay2013
eZPublish meets Simfony2 - phpDay2013
 
Ez performance measurement
Ez performance measurementEz performance measurement
Ez performance measurement
 
Ez Content Staging for the rest of us
Ez Content Staging for the rest of usEz Content Staging for the rest of us
Ez Content Staging for the rest of us
 
An eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchestAn eZ Publish Craftsman's toolchest
An eZ Publish Craftsman's toolchest
 

Dernier

办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 

Dernier (17)

young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 

How a message broker and queueing bundle improved a document generation workflow

  • 1. It’s all about eXperience Gaetano Giunta Gilles Guirand Forum PHP Paris 2015/11/24 Rabbits, indians and... Symfony meets queueing brokers
  • 2. Brokers, don’t they work in Wall Street?
  • 3. Brokers, don’t they work in Wall Street? Message brokers are a building block of Message oriented middleware. [wikipedia]
  • 4. Brokers, don’t they work in Wall Street? Message brokers are a building block of Message oriented middleware. [wikipedia] Message oriented middleware (MOM) is software or hardware infrastructure supporting the sending and receiving of messages between distributed systems [same as above]
  • 5. • RabbitMQ • ActiveMQ • Apollo • Kafka • Kestrel • Amazon SQS • ZeroMQ* • And many more… Let’s try again: can you name any broker?
  • 7. Where do they differ? • Protocol support (amqp, stomp, …) • Libraries exist for writing clients using standard protocols • Other offer their own SDK • Routing • Amqp has exchanges and queues, Stomp only queues • Wildcards in queue names are supported by most systems • Delivery guarantees • Possible double delivery? • Out of order dispatch
  • 8. Where do they differ? • Surviving failures • Are messages sent before the client is started buffered or lost? • What happens when a client crashes? • Support for ACK/NACK mechanisms • Clustering • And if the server crashes? • Performances • Batch send/receive – prefetch • Polling vs. persistent connections
  • 11. A case study: generating MSOffice docs The needs • Produce content in Microsoft Office formats • Many formats for each document • Both Word and Excel docs • XML content generated by CMS • LibreOffice used to generate MS Office and PDF versions • Has anyone tried generating OOXML by hand?
  • 12. A case study: generating MSOffice docs Reality bites • Slooow • Rest assured that some of the docs will be pretty big • Unreliable • Depending on version, LO crashes from a-bit to almost-always • Race-prone • Two conversion jobs in parallel step on each other
  • 13. A case study: generating MSOffice docs …and the results are: • Ugly code: lots of polling, copying of files around, manual locking • Does not scale at all: only one conversion process active at any given time Web server PHP Libre Office Waiting processes
  • 14. TextBook scenario for introducing queues Web server Consumer Rabbit MQ Libre Office PHP
  • 15. TextBook scenario for introducing queues Web server Consumer ? Rabbit MQ Libre Office PHP
  • 16. TextBook scenario for introducing queues Web server PHP !!! Rabbit MQ Libre Office PHP
  • 17. TextBook scenario for introducing queues Web server PHP ! Rabbit MQ Libre Office PHP
  • 18. TextBook scenario for introducing queues Web server Symfony !!! Rabbit MQ Libre Office Symfony
  • 19. TextBook scenario for introducing queues Web server Symfony !!! Rabbit MQ Libre Office Symfony
  • 20. The rationale • Same library handling both sides of the connection • Easier to troubleshoot • Sf Console component is lovely • Everything developed in a single repository • No need to learn new languages • Everything which I can rewrite in PHP, I eventually will* * = 3rd whimsical law of Gaetano
  • 21. There is a bundle for that oldsound/rabbitmq-bundle • specific to RabbitMQ • supports both producers and consumers php app/console rabbitmq:consumer <name> class FooConsumer implements ConsumerInterface { public function execute(AMQPMessage $msg) { $foo = unserialize($msg->body); echo 'foo '.$foo->getName()." successfully downloaded!n"; } }
  • 22. Long lived php processes ? • Fatal errors • Memory leaks • Database connections might become broken • Is it in your code or in a dependency?
  • 23. A new hope • kaliop/queueingbundle • kaliop/queueingbundle-sqs • kaliop/queueingbundle-stomp
  • 24. A design focusing on safety • The consumer has been split in 2 • The listener is long lived; it spins up a php worker process each time it receives a command • The worker process is a Symfony console command • It handles a single message then exits Symfony listener Symfony worker Libre Office Queue
  • 25. Does it scale ? • The listener waits for the worker to finish before staring another • Solution: run multiple listeners in parallel W Symfony listener Symfony worker Libre Office Queue Symfony listener Symfony worker Libre Office
  • 26. Multiple protocol support Kaliop Queueing Bundles fusesource/stomp-phpaws/aws-sdk-php oldsound/rabbitmq ActiveMQ ApolloSQS RabbitMQ Application
  • 27. Easy to use • Message encoding taken care of (JSON by default) • Has events your code can listen to alter the consumption loop Message received Do stuff Consump tion failed Message consumed Exception
  • 28. Show me da code old_sound_rabbit_mq: connections: default: ... producers: my_producer: connection: default exchange_options: name: my_producer.exchange type: topic consumers: my_consumer: connection: default exchange_options: name: my_producer.exchange type: topic queue_options: name: my_queue callback: my_symphony_service
  • 29. Show me da code Worker use KaliopQueueingBundleServiceMessageConsumer; class MyConsumer extends MessageConsumer { /** * @param mixed $body */ public function consume($body) { // do stuff ... } }
  • 30. Show me da code Lots of console commands available php app/console kaliop_queueing:queuemessage <queuename> <msg body> php app/console kaliop_queueing:consumer <queuename> [-i<driver>] php app/console kaliop_queueing:managedriver list php app/console kaliop_queueing:managequeue list-configured [-i<driver>] php app/console kaliop_queueing:managequeue info <queuename> [-i<driver>]
  • 31. Known limitations • Assumes good security on the network • Low throughput • Spinning up a new php worker process takes time • Specific features of the different protocols are not (yet) supported • The goal remains to have a uniform API
  • 32. Further evolution • Instead of spinning off a console command for each message received, send an http call to a php-fpm process • Support for RPC-style calls • Others? • Suggestions are welcome Symfony listener Symfony worker Libre Office Queue HTTP Web server: php daemon
  • 33. It’s all about eXperience Thanks for listening The end

Notes de l'éditeur

  1. Uke: read title
  2. Tori: read slide
  3. Tori: read slide Uke Q: sending and receiving messages between distributed systems, do you mean email ?
  4. Gilles : fifo ?
  5. Idea: make a feature matrix
  6. Q: polling ?