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

Queue it! What job queues can do for you!

Ole Michaelis
February 26, 2014

Queue it! What job queues can do for you!

Gave this talk at Code PaLOUsa 2014 in Louisville, KY on February 26th, 2014
Follow me on Twitter: @CodeStars

In times of node.js and asynchronous IO, our other beloved languages can sometimes feel like the wrong tool. But looking at it like this would be too narrow-minded - like sending a registration confirmation mail, you can do it in the “register” user request, while the user is waiting for the response. But what if the mail server isn’t reachable? You’ll have to wait for the timeout. This will make your common user pretty angry.

There are tons of different job queues around. I’d like to talk about a few different queues like Gearman and beanstalkd - what’s the differences and what are the perfect match use-cases. I also have some hints on what’s a good implementation detail ready.

Ole Michaelis

February 26, 2014
Tweet

More Decks by Ole Michaelis

Other Decks in Technology

Transcript

  1. Queue it! What job queues can do for you! Codepalousa

    2014 - February 26th 2014 - Louisville, KY, USA
  2. Webserver External Service H A R D C O R

    E ! W O R K I N G ! A C T I O N User
  3. Webserver External Service H A R D C O R

    E ! W O R K I N G ! A C T I O N User
  4. Webserver External Service H A R D C O R

    E ! W O R K I N G ! A C T I O N User
  5. Webserver External Service H A R D C O R

    E ! W O R K I N G ! A C T I O N W A I T I N G User
  6. Webserver External Service User H A R D C O

    R E ! W O R K I N G ! A C T I O N Queue / Worker
  7. Webserver External Service User H A R D C O

    R E ! W O R K I N G ! A C T I O N Queue / Worker
  8. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline
  9. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline Consumer D
  10. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline Consumer D pubsub
  11. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline Consumer D pubsub Queue 4
  12. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline Consumer D pubsub Queue 4 Consumer E
  13. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline Consumer D pubsub Queue 4 Consumer E
  14. Producer Broker Consumer A Queue 1 Queue 2 Consumer B

    Queue 3 Consumer C fanout pipeline Consumer D pubsub Queue 4 Consumer E request - reply
  15. 232 20 216 priorities sending mails gen. PM report process

    data cleanup db recover data payment
  16. 232 20 216 priorities sending mails gen. PM report process

    data cleanup db recover data payment
  17. 12:00 timing - job delay sending batch #1 14:00 16:00

    sending batch #2 sending batch #3
  18. 12:00 timing - job delay sending batch #1 14:00 16:00

    sending batch #2 sending batch #3 sending batch #4
  19. delayed ready reserved *poof* put with delay put release with

    delay reserve delete release (time passes)
  20. delayed ready reserved buried *poof* put with delay put release

    with delay reserve delete bury release (time passes)
  21. delayed ready reserved buried *poof* put with delay put release

    with delay reserve delete bury release (time passes) kick
  22. delayed ready reserved buried *poof* *poof* put with delay put

    release with delay reserve delete delete bury release (time passes) kick
  23. continuous reading http://blog.thecodepath.com/2013/01/06/ asynchronous-processing-in-web- applications-part-2-developers-need-to- understand-message-queues/ Mathias Meyer - Message

    Queues - Railsberry 2013 https://vimeo.com/ 68698333 https://github.com/kr/beanstalkd https://github.com/dp-opensource/ pheanstalk https://en.wikipedia.org/wiki/ Message_queue https://github.com/denniskuczynski/ beanstalkd_view https://github.com/twitter/kestrel https://github.com/kr/beanstalkd/blob/ master/doc/protocol.txt I want to thank my company Jimdo, my girlfriend and all my coworkers for supporting me!
  24. Products / Name dropping activemq rabbitmq Ømq (zeromq) zookeeper pubnub

    ironmq sqs sidekiq resque kue gearman beanstalkd kestrel kafka delayed_job celery qless mqseries nsq jms qpid hornetq swiftmq mqseries stormmq dotnetmq snakemq dropr
  25. A N D A LWAY S R E M E

    M B E R : S AY S 〿