SlideShare a Scribd company logo
Scaling Web Apps
                             With RabbitMQ
                              Alvaro Videla - ECUG Con 2010




Thursday, October 21, 2010
About Me

                     •       Development Manager at TheNetCircle.com

                     •       Twitter: @old_sound

                     •       Blog: http://videlalvaro.github.com/

                     •


Thursday, October 21, 2010
Agenda

                     • RabbitMQ
                     • AMQP
                     • Scaling Web Apps
                     • High Availability

Thursday, October 21, 2010
RabbitMQ



Thursday, October 21, 2010
RabbitMQ

                     • Enterprise Messaging System
                     • Open Source MPL
                     • Written in Erlang/OTP
                     • Commercial Support

Thursday, October 21, 2010
Features

                     • Reliable and High Scalable
                     • Easy To install
                     • Easy To Cluster
                     • Runs on: Windows, Solaris, Linux, OSX
                     • AMQP 0.8 - 0.9.1

Thursday, October 21, 2010
Client Libraries

                     • Java
                     • .NET/C#
                     • Erlang
                     • Ruby, Python, PHP, Perl, AS3, Lisp, Scala,
                             Clojure, Haskell



Thursday, October 21, 2010
Docs/Support

                     •       http://www.rabbitmq.com/documentation.html

                     •       http://dev.rabbitmq.com/wiki/

                     •       #rabbitmq at irc.freenode.net

                     •       http://www.rabbitmq.com/email-archive.html




Thursday, October 21, 2010
AMQP



Thursday, October 21, 2010
AMQP
                     • Advanced Message Queuing Protocol
                     • Suits Interoperability
                     • Completely Open Protocol
                     • Binary Protocol
                     • AMQP Model
                     • AMQP Wire Format
Thursday, October 21, 2010
AMQP Model

                     • Exchanges
                     • Message Queues
                     • Bindings
                     • Rules for binding them

Thursday, October 21, 2010
AMQP Wire Protocol


                     • Functional Layer
                     • Transport Layer


Thursday, October 21, 2010
Message Flow




              http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/chap-Messaging_Tutorial-Initial_Concepts.html




Thursday, October 21, 2010
Exchange Types

                     • Fanout
                     • Direct
                     • Topic


Thursday, October 21, 2010
Default Exchanges

                     • amqp.fanout
                     • amqp.direct
                     • amqp.topic


Thursday, October 21, 2010
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/sect-Messaging_Tutorial-Initial_Concepts-
                                                                       Fanout_Exchange.html




Thursday, October 21, 2010
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/sect-Messaging_Tutorial-Initial_Concepts-
                                                                        Direct_Exchange.html




Thursday, October 21, 2010
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/sect-Messaging_Tutorial-Initial_Concepts-
                                                                        Topic_Exchange.html




Thursday, October 21, 2010
Scaling Web Apps



Thursday, October 21, 2010
What means “to Scale”

                     • Scale Up
                     • Scale Down
                     • Scale to New Product Requirements


Thursday, October 21, 2010
Scenario I


                             Batch Processing



Thursday, October 21, 2010
Requirements




Thursday, October 21, 2010
Requirements

                     • Generate XML




Thursday, October 21, 2010
Requirements

                     • Generate XML
                     • Distribution Over a Cluster



Thursday, October 21, 2010
Requirements

                     • Generate XML
                     • Distribution Over a Cluster
                     • Elasticity - Add/Remove new workers


Thursday, October 21, 2010
Design




Thursday, October 21, 2010
Publisher Code
                  $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
                  $channel = $conn->channel();

                  $channel->exchange_declare('video-desc-ex', 'direct', false,
                               true, false);

                  $msg = new AMQPMessage($video_info,
                             array('content_type' => 'text/plain',
                                    'delivery_mode' => 2));

                  $channel->basic_publish($msg, 'video-desc-ex');

                  $channel->close();
                  $conn->close();




Thursday, October 21, 2010
Consumer Code
                  $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
                  $channel = $conn->channel();

                  $channel->exchange_declare('video-desc-ex', 'direct', false,
                               true, false);
                  $channel->queue_declare('video-desc-queue', false, true,
                               false, false);
                  $channel->queue_bind('video-desc-queue', 'video-desc-ex');

                  $channel->basic_consume('video-desc-queue', $consumer_tag,
                               false, false, false, false, $consumer);

                  while(count($channel->callbacks)) {
                      $channel->wait();
                  }



Thursday, October 21, 2010
Scenario II


                             Upload Pictures



Thursday, October 21, 2010
Requirements




Thursday, October 21, 2010
Requirements
                     • Upload Picture




Thursday, October 21, 2010
Requirements
                     • Upload Picture
                     • Reward User




Thursday, October 21, 2010
Requirements
                     • Upload Picture
                     • Reward User
                     • Notify User Friends



Thursday, October 21, 2010
Requirements
                     • Upload Picture
                     • Reward User
                     • Notify User Friends
                     • Resize Picture


Thursday, October 21, 2010
Design




Thursday, October 21, 2010
Publisher Code
                  $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
                  $channel = $conn->channel();

                  $channel->exchange_declare('upload-pictures', 'fanout', false,
                  true, false);

                  $metadata = json_encode(array(
                    'image_id' => $image_id,
                    'user_id' => $user_id,
                    ‘image_path' => $image_path));

                  $msg = new AMQPMessage($metadata, array('content_type' =>
                  'application/json',   'delivery_mode' => 2));

                  $channel->basic_publish($msg, 'upload-pictures');

                  $channel->close();
                  $conn->close();



Thursday, October 21, 2010
Consumer Code
                  $channel->exchange_declare('upload-pictures', 'fanout',
                              false, true, false);

                  $channel->queue_declare('resize-picture', false, true,
                              false, false);

                  $channel->queue_bind('resize-picture', 'upload-pictures');

                  $channel->basic_consume('resize-picture', $consumer_tag,
                              false, false, false, false, $consumer);

                  while(count($channel->callbacks)) {
                    $channel->wait();
                  }




Thursday, October 21, 2010
Consumer Code
                  $consumer = function($msg){
                    $meta = json_decode($msg->body, true);
                  	
                    resize_picture($meta['image_id'], $meta['image_path']);
                  	
                    $msg->delivery_info['channel']->
                      basic_ack($msg->delivery_info['delivery_tag']);

                       if($msg->body == 'quit'){
                         $msg->delivery_info['channel']->
                           basic_cancel($msg->delivery_info['consumer_tag']);
                       }
                  };




Thursday, October 21, 2010
Scenario III


                             Distributed Logging



Thursday, October 21, 2010
Requirements




Thursday, October 21, 2010
Requirements
                     • Several Web Servers




Thursday, October 21, 2010
Requirements
                     • Several Web Servers
                     • Logic Separated by Module/Action




Thursday, October 21, 2010
Requirements
                     • Several Web Servers
                     • Logic Separated by Module/Action
                     • Several Log Levels:



Thursday, October 21, 2010
Requirements
                     • Several Web Servers
                     • Logic Separated by Module/Action
                     • Several Log Levels:
                      • Info
                      • Warning
                      • Error
Thursday, October 21, 2010
Design




Thursday, October 21, 2010
Publisher Code
                  $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
                  $channel = $conn->channel();

                  $channel->exchange_declare('logs', 'topic', false, true, false);

                  $msg = new AMQPMessage('some log message',
                                  array('content_type' => 'text/plain'));

                  $channel->basic_publish($msg, 'logs',
                             server1.user.profile.info');

                  $channel->close();
                  $conn->close();




Thursday, October 21, 2010
Consumer Code

                  $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
                  $channel = $conn->channel();

                  $channel->exchange_declare('logs', 'topic', false,
                                true, false);
                  $channel->queue_declare('server1-logs', false, true,
                                false, false);
                  $channel->queue_bind('server1-logs', 'logs', 'server1.#');




Thursday, October 21, 2010
Consumer Code

                  $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
                  $channel = $conn->channel();

                  $channel->exchange_declare('logs', 'topic', false,
                                true, false);
                  $channel->queue_declare('error-logs', false, true,
                                false, false);
                  $channel->queue_bind('error-logs', 'logs', '#.error');




Thursday, October 21, 2010
One Setup for HA




Thursday, October 21, 2010
Questions?



Thursday, October 21, 2010
Thanks!
                                      Alvaro Videla
                                http://twitter.com/old_sound
                                http://github.com/videlalvaro
                                    http://github.com/tnc
                             http://www.slideshare.net/old_sound




Thursday, October 21, 2010

More Related Content

Similar to Scaling webappswithrabbitmq

Mobile, Media & Touch
Mobile, Media & TouchMobile, Media & Touch
Mobile, Media & TouchTim Wright
 
Cocoa for Scientists
Cocoa for ScientistsCocoa for Scientists
Cocoa for Scientists
Francis Rowland
 
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP GroupDeveloping Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Groupminddog
 
NodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time WebNodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time WebJakub Nesetril
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
John Ballinger
 
ScaleCamp 2009 - Last.fm vs Xbox
ScaleCamp 2009 - Last.fm vs XboxScaleCamp 2009 - Last.fm vs Xbox
ScaleCamp 2009 - Last.fm vs Xbox
davidsingleton
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
Mars - ESUG 2010
Mars - ESUG 2010Mars - ESUG 2010
Mars - ESUG 2010
Esteban Lorenzano
 
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume LaforgeGroovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
Integrating php withrabbitmq_zendcon
Integrating php withrabbitmq_zendconIntegrating php withrabbitmq_zendcon
Integrating php withrabbitmq_zendcon
Alvaro Videla
 
Concurrency
ConcurrencyConcurrency
Concurrencyehuard
 
Advanced Data Widgets and Server Integration
Advanced Data Widgets and Server IntegrationAdvanced Data Widgets and Server Integration
Advanced Data Widgets and Server Integration
Sencha
 
Laying Pipe with Transmogrifier
Laying Pipe with TransmogrifierLaying Pipe with Transmogrifier
Laying Pipe with Transmogrifier
Clayton Parker
 
Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019
Lorenzo Miniero
 
Html5 Apps
Html5 AppsHtml5 Apps
Html5 Apps
Nikolai Onken
 
The Tech Side of Project Argo
The Tech Side of Project ArgoThe Tech Side of Project Argo
The Tech Side of Project ArgoWesley Lindamood
 
Best Practices in Ext GWT
Best Practices in Ext GWTBest Practices in Ext GWT
Best Practices in Ext GWT
Sencha
 
Agile Enterprise Devops and Cloud - Interop 2010 NYC
Agile Enterprise Devops and Cloud - Interop 2010 NYCAgile Enterprise Devops and Cloud - Interop 2010 NYC
Agile Enterprise Devops and Cloud - Interop 2010 NYCChef Software, Inc.
 
GWT Plus HTML 5
GWT Plus HTML 5GWT Plus HTML 5
GWT Plus HTML 5
David Chandler
 

Similar to Scaling webappswithrabbitmq (20)

Mobile, Media & Touch
Mobile, Media & TouchMobile, Media & Touch
Mobile, Media & Touch
 
Cocoa for Scientists
Cocoa for ScientistsCocoa for Scientists
Cocoa for Scientists
 
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP GroupDeveloping Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
Developing Plugins on OpenVBX at Greater San Francisco Bay Area LAMP Group
 
NodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time WebNodeJS, CoffeeScript & Real-time Web
NodeJS, CoffeeScript & Real-time Web
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
 
ScaleCamp 2009 - Last.fm vs Xbox
ScaleCamp 2009 - Last.fm vs XboxScaleCamp 2009 - Last.fm vs Xbox
ScaleCamp 2009 - Last.fm vs Xbox
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
 
Developing Distributed Semantic Systems
Developing Distributed Semantic SystemsDeveloping Distributed Semantic Systems
Developing Distributed Semantic Systems
 
Mars - ESUG 2010
Mars - ESUG 2010Mars - ESUG 2010
Mars - ESUG 2010
 
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume LaforgeGroovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
Groovy to infinity and beyond - SpringOne2GX - 2010 - Guillaume Laforge
 
Integrating php withrabbitmq_zendcon
Integrating php withrabbitmq_zendconIntegrating php withrabbitmq_zendcon
Integrating php withrabbitmq_zendcon
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Advanced Data Widgets and Server Integration
Advanced Data Widgets and Server IntegrationAdvanced Data Widgets and Server Integration
Advanced Data Widgets and Server Integration
 
Laying Pipe with Transmogrifier
Laying Pipe with TransmogrifierLaying Pipe with Transmogrifier
Laying Pipe with Transmogrifier
 
Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019Multistream in Janus @ CommCon 2019
Multistream in Janus @ CommCon 2019
 
Html5 Apps
Html5 AppsHtml5 Apps
Html5 Apps
 
The Tech Side of Project Argo
The Tech Side of Project ArgoThe Tech Side of Project Argo
The Tech Side of Project Argo
 
Best Practices in Ext GWT
Best Practices in Ext GWTBest Practices in Ext GWT
Best Practices in Ext GWT
 
Agile Enterprise Devops and Cloud - Interop 2010 NYC
Agile Enterprise Devops and Cloud - Interop 2010 NYCAgile Enterprise Devops and Cloud - Interop 2010 NYC
Agile Enterprise Devops and Cloud - Interop 2010 NYC
 
GWT Plus HTML 5
GWT Plus HTML 5GWT Plus HTML 5
GWT Plus HTML 5
 

More from Alvaro Videla

Improvements in RabbitMQ
Improvements in RabbitMQImprovements in RabbitMQ
Improvements in RabbitMQ
Alvaro Videla
 
Data Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring IntegrationData Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring Integration
Alvaro Videla
 
RabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfRabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft Conf
Alvaro Videla
 
Scaling applications with RabbitMQ at SunshinePHP
Scaling applications with RabbitMQ   at SunshinePHPScaling applications with RabbitMQ   at SunshinePHP
Scaling applications with RabbitMQ at SunshinePHP
Alvaro Videla
 
Unit Test + Functional Programming = Love
Unit Test + Functional Programming = LoveUnit Test + Functional Programming = Love
Unit Test + Functional Programming = Love
Alvaro Videla
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data Ingestion
Alvaro Videla
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
Alvaro Videla
 
Introduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal LabsIntroduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal Labs
Alvaro Videla
 
Writing testable code
Writing testable codeWriting testable code
Writing testable code
Alvaro Videla
 
RabbitMQ Hands On
RabbitMQ Hands OnRabbitMQ Hands On
RabbitMQ Hands On
Alvaro Videla
 
Rabbitmq Boot System
Rabbitmq Boot SystemRabbitmq Boot System
Rabbitmq Boot SystemAlvaro Videla
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry Bootcamp
Alvaro Videla
 
Cloud Messaging With Cloud Foundry
Cloud Messaging With Cloud FoundryCloud Messaging With Cloud Foundry
Cloud Messaging With Cloud Foundry
Alvaro Videla
 
Vertx
VertxVertx
Código Fácil De Testear
Código Fácil De TestearCódigo Fácil De Testear
Código Fácil De Testear
Alvaro Videla
 
Desacoplando aplicaciones
Desacoplando aplicacionesDesacoplando aplicaciones
Desacoplando aplicaciones
Alvaro Videla
 
Theres a rabbit on my symfony
Theres a rabbit on my symfonyTheres a rabbit on my symfony
Theres a rabbit on my symfony
Alvaro Videla
 
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory LiteScaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
Alvaro Videla
 

More from Alvaro Videla (20)

Improvements in RabbitMQ
Improvements in RabbitMQImprovements in RabbitMQ
Improvements in RabbitMQ
 
Data Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring IntegrationData Migration at Scale with RabbitMQ and Spring Integration
Data Migration at Scale with RabbitMQ and Spring Integration
 
RabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft ConfRabbitMQ Data Ingestion at Craft Conf
RabbitMQ Data Ingestion at Craft Conf
 
Scaling applications with RabbitMQ at SunshinePHP
Scaling applications with RabbitMQ   at SunshinePHPScaling applications with RabbitMQ   at SunshinePHP
Scaling applications with RabbitMQ at SunshinePHP
 
Unit Test + Functional Programming = Love
Unit Test + Functional Programming = LoveUnit Test + Functional Programming = Love
Unit Test + Functional Programming = Love
 
RabbitMQ Data Ingestion
RabbitMQ Data IngestionRabbitMQ Data Ingestion
RabbitMQ Data Ingestion
 
Dissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal ArchitectureDissecting the rabbit: RabbitMQ Internal Architecture
Dissecting the rabbit: RabbitMQ Internal Architecture
 
Introduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal LabsIntroduction to RabbitMQ | Meetup at Pivotal Labs
Introduction to RabbitMQ | Meetup at Pivotal Labs
 
Writing testable code
Writing testable codeWriting testable code
Writing testable code
 
RabbitMQ Hands On
RabbitMQ Hands OnRabbitMQ Hands On
RabbitMQ Hands On
 
Rabbitmq Boot System
Rabbitmq Boot SystemRabbitmq Boot System
Rabbitmq Boot System
 
Cloud Foundry Bootcamp
Cloud Foundry BootcampCloud Foundry Bootcamp
Cloud Foundry Bootcamp
 
Cloud Messaging With Cloud Foundry
Cloud Messaging With Cloud FoundryCloud Messaging With Cloud Foundry
Cloud Messaging With Cloud Foundry
 
Taming the rabbit
Taming the rabbitTaming the rabbit
Taming the rabbit
 
Vertx
VertxVertx
Vertx
 
Código Fácil De Testear
Código Fácil De TestearCódigo Fácil De Testear
Código Fácil De Testear
 
Desacoplando aplicaciones
Desacoplando aplicacionesDesacoplando aplicaciones
Desacoplando aplicaciones
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patterns
 
Theres a rabbit on my symfony
Theres a rabbit on my symfonyTheres a rabbit on my symfony
Theres a rabbit on my symfony
 
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory LiteScaling Web Apps With RabbitMQ - Erlang Factory Lite
Scaling Web Apps With RabbitMQ - Erlang Factory Lite
 

Recently uploaded

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Scaling webappswithrabbitmq

  • 1. Scaling Web Apps With RabbitMQ Alvaro Videla - ECUG Con 2010 Thursday, October 21, 2010
  • 2. About Me • Development Manager at TheNetCircle.com • Twitter: @old_sound • Blog: http://videlalvaro.github.com/ • Thursday, October 21, 2010
  • 3. Agenda • RabbitMQ • AMQP • Scaling Web Apps • High Availability Thursday, October 21, 2010
  • 5. RabbitMQ • Enterprise Messaging System • Open Source MPL • Written in Erlang/OTP • Commercial Support Thursday, October 21, 2010
  • 6. Features • Reliable and High Scalable • Easy To install • Easy To Cluster • Runs on: Windows, Solaris, Linux, OSX • AMQP 0.8 - 0.9.1 Thursday, October 21, 2010
  • 7. Client Libraries • Java • .NET/C# • Erlang • Ruby, Python, PHP, Perl, AS3, Lisp, Scala, Clojure, Haskell Thursday, October 21, 2010
  • 8. Docs/Support • http://www.rabbitmq.com/documentation.html • http://dev.rabbitmq.com/wiki/ • #rabbitmq at irc.freenode.net • http://www.rabbitmq.com/email-archive.html Thursday, October 21, 2010
  • 10. AMQP • Advanced Message Queuing Protocol • Suits Interoperability • Completely Open Protocol • Binary Protocol • AMQP Model • AMQP Wire Format Thursday, October 21, 2010
  • 11. AMQP Model • Exchanges • Message Queues • Bindings • Rules for binding them Thursday, October 21, 2010
  • 12. AMQP Wire Protocol • Functional Layer • Transport Layer Thursday, October 21, 2010
  • 13. Message Flow http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Messaging_Tutorial/chap-Messaging_Tutorial-Initial_Concepts.html Thursday, October 21, 2010
  • 14. Exchange Types • Fanout • Direct • Topic Thursday, October 21, 2010
  • 15. Default Exchanges • amqp.fanout • amqp.direct • amqp.topic Thursday, October 21, 2010
  • 19. Scaling Web Apps Thursday, October 21, 2010
  • 20. What means “to Scale” • Scale Up • Scale Down • Scale to New Product Requirements Thursday, October 21, 2010
  • 21. Scenario I Batch Processing Thursday, October 21, 2010
  • 23. Requirements • Generate XML Thursday, October 21, 2010
  • 24. Requirements • Generate XML • Distribution Over a Cluster Thursday, October 21, 2010
  • 25. Requirements • Generate XML • Distribution Over a Cluster • Elasticity - Add/Remove new workers Thursday, October 21, 2010
  • 27. Publisher Code $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('video-desc-ex', 'direct', false, true, false); $msg = new AMQPMessage($video_info, array('content_type' => 'text/plain', 'delivery_mode' => 2)); $channel->basic_publish($msg, 'video-desc-ex'); $channel->close(); $conn->close(); Thursday, October 21, 2010
  • 28. Consumer Code $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('video-desc-ex', 'direct', false, true, false); $channel->queue_declare('video-desc-queue', false, true, false, false); $channel->queue_bind('video-desc-queue', 'video-desc-ex'); $channel->basic_consume('video-desc-queue', $consumer_tag, false, false, false, false, $consumer); while(count($channel->callbacks)) { $channel->wait(); } Thursday, October 21, 2010
  • 29. Scenario II Upload Pictures Thursday, October 21, 2010
  • 31. Requirements • Upload Picture Thursday, October 21, 2010
  • 32. Requirements • Upload Picture • Reward User Thursday, October 21, 2010
  • 33. Requirements • Upload Picture • Reward User • Notify User Friends Thursday, October 21, 2010
  • 34. Requirements • Upload Picture • Reward User • Notify User Friends • Resize Picture Thursday, October 21, 2010
  • 36. Publisher Code $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('upload-pictures', 'fanout', false, true, false); $metadata = json_encode(array( 'image_id' => $image_id, 'user_id' => $user_id, ‘image_path' => $image_path)); $msg = new AMQPMessage($metadata, array('content_type' => 'application/json', 'delivery_mode' => 2)); $channel->basic_publish($msg, 'upload-pictures'); $channel->close(); $conn->close(); Thursday, October 21, 2010
  • 37. Consumer Code $channel->exchange_declare('upload-pictures', 'fanout', false, true, false); $channel->queue_declare('resize-picture', false, true, false, false); $channel->queue_bind('resize-picture', 'upload-pictures'); $channel->basic_consume('resize-picture', $consumer_tag, false, false, false, false, $consumer); while(count($channel->callbacks)) { $channel->wait(); } Thursday, October 21, 2010
  • 38. Consumer Code $consumer = function($msg){ $meta = json_decode($msg->body, true); resize_picture($meta['image_id'], $meta['image_path']); $msg->delivery_info['channel']-> basic_ack($msg->delivery_info['delivery_tag']); if($msg->body == 'quit'){ $msg->delivery_info['channel']-> basic_cancel($msg->delivery_info['consumer_tag']); } }; Thursday, October 21, 2010
  • 39. Scenario III Distributed Logging Thursday, October 21, 2010
  • 41. Requirements • Several Web Servers Thursday, October 21, 2010
  • 42. Requirements • Several Web Servers • Logic Separated by Module/Action Thursday, October 21, 2010
  • 43. Requirements • Several Web Servers • Logic Separated by Module/Action • Several Log Levels: Thursday, October 21, 2010
  • 44. Requirements • Several Web Servers • Logic Separated by Module/Action • Several Log Levels: • Info • Warning • Error Thursday, October 21, 2010
  • 46. Publisher Code $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('logs', 'topic', false, true, false); $msg = new AMQPMessage('some log message', array('content_type' => 'text/plain')); $channel->basic_publish($msg, 'logs', server1.user.profile.info'); $channel->close(); $conn->close(); Thursday, October 21, 2010
  • 47. Consumer Code $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('logs', 'topic', false, true, false); $channel->queue_declare('server1-logs', false, true, false, false); $channel->queue_bind('server1-logs', 'logs', 'server1.#'); Thursday, October 21, 2010
  • 48. Consumer Code $conn = new AMQPConnection(HOST, PORT, USER, PASS, VHOST); $channel = $conn->channel(); $channel->exchange_declare('logs', 'topic', false, true, false); $channel->queue_declare('error-logs', false, true, false, false); $channel->queue_bind('error-logs', 'logs', '#.error'); Thursday, October 21, 2010
  • 49. One Setup for HA Thursday, October 21, 2010
  • 51. Thanks! Alvaro Videla http://twitter.com/old_sound http://github.com/videlalvaro http://github.com/tnc http://www.slideshare.net/old_sound Thursday, October 21, 2010