SlideShare ist ein Scribd-Unternehmen logo
1 von 77
Downloaden Sie, um offline zu lesen
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?

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Kürzlich hochgeladen (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

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?