16
Message Queues A basic overview

Message Queues a basic overview

Embed Size (px)

DESCRIPTION

Talk at PHP Developers meet up #12 held on 23-Aug-2014. - the video of the talk and more description : http://bit.ly/1tLVbJV

Citation preview

Page 1: Message Queues a basic overview

Message QueuesA basic overview

Page 2: Message Queues a basic overview

Geshan ManandharQuality and Maintenance Lead, Namshi.com

@geshan

geshan.com.np

Page 3: Message Queues a basic overview

IndexWhat is Message Queue(MQ)MQ basics - AMQPBenefitsRabbit MQOur setup/stackWhen to use it /Practical UsecaseLogging and monitoringConclusion

Page 4: Message Queues a basic overview

What is Message Queue"message queues and mailboxes are software-engineeringcomponents used for inter-process communication (IPC), or forinter-thread communication within the same process. They use aqueue for messaging – the passing of control or of content." -WikipediaMessage queue is a software components that allow producers toproduce message to a queue managed by a message broker, thesemessage are asynchronously consumed by consumers.

Page 5: Message Queues a basic overview

Message Queue BasicsProtocols : Advanced Message Queueing Protocol(AMQP) andStreaming Text Oriented Messaging Protocol(STOMP)Types of Queue: Direct, Topic and FanoutProducer/PublisherMessage Broker - Queue ExchangeQueueConsumer

Page 6: Message Queues a basic overview

Benefits of MQDecouplingScalabilityReliabilityFanout - Same message to multiple queues (Pub/Sub)

Page 7: Message Queues a basic overview

Rabbit MQ

Page 8: Message Queues a basic overview

Rabbit MQ - featuresRobust messaging for applicationsEasy to useRuns on all major operating systemsSupports a huge number of developer platformsOpen source and commercially supported

Page 9: Message Queues a basic overview

Our Software stack/servicesrelating to with Rabbit MQ

Symfony 2 with old sound rabbit mq bundle and MonologRabbit Mq on http://www.cloudamqp.com/Service Oriented Architecture (SOA) with 3rd party APIintegrations

Page 10: Message Queues a basic overview

When to use message queuesSome practical use cases

Backend -> Frontend sync (db to NOSQL/Memcache)Communication between multiple internal systems (without API)Asynchronous 3rd party API callsNotifications like email and smsHandling large request asynchronouslyProcessing intensive tasks- like image resize

Page 11: Message Queues a basic overview

Logging and monitoring isvital

Only access and error logs from web server and database are surelynot enoughLogs are first class citizen, adopt active logging from applicationlevel.(Monolog)Use dedicated log management system like GrayLog 2Monitor application activity in real-time with services likeNewRelicLog optimally and verbose enough to give enough informationabout the context.

Page 12: Message Queues a basic overview

Conclusion/RecapCommunication between two systems can be done even withoutAPIsLanguage agnostic implementation is enable by using messagequeuesMessage queues could be that answer you were looking for, tocommunicate between different systemsFor scalability, decoupling and reliability utilize message queuesYou could potentially scale to 1 million message per second :PivotalLogging and monitoring are inevitable when doing asynchronousprocessing

Page 13: Message Queues a basic overview
Page 14: Message Queues a basic overview

Questions???

Page 15: Message Queues a basic overview

Creditshttp://keyholesoftware.com/2013/05/13/messaging-with-rabbitmq/https://www.flickr.com/photos/i8ipod/9028050858https://www.flickr.com/photos/oberazzi/318947873/

Page 16: Message Queues a basic overview

Some programming mantras to remember.