Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DRb vs RabbitMQ Showdown

DRb vs RabbitMQ Showdown

RubyConf 2012 Talk

5f557a41fc286ddcc1ed6b869c6d04c3?s=128

Davy Stevenson

November 02, 2012
Tweet

Transcript

  1. DRb vs RabbitMQ Showdown or When to Upgrade Components RubyConf

    2012
  2. About Me Davy Stevenson / @davystevenson Software Engineer at Elemental

    Technologies in Portland, OR
  3. What

  4. None
  5. None
  6. None
  7. None
  8. Elemental and Ruby Best in class user interface Fast paced

    development Happy developers
  9. None
  10. The Beginning Initial requirements drive decisions ... ie. no crystal

    ball
  11. The Beginning New Features Easy to re-use tech Good match?

    Business decision
  12. DRb Easy, fast, reliable Inter-process communication

  13. r e q u i r e ' d r

    b / d r b ' c l a s s S e r v e r d e f g e t _ d a t a [ 1 , 2 , 3 ] e n d d e f s e n d _ d a t a ( d a t a ) p u t s d a t a e n d e n d D R b . s t a r t _ s e r v i c e ( ' d r u b y : / / l o c a l h o s t : 1 2 3 4 5 ' , S e r v e r . n e w ) D R b . t h r e a d . j o i n % i r b r e q u i r e ' d r b / d r b ' s e r v e r = D R b O b j e c t . n e w _ w i t h _ u r i ( ' d r u b y : / / l o c a l h o s t : 1 2 3 4 5 ' ) s e r v e r . g e t _ d a t a # = > [ 1 , 2 , 3 ] s e r v e r . s e n d _ d a t a ( " H e l l o " ) # = > n i l
  14. Send data / messages Request data Pass Ruby Objects Point-to-point

    communication
  15. How We Use DRb

  16. Request data Rails <= Service Daemon Good Fit

  17. Send commands Rails => Service Daemon OK Fit

  18. None
  19. Inter‐service communication Service Daemon <=> Service Daemon NOT A FIT

  20. The Problem Technology no longer meets your needs.

  21. Determine Scope Define the problem Customer needs What is success?

  22. Determine Scope Speed is not a primary concern Reliability, Stability,

    Resiliency
  23. Determine Scope Limit focus Replace single component Incremental development

  24. Why Message Queue Reinventing the wheel

  25. Why Message Queue Decouple producer from consumer

  26. Why Message Queue Reduce responsibility

  27. RabbitMQ Asynchronous message broker implementing AMQP HA clustering available

  28. AMQP Advanced Message Queue Protocol Receive, route, queue and deliver

    messages
  29. Ruby AMQP Gem Uses EventMachine Communicate with RabbitMQ

  30. r e q u i r e ' a m

    q p ' E M . r u n d o c o n n e c t i o n = A M Q P . c o n n e c t ( : h o s t = > ' l o c a l h o s t ' ) c h a n n e l = A M Q P : : C h a n n e l . n e w ( c o n n e c t i o n ) q u e u e = c h a n n e l . q u e u e ( " e x a m p l e " , : a u t o _ d e l e t e = > t r u e ) e x c h a n g e = c h a n n e l . d i r e c t ( " " ) E M . a d d _ p e r i o d i c _ t i m e r ( 5 . 0 ) d o e x c h a n g e . p u b l i s h " # { T i m e . n o w } " , : r o u t i n g _ k e y = > q u e u e . n a m e e n d q u e u e . s u b s c r i b e d o | p a y l o a d | p u t s " R e c e i v e d t h e t i m e : # { p a y l o a d } " e n d e n d
  31. Scope Defined

  32. Reliability Durable queues Message order ensured

  33. Stability Decoupling

  34. Resiliency High-availability

  35. Still use DRb Simplicity Request data

  36. Implementation Multiple Producers, Single Consumer Two classes of data: Durable

    state changes Transient status data
  37. None
  38. Results Performance is impressive Decoupled communication Included in next release

    Positioned for product growth
  39. Q&A