Date post: | 13-Jan-2017 |
Category: |
News & Politics |
Upload: | paolo-negri |
View: | 8,192 times |
Download: | 1 times |
%w(map reduce).first A Tale About Rabbits,
Latency and Slim Crontabs
Paolo Negri
thanks to: www.autoscout24.de
Map Reduce "Map" step
the master node takes the input, chops it up into smaller sub-problems, and distributes
those to worker nodes.(Wikipedia)
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
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
Erlang?
• Erlang is a general-purpose concurrent programming language designed by Ericsson
• distributed
• fault tolerant
• soft real time
• high availability
Get for free
• Decoupling master/worker
• Workers take care of feeding themselves
• Flexible number of workers
Get for free
• RabbitMQ can be clustered
• Support of message acknowledgement
• Queues can be persisted on disk(at a price)
• low latency
EventMachine
• Non blocking IO and lightweight concurrency
• eliminate the complexities of high-performance threaded network programming
Is an implementation of Reactor Pattern
EventMachine
amqp gem is built on EventMachine => you’re in a
context where you can leverage concurrent
programming
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 “
Achieved so far
• Easy distribution of tasks
• Architecture that supports arbitrary number of workers (and masters)
• Concurrency within the single worker
Not only queues then
• communication across hosts, heterogeneous systems
• low latency
• clustering
Use messages distribution to build the nervous system of your app
Queue
• Distributed easily
• Reliable
• Can be inspected
• Add/decrease workers
•Makes you think!• Adds more complexity
On github - Projects
• eventmachine/eventmachine
• tmm1/amqp
• macournoyer/thin
• famoseagle/carrot
• celldee/bunny
• ezmobius/nanite