SlideShare a Scribd company logo
1 of 77
Download to read offline
Mike Willbanks | Barnes & Noble


Message Queues : A Primer
Housekeeping…
•  Talk
   –  Slides will be posted after the talk.
•  Me
   –  Sr. Web Architect Manager at NOOK
      Developer
   –  Prior MNPHP Organizer
   –  Open Source Contributor
   –  Where you can find me:
        •  Twitter: mwillbanks           G+: Mike Willbanks
        •  IRC (freenode): mwillbanks Blog:
           http://blog.digitalstruct.com
        •  GitHub: https://github.com/mwillbanks
Agenda
•    Message Queues?
•    Protocols and Software
•    Picking a Message Queue
•    Best Practices
A Definition
“Message queues and mailboxes are software-engineering
components used for interprocess communication, or for inter-
thread communication within the same process. They use a queue
for messaging – the passing of control or of content.”
What is messaging?
“Messaging describes the sending and receiving of data (in the
form of messages) between systems. Messages are exchanged
between programs or applications, similar to the way people
communicate by email but with guarantees on delivery, speed,
security and the absence of spam.”
Producer                 Messages                 Consumer




                            Messages
                              Task




                            Messages




General Anatomy
Producer creates a message and pushes it to the queue; the
consumer reads from the queue and processes the message.
Describing Message Queues
l    Pub/Sub
l    FIFO buffer
l    Push / Pull
l    A way to communicate between
      applications / systems.
l    A way to decouple components.
l    A way to offload work.
Why to use a Message Queue
l    Offload Heavy Work
l    Integration with Legacy Systems
l    Asynchronous Processing
l    Parallel Processing
l    Process consistency
l    Scalability
Unix Foundations
l    “Write programs that work together.”
l    “Do it in the background.”
Why it matters
l    Web systems need to be geared to run things
      asynchronously.
l    Distribution of load
l    System integrity
You’ve seen them before; they are used in most applications to
help them scale.

MESSAGE QUEUE EXAMPLES
When to make use of message queues in case you’re wondering.

GENERIC USE CASES
Notifications
Email, SMS, Push Messaging….
Photo Processing
Thumbnails, Resizing, Watermarking, Converting…
Video Processing
Resampling, Audio Overlay, Type Conversion…
Analytics
Web Server Logs, Log Aggregation, PHP Errors, etc.
Integrations
Save local first; push second.
AMQP
STOMP
XMPP
Vendor Specific

PROTOCOLS
AMQP
Advanced Message Queuing Protocol
Overview of AMQP
l    AMQP Working Group (Community and
      Vendor)
l    Platform agnostic protocol.
l    Completely open, interoperable and broadly
      applicable.
l    Many severs available and many client
      libraries.
How it Works
Producer, Exchange, Queue, Consumer
How it Works
l    AMQP utilizes exchanges, queues and
      bindings.
l    An exchange are routers with routing tables.
l    A binding defines the routing rules.
l    A queue is where the messages wait for a
      consumer.
Exchanges
Understanding Exchanges
l    Fanout Exchange
       l  No routing keys involved. Any message that is

           sent to the exchange is sent to all queues bound
           to that exchange.
l    Direct Exchange
       l  Routing keys involved. A queue binds to the

           exchange to request messages that match a
           routing key exactly.
l    Topic Exchange
       l  Routing keys involved. A queue binds to the

           exchange to request messages that match a
           routing key pattern.
Implementations
  www.rabbitmq.com
  Very popular and common message queue owned by
  VMware.

  qpid.apache.org
  Long standing project; apache foundation.


  www.openamq.org
  Long standing project; ZeroMQ partner, no news since
  2009.
Building a Queue
l    An exchange, queue and bindings must be defined
      first. Publishing can then commence after.
       l  Create the queue


       l  Create the exchange


       l  Bind to the queue.
Persistence?
l    Default behavior is no persistence.
l    How important are the messages?
l    Just about all items have a level of persistence if you
      would like them to survive on reboot.
      l    Mark exchanges, queues and messages as DURABLE.
PECL AMQP
l    Extension compatible with AMQP specification
      0-9-1.
l    pecl install amqp
AMQP Client
AMQP Worker
STOMP
Simple (or Streaming) Text Orientated Messaging Protocol
Overview
l    Simple protocol
      l    Behaviors follow very simple commands.
l    Most message queues can communicate over
      STOMP.
/queue/
                                            msg
              Connect           Send                Disconnect




                                          /queue/                S
                                            msg                  T
                                                                 O
             Connect          Subscribe             Disconnect
                                                                 M
                                                                 P
      P
      H
                                                                 S
      P
                                                                 E
                                                                 R
                                                                 V
                               Read                              E
                                                                 R




                               Ack




How It Works
l        When you send in a message, you tell it which
          queue to go to.
l        When you subscribe you request a queue.
Sever Implementations
       activemq.apache.org
       One of the oldest message queues existing;
       a apache foundation project
       activemq.apache.org/apollo
       Next generation ActiveMQ


       www.rabbitmq.com
       Very popular and common message queue owned by
       VMware.


       www.jboss.org/hornetq
       Supported by Red Hat Middle Ware division, picking
       up steam.
PECL Stomp
l    pecl install stomp
l    That was easy J
STOMP Client
STOMP Worker
XMPP
Extensible Messaging and Presence Protocol
(Although not really a “Message Queue”)
Overview
l    Best for real-time data.
l    Leveraging pub/sub can turn it into more of a generic message
      system.
l    Multiple libraries
      l    JAXL - https://github.com/abhinavsingh/JAXL
      l    Xmpp - https://github.com/alexmace/Xmpp
Publish




                                      to, id,
                                     message




                          Subscribe

                                                    id,
                                          from, to,
                                            message




        Sub1                Sub2                          Sub3




XEP-0060: Publish-Subscribe
l    Specification for implementing Publish Subscribe
      models.
l    Extension to the original XMPP specification.
Publish
Message
Various others; including Gearman, ZeroMQ, etc.

SPECIAL MESSAGE QUEUES
Overview
l    There are job servers available that are more
      flexible or more specific.
      l    Extreme Flexibility
      l    Job Severs
      l    Cloud Messaging
ZeroMQ
The ultimate in message queue flexibility.
Socket library that acts as a concurrency framework.
Contains a PHP extension.
Several Types of Queues
Request / Reply
Publish / Subscribe
Parallel Pipeline
Fair Queuing
And more…
ZeroMQ Client Example
ZeroMQ Worker Example
Gearman
l    Application framework for farming out work.
l    Job sever for asynchronous or synchronous
      messages.
Gearman
l    Pass a job to the job server
l    Worker receives the job and processes
l    Ability to persist if enabled; default is in-memory.
Gearman Client Example
Gearman Worker Example
Beanstalkd
l    Asynchronous Job Queue
l    Good scheduling system (aka delays).
l    User land PHP clients.
Application Code



                         Beanstalkd Client API
                             (Pheanstalk)




                           Beanstalkd Server




                         Beanstalkd Worker API
                             (Pheanstalk)



                        Worker Application Code




Beanstalkd
l    Pass a job to the job server
l    Worker receives the job and processes
l    Ability to persist to binlog; default is in-memory
Pheanstalk Client
Pheanstalk Worker
What you want to look for.

PICKING A MESSAGE QUEUE
The Trifecta

                                                  l?
                                        Horizonta
                                         Vertical?

                                           Scale



                                        Messages
                                   Messages Messages

                                Messages         Messages
                                        Messages
                                Messages     Messages
                                       Messages
                                                                                  ry?
           ed?                                                           In-Memo
R a w Sp e                                                                         ce?
            es?
                  Performance                               Durability
                                                                         Persisten
# Messag                                                                             n?
                                                                          Replicatio
Standards
•  A recognized standard?
  –  AMQP? STOMP? XMPP?
•  How many developers?
  –  Will an unfortunate event kill off the
     product?
•  Undocumented protocol?
  –  Forget about it!
Delivery Policies

 Store Message                  Saved?




Receive Message                 TTL?




Process Message                 ACK?
Message Policies
•    Handling in-active messages?
•    Messages that failed processing?
•    Time to live?
•    Retry?
•    Ability to check message status?
Routing Policies
•    Fanout?
•    Direct?
•    Topic?
•    Broadcast?
•    Etc?
Security Policies
•  Require authentication?
  –  LDAP/AD integration?
•  Connection Restrictions?
•  Require logging?
  –  Compliance
  –  Intrusion Detection
Rules of the road my friends…

BEST PRACTICES
Messages
•  Formatting
  –  JSON or XML are great options.
     •  Please no serialized PHP objects.
•  Message Size
  –  Only as large as necessary.
     •  Don’t send a binary object through the queue.
Workers
•  Dumb as possible!
  –  Single message type
     •  Easier to scale.
  –  Single operation
     •  Easy to debug and far more flexible.
PHP Daemons
•  Prevent Memory Leaks
  –  Detection
  –  Cycle Workers
•  Handle Signals
  –  Properly shutdown!
  –  Watch out for OS service kills
•  Sleeping is good J
Database




   Worker Server                       Web Server




                       Message Queue




Environment Integration
Web Server -> Message Queue
Worker Server -> Message Queue
Database




                                                             Web Server
                  Worker Server




  Worker Server



                                             Message Queue
                                                                          Send to 1


                                             Message Queue




High Availability
Insert multiple message queue servers + multiple worker nodes.
Each worker node can connect to as many message queue servers
as necessary.
Supervisord
Process monitoring, logging and more!
Installing Supervisord
•  Requires: python-setuptools
         sudo easy_install supervisor!

•  Generate Configuration
      sudo echo_supervisord_conf > /etc/
               supervisord.conf!
                      !
These slides will be posted to SlideShare & SpeakerDeck.
   SpeakerDeck: http://speakerdeck.com/u/mwillbanks
   Slideshare: http://www.slideshare.net/mwillbanks
   Twitter: mwillbanks
   G+: Mike Willbanks
   IRC (freenode): mwillbanks
   Blog: http://blog.digitalstruct.com
   GitHub: https://github.com/mwillbanks




QUESTIONS?

More Related Content

What's hot

High Performance Computing: State of the Industry
High Performance Computing: State of the IndustryHigh Performance Computing: State of the Industry
High Performance Computing: State of the IndustryIMEX Research
 
Closing the DevOps gaps
Closing the DevOps gapsClosing the DevOps gaps
Closing the DevOps gapsdev2ops
 
IMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATION
IMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATIONIMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATION
IMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATIONradziwil
 
Cloud Scaling with Memcached
Cloud Scaling with MemcachedCloud Scaling with Memcached
Cloud Scaling with MemcachedGear6
 
DIANA: Scenarios for QoS based integration of IP and ATM
DIANA: Scenarios for QoS based integration of IP and ATMDIANA: Scenarios for QoS based integration of IP and ATM
DIANA: Scenarios for QoS based integration of IP and ATMJohn Loughney
 
Nic teaming and converged fabric
Nic teaming and converged fabricNic teaming and converged fabric
Nic teaming and converged fabrichypervnu
 

What's hot (9)

High Performance Computing: State of the Industry
High Performance Computing: State of the IndustryHigh Performance Computing: State of the Industry
High Performance Computing: State of the Industry
 
Closing the DevOps gaps
Closing the DevOps gapsClosing the DevOps gaps
Closing the DevOps gaps
 
IMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATION
IMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATIONIMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATION
IMPROVING TRANSMISSION EFFICIENCY IN OPTICAL COMMUNICATION
 
Cloud Scaling with Memcached
Cloud Scaling with MemcachedCloud Scaling with Memcached
Cloud Scaling with Memcached
 
DIANA: Scenarios for QoS based integration of IP and ATM
DIANA: Scenarios for QoS based integration of IP and ATMDIANA: Scenarios for QoS based integration of IP and ATM
DIANA: Scenarios for QoS based integration of IP and ATM
 
Mpls co s
Mpls co sMpls co s
Mpls co s
 
Security Tools Foss
Security Tools FossSecurity Tools Foss
Security Tools Foss
 
Nic teaming and converged fabric
Nic teaming and converged fabricNic teaming and converged fabric
Nic teaming and converged fabric
 
Mpls
MplsMpls
Mpls
 

Viewers also liked

Soft Launch an Institutional Eportfolio Initiative
Soft Launch an Institutional Eportfolio InitiativeSoft Launch an Institutional Eportfolio Initiative
Soft Launch an Institutional Eportfolio InitiativeElizabeth Nesius
 
Future Success Web 2 Overview
Future Success Web 2 OverviewFuture Success Web 2 Overview
Future Success Web 2 Overviewpapin0
 
Creating a Helpdesk Where None Exists
Creating a Helpdesk Where None ExistsCreating a Helpdesk Where None Exists
Creating a Helpdesk Where None ExistsElizabeth Nesius
 
Law & grace
Law & graceLaw & grace
Law & graceGeo Acts
 
Oracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified StorageOracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified StorageDavid R. Klauser
 
Web并发模型粗浅探讨
Web并发模型粗浅探讨Web并发模型粗浅探讨
Web并发模型粗浅探讨Robbin Fan
 
2 Thessalonians 2
2 Thessalonians 22 Thessalonians 2
2 Thessalonians 2Geo Acts
 
Mariocarretero reseñaconstructivismo
Mariocarretero reseñaconstructivismoMariocarretero reseñaconstructivismo
Mariocarretero reseñaconstructivismoGeovanny Armijos
 
How will You Measure the Worth of Your Life - UMHB
How will You Measure the Worth of Your Life - UMHBHow will You Measure the Worth of Your Life - UMHB
How will You Measure the Worth of Your Life - UMHBSam Henry
 
Welcome to msp information night 2013
Welcome to msp information night 2013Welcome to msp information night 2013
Welcome to msp information night 2013Bret Biornstad
 
Cymphonix Launches iPhone App and New Version of Network Composer Software
Cymphonix Launches iPhone App and New Version of Network Composer SoftwareCymphonix Launches iPhone App and New Version of Network Composer Software
Cymphonix Launches iPhone App and New Version of Network Composer SoftwareJulie Tangen
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel DevelopmentMohammed Farrag
 
Enterprise Social Software Executive Introduction
Enterprise Social Software Executive IntroductionEnterprise Social Software Executive Introduction
Enterprise Social Software Executive Introductionsharonmichnay
 
Les 1 Inleiding En Functioneren Van Organisaties
Les 1 Inleiding En Functioneren Van OrganisatiesLes 1 Inleiding En Functioneren Van Organisaties
Les 1 Inleiding En Functioneren Van OrganisatiesMediena Business School
 
Come fare un Pitch a Innova Day
Come fare un Pitch a Innova DayCome fare un Pitch a Innova Day
Come fare un Pitch a Innova DayFrancesco Baruffi
 
Lessons Learned and Best Practices for Game Development in the Cloud
Lessons Learned and Best Practices for Game Development in the CloudLessons Learned and Best Practices for Game Development in the Cloud
Lessons Learned and Best Practices for Game Development in the Cloudsarahnovotny
 
Cap 4 gases-3662
Cap 4 gases-3662Cap 4 gases-3662
Cap 4 gases-3662opulento22
 
International Social Media Trends
International Social Media TrendsInternational Social Media Trends
International Social Media TrendsSueGrant
 

Viewers also liked (20)

Soft Launch an Institutional Eportfolio Initiative
Soft Launch an Institutional Eportfolio InitiativeSoft Launch an Institutional Eportfolio Initiative
Soft Launch an Institutional Eportfolio Initiative
 
Future Success Web 2 Overview
Future Success Web 2 OverviewFuture Success Web 2 Overview
Future Success Web 2 Overview
 
Creating a Helpdesk Where None Exists
Creating a Helpdesk Where None ExistsCreating a Helpdesk Where None Exists
Creating a Helpdesk Where None Exists
 
Law & grace
Law & graceLaw & grace
Law & grace
 
Oracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified StorageOracle Exec Summary 7000 Unified Storage
Oracle Exec Summary 7000 Unified Storage
 
Web并发模型粗浅探讨
Web并发模型粗浅探讨Web并发模型粗浅探讨
Web并发模型粗浅探讨
 
2 Thessalonians 2
2 Thessalonians 22 Thessalonians 2
2 Thessalonians 2
 
Mariocarretero reseñaconstructivismo
Mariocarretero reseñaconstructivismoMariocarretero reseñaconstructivismo
Mariocarretero reseñaconstructivismo
 
How will You Measure the Worth of Your Life - UMHB
How will You Measure the Worth of Your Life - UMHBHow will You Measure the Worth of Your Life - UMHB
How will You Measure the Worth of Your Life - UMHB
 
Welcome to msp information night 2013
Welcome to msp information night 2013Welcome to msp information night 2013
Welcome to msp information night 2013
 
Cymphonix Launches iPhone App and New Version of Network Composer Software
Cymphonix Launches iPhone App and New Version of Network Composer SoftwareCymphonix Launches iPhone App and New Version of Network Composer Software
Cymphonix Launches iPhone App and New Version of Network Composer Software
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
 
Enterprise Social Software Executive Introduction
Enterprise Social Software Executive IntroductionEnterprise Social Software Executive Introduction
Enterprise Social Software Executive Introduction
 
Les 1 Inleiding En Functioneren Van Organisaties
Les 1 Inleiding En Functioneren Van OrganisatiesLes 1 Inleiding En Functioneren Van Organisaties
Les 1 Inleiding En Functioneren Van Organisaties
 
Come fare un Pitch a Innova Day
Come fare un Pitch a Innova DayCome fare un Pitch a Innova Day
Come fare un Pitch a Innova Day
 
Lessons Learned and Best Practices for Game Development in the Cloud
Lessons Learned and Best Practices for Game Development in the CloudLessons Learned and Best Practices for Game Development in the Cloud
Lessons Learned and Best Practices for Game Development in the Cloud
 
Debt Taxes
Debt TaxesDebt Taxes
Debt Taxes
 
Sf 02S201test
Sf 02S201testSf 02S201test
Sf 02S201test
 
Cap 4 gases-3662
Cap 4 gases-3662Cap 4 gases-3662
Cap 4 gases-3662
 
International Social Media Trends
International Social Media TrendsInternational Social Media Trends
International Social Media Trends
 

Similar to Message Queues : A Primer - International PHP Conference Fall 2012

NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2
NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2 NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2
NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2 DataStax Academy
 
NYC* Big Tech Day 2013: Financial Time Series
NYC* Big Tech Day 2013: Financial Time SeriesNYC* Big Tech Day 2013: Financial Time Series
NYC* Big Tech Day 2013: Financial Time SeriesCarl Yeksigian
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 
High powered messaging with RabbitMQ
High powered messaging with RabbitMQHigh powered messaging with RabbitMQ
High powered messaging with RabbitMQJames Carr
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupMickaël Rémond
 
Plone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just worksPlone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just worksAsko Soukka
 
Lindsay distributed geventzmq
Lindsay distributed geventzmqLindsay distributed geventzmq
Lindsay distributed geventzmqRobin Xiao
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPEberhard Wolff
 
Easy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQPEasy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQPRabbit MQ
 
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPPFast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPPPradeep Elankumaran
 
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
 
Samza portable runner for beam
Samza portable runner for beamSamza portable runner for beam
Samza portable runner for beamHai Lu
 
Why Erlang? - Bar Camp Atlanta 2008
Why Erlang?  - Bar Camp Atlanta 2008Why Erlang?  - Bar Camp Atlanta 2008
Why Erlang? - Bar Camp Atlanta 2008boorad
 
RabbitMQ interview Questions and Answers
RabbitMQ interview Questions and AnswersRabbitMQ interview Questions and Answers
RabbitMQ interview Questions and Answersjeetendra mandal
 
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
 
How the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendorsHow the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendorsWSO2
 
Learning Elixir as a Rubyist
Learning Elixir as a RubyistLearning Elixir as a Rubyist
Learning Elixir as a RubyistAlex Kira
 
Jdd2014: High performance logging - Peter Lawrey
Jdd2014: High performance logging - Peter LawreyJdd2014: High performance logging - Peter Lawrey
Jdd2014: High performance logging - Peter LawreyPROIDEA
 
RabbitMQ And Nanite
RabbitMQ And NaniteRabbitMQ And Nanite
RabbitMQ And Nanitemattmatt
 

Similar to Message Queues : A Primer - International PHP Conference Fall 2012 (20)

NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2
NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2 NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2
NYC* Tech Day — BlueMountain Capital — Financial Time Series w/Cassandra 1.2
 
NYC* Big Tech Day 2013: Financial Time Series
NYC* Big Tech Day 2013: Financial Time SeriesNYC* Big Tech Day 2013: Financial Time Series
NYC* Big Tech Day 2013: Financial Time Series
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
The bigrabbit
The bigrabbitThe bigrabbit
The bigrabbit
 
High powered messaging with RabbitMQ
High powered messaging with RabbitMQHigh powered messaging with RabbitMQ
High powered messaging with RabbitMQ
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF Meetup
 
Plone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just worksPlone, rabbit mq and messaging that just works
Plone, rabbit mq and messaging that just works
 
Lindsay distributed geventzmq
Lindsay distributed geventzmqLindsay distributed geventzmq
Lindsay distributed geventzmq
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
Easy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQPEasy enterprise application integration with RabbitMQ and AMQP
Easy enterprise application integration with RabbitMQ and AMQP
 
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPPFast & Scalable Front/Back-ends using Ruby, Rails & XMPP
Fast & Scalable Front/Back-ends using Ruby, Rails & XMPP
 
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
 
Samza portable runner for beam
Samza portable runner for beamSamza portable runner for beam
Samza portable runner for beam
 
Why Erlang? - Bar Camp Atlanta 2008
Why Erlang?  - Bar Camp Atlanta 2008Why Erlang?  - Bar Camp Atlanta 2008
Why Erlang? - Bar Camp Atlanta 2008
 
RabbitMQ interview Questions and Answers
RabbitMQ interview Questions and AnswersRabbitMQ interview Questions and Answers
RabbitMQ interview Questions and Answers
 
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
 
How the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendorsHow the WSO2 ESB outperforms other major open source esb vendors
How the WSO2 ESB outperforms other major open source esb vendors
 
Learning Elixir as a Rubyist
Learning Elixir as a RubyistLearning Elixir as a Rubyist
Learning Elixir as a Rubyist
 
Jdd2014: High performance logging - Peter Lawrey
Jdd2014: High performance logging - Peter LawreyJdd2014: High performance logging - Peter Lawrey
Jdd2014: High performance logging - Peter Lawrey
 
RabbitMQ And Nanite
RabbitMQ And NaniteRabbitMQ And Nanite
RabbitMQ And Nanite
 

More from Mike Willbanks

2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queueMike Willbanks
 
ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service ComponentsMike Willbanks
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2Mike Willbanks
 
Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Mike Willbanks
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Mike Willbanks
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Mike Willbanks
 
Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Mike Willbanks
 
Leveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsLeveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsMike Willbanks
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleMike Willbanks
 
Varnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyVarnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyMike Willbanks
 
Zend Framework Push Notifications
Zend Framework Push NotificationsZend Framework Push Notifications
Zend Framework Push NotificationsMike Willbanks
 
Mobile Push Notifications
Mobile Push NotificationsMobile Push Notifications
Mobile Push NotificationsMike Willbanks
 
SOA with Zend Framework
SOA with Zend FrameworkSOA with Zend Framework
SOA with Zend FrameworkMike Willbanks
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011Mike Willbanks
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101Mike Willbanks
 
The Art of Message Queues
The Art of Message QueuesThe Art of Message Queues
The Art of Message QueuesMike Willbanks
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 

More from Mike Willbanks (20)

2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queue
 
ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service Components
 
Writing Services with ZF2
Writing Services with ZF2Writing Services with ZF2
Writing Services with ZF2
 
Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
 
Varnish Cache
Varnish CacheVarnish Cache
Varnish Cache
 
Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.
 
Leveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsLeveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push Notifications
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
 
Varnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyVarnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright Crazy
 
Zend Framework Push Notifications
Zend Framework Push NotificationsZend Framework Push Notifications
Zend Framework Push Notifications
 
Mobile Push Notifications
Mobile Push NotificationsMobile Push Notifications
Mobile Push Notifications
 
SOA with Zend Framework
SOA with Zend FrameworkSOA with Zend Framework
SOA with Zend Framework
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
The Art of Message Queues
The Art of Message QueuesThe Art of Message Queues
The Art of Message Queues
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
LiquiBase
LiquiBaseLiquiBase
LiquiBase
 

Recently uploaded

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Message Queues : A Primer - International PHP Conference Fall 2012

  • 1. Mike Willbanks | Barnes & Noble Message Queues : A Primer
  • 2. Housekeeping… •  Talk –  Slides will be posted after the talk. •  Me –  Sr. Web Architect Manager at NOOK Developer –  Prior MNPHP Organizer –  Open Source Contributor –  Where you can find me: •  Twitter: mwillbanks G+: Mike Willbanks •  IRC (freenode): mwillbanks Blog: http://blog.digitalstruct.com •  GitHub: https://github.com/mwillbanks
  • 3. Agenda •  Message Queues? •  Protocols and Software •  Picking a Message Queue •  Best Practices
  • 4. A Definition “Message queues and mailboxes are software-engineering components used for interprocess communication, or for inter- thread communication within the same process. They use a queue for messaging – the passing of control or of content.”
  • 5. What is messaging? “Messaging describes the sending and receiving of data (in the form of messages) between systems. Messages are exchanged between programs or applications, similar to the way people communicate by email but with guarantees on delivery, speed, security and the absence of spam.”
  • 6. Producer Messages Consumer Messages Task Messages General Anatomy Producer creates a message and pushes it to the queue; the consumer reads from the queue and processes the message.
  • 7. Describing Message Queues l  Pub/Sub l  FIFO buffer l  Push / Pull l  A way to communicate between applications / systems. l  A way to decouple components. l  A way to offload work.
  • 8. Why to use a Message Queue l  Offload Heavy Work l  Integration with Legacy Systems l  Asynchronous Processing l  Parallel Processing l  Process consistency l  Scalability
  • 9. Unix Foundations l  “Write programs that work together.” l  “Do it in the background.”
  • 10. Why it matters l  Web systems need to be geared to run things asynchronously. l  Distribution of load l  System integrity
  • 11. You’ve seen them before; they are used in most applications to help them scale. MESSAGE QUEUE EXAMPLES
  • 12.
  • 13.
  • 14.
  • 15. When to make use of message queues in case you’re wondering. GENERIC USE CASES
  • 17. Photo Processing Thumbnails, Resizing, Watermarking, Converting…
  • 18. Video Processing Resampling, Audio Overlay, Type Conversion…
  • 19. Analytics Web Server Logs, Log Aggregation, PHP Errors, etc.
  • 23. Overview of AMQP l  AMQP Working Group (Community and Vendor) l  Platform agnostic protocol. l  Completely open, interoperable and broadly applicable. l  Many severs available and many client libraries.
  • 24. How it Works Producer, Exchange, Queue, Consumer
  • 25. How it Works l  AMQP utilizes exchanges, queues and bindings. l  An exchange are routers with routing tables. l  A binding defines the routing rules. l  A queue is where the messages wait for a consumer.
  • 27. Understanding Exchanges l  Fanout Exchange l  No routing keys involved. Any message that is sent to the exchange is sent to all queues bound to that exchange. l  Direct Exchange l  Routing keys involved. A queue binds to the exchange to request messages that match a routing key exactly. l  Topic Exchange l  Routing keys involved. A queue binds to the exchange to request messages that match a routing key pattern.
  • 28. Implementations www.rabbitmq.com Very popular and common message queue owned by VMware. qpid.apache.org Long standing project; apache foundation. www.openamq.org Long standing project; ZeroMQ partner, no news since 2009.
  • 29. Building a Queue l  An exchange, queue and bindings must be defined first. Publishing can then commence after. l  Create the queue l  Create the exchange l  Bind to the queue.
  • 30. Persistence? l  Default behavior is no persistence. l  How important are the messages? l  Just about all items have a level of persistence if you would like them to survive on reboot. l  Mark exchanges, queues and messages as DURABLE.
  • 31. PECL AMQP l  Extension compatible with AMQP specification 0-9-1. l  pecl install amqp
  • 34. STOMP Simple (or Streaming) Text Orientated Messaging Protocol
  • 35. Overview l  Simple protocol l  Behaviors follow very simple commands. l  Most message queues can communicate over STOMP.
  • 36. /queue/ msg Connect Send Disconnect /queue/ S msg T O Connect Subscribe Disconnect M P P H S P E R V Read E R Ack How It Works l  When you send in a message, you tell it which queue to go to. l  When you subscribe you request a queue.
  • 37. Sever Implementations activemq.apache.org One of the oldest message queues existing; a apache foundation project activemq.apache.org/apollo Next generation ActiveMQ www.rabbitmq.com Very popular and common message queue owned by VMware. www.jboss.org/hornetq Supported by Red Hat Middle Ware division, picking up steam.
  • 38. PECL Stomp l  pecl install stomp l  That was easy J
  • 41. XMPP Extensible Messaging and Presence Protocol (Although not really a “Message Queue”)
  • 42. Overview l  Best for real-time data. l  Leveraging pub/sub can turn it into more of a generic message system. l  Multiple libraries l  JAXL - https://github.com/abhinavsingh/JAXL l  Xmpp - https://github.com/alexmace/Xmpp
  • 43. Publish to, id, message Subscribe id, from, to, message Sub1 Sub2 Sub3 XEP-0060: Publish-Subscribe l  Specification for implementing Publish Subscribe models. l  Extension to the original XMPP specification.
  • 46. Various others; including Gearman, ZeroMQ, etc. SPECIAL MESSAGE QUEUES
  • 47. Overview l  There are job servers available that are more flexible or more specific. l  Extreme Flexibility l  Job Severs l  Cloud Messaging
  • 48. ZeroMQ The ultimate in message queue flexibility. Socket library that acts as a concurrency framework. Contains a PHP extension.
  • 49. Several Types of Queues Request / Reply Publish / Subscribe Parallel Pipeline Fair Queuing And more…
  • 52. Gearman l  Application framework for farming out work. l  Job sever for asynchronous or synchronous messages.
  • 53. Gearman l  Pass a job to the job server l  Worker receives the job and processes l  Ability to persist if enabled; default is in-memory.
  • 56. Beanstalkd l  Asynchronous Job Queue l  Good scheduling system (aka delays). l  User land PHP clients.
  • 57. Application Code Beanstalkd Client API (Pheanstalk) Beanstalkd Server Beanstalkd Worker API (Pheanstalk) Worker Application Code Beanstalkd l  Pass a job to the job server l  Worker receives the job and processes l  Ability to persist to binlog; default is in-memory
  • 60. What you want to look for. PICKING A MESSAGE QUEUE
  • 61. The Trifecta l? Horizonta Vertical? Scale Messages Messages Messages Messages Messages Messages Messages Messages Messages ry? ed? In-Memo R a w Sp e ce? es? Performance Durability Persisten # Messag n? Replicatio
  • 62. Standards •  A recognized standard? –  AMQP? STOMP? XMPP? •  How many developers? –  Will an unfortunate event kill off the product? •  Undocumented protocol? –  Forget about it!
  • 63. Delivery Policies Store Message Saved? Receive Message TTL? Process Message ACK?
  • 64. Message Policies •  Handling in-active messages? •  Messages that failed processing? •  Time to live? •  Retry? •  Ability to check message status?
  • 65. Routing Policies •  Fanout? •  Direct? •  Topic? •  Broadcast? •  Etc?
  • 66. Security Policies •  Require authentication? –  LDAP/AD integration? •  Connection Restrictions? •  Require logging? –  Compliance –  Intrusion Detection
  • 67. Rules of the road my friends… BEST PRACTICES
  • 68. Messages •  Formatting –  JSON or XML are great options. •  Please no serialized PHP objects. •  Message Size –  Only as large as necessary. •  Don’t send a binary object through the queue.
  • 69. Workers •  Dumb as possible! –  Single message type •  Easier to scale. –  Single operation •  Easy to debug and far more flexible.
  • 70. PHP Daemons •  Prevent Memory Leaks –  Detection –  Cycle Workers •  Handle Signals –  Properly shutdown! –  Watch out for OS service kills •  Sleeping is good J
  • 71.
  • 72. Database Worker Server Web Server Message Queue Environment Integration Web Server -> Message Queue Worker Server -> Message Queue
  • 73. Database Web Server Worker Server Worker Server Message Queue Send to 1 Message Queue High Availability Insert multiple message queue servers + multiple worker nodes. Each worker node can connect to as many message queue servers as necessary.
  • 75. Installing Supervisord •  Requires: python-setuptools sudo easy_install supervisor! •  Generate Configuration sudo echo_supervisord_conf > /etc/ supervisord.conf! !
  • 76.
  • 77. These slides will be posted to SlideShare & SpeakerDeck. SpeakerDeck: http://speakerdeck.com/u/mwillbanks Slideshare: http://www.slideshare.net/mwillbanks Twitter: mwillbanks G+: Mike Willbanks IRC (freenode): mwillbanks Blog: http://blog.digitalstruct.com GitHub: https://github.com/mwillbanks QUESTIONS?