Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Railsconf 2009 Rabbitmq

Railsconf 2009 Rabbitmq

hungryblank

April 24, 2012
Tweet

More Decks by hungryblank

Other Decks in Programming

Transcript

  1. Map Reduce "Map" step the master node takes the input,

    chops it up into smaller sub-problems, and distributes those to worker nodes. (Wikipedia)
  2. What about queuing? • the master node takes the input,

    chops it up into smaller sub-problems, and publishes them in a queue • workers independently consume the content of the queue
  3. Here comes • RabbitMQ is an implementation of AMQP, the

    emerging standard for high performance enterprise messaging • It’s opensource • Can be used to manage queues • Written in Erlang
  4. Erlang? • Erlang is a general-purpose concurrent programming language designed

    by Ericsson • distributed • fault tolerant • soft real time • high availability
  5. Get for free • Decoupling master/worker • Workers take care

    of feeding themselves • Flexible number of workers
  6. Get for free • RabbitMQ can be clustered • Support

    of message acknowledgement • Queues can be persisted on disk (at a price) • low latency
  7. Queue • Is an actual entity • has a name

    • can be inspected and managed
  8. EventMachine • Non blocking IO and lightweight concurrency • eliminate

    the complexities of high- performance threaded network programming Is an implementation of Reactor Pattern
  9. EventMachine amqp gem is built on EventMachine => you’re in

    a context where you can leverage concurrent programming
  10. EM - Deferrables “The Deferrable pattern allows you to specify

    any number of Ruby code blocks that will be executed at some future time when the status of the Deferrable object changes “
  11. Achieved so far • Easy distribution of tasks • Architecture

    that supports arbitrary number of workers (and masters) • Concurrency within the single worker
  12. Not only queues then • communication across hosts, heterogeneous systems

    • low latency • clustering Use messages distribution to build the nervous system of your app
  13. Where to start? crontab -l 5 * * * *

    bin/do_the_quick_thing.rb 0 2 * * * bin/do_the_scary_thing.rb
  14. Cron • Simple • Reliable • No maintenance • Status

    is not explicit • Locking? • Shot and forget
  15. Queue • Distributed easily • Reliable • Can be inspected

    • Add/decrease workers •Makes you think! • Adds more complexity
  16. On github - Projects • eventmachine/eventmachine • tmm1/amqp • macournoyer/thin

    • famoseagle/carrot • celldee/bunny • ezmobius/nanite