0.02
No commit activity in last 3 years
No release in over 3 years
Algorithms and Tools for Distributed Computing in Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Politics¶ ↑

Politics is a Ruby library providing utilities and algorithms for solving common distributed computing problems. Distributed Computing and Politics have a number of things in common: 1) they can be beautiful in theory but get really ugly in reality; 2) after working with either for a few weeks/months/years (depending on your moral flexibility) you’ll find yourself intellectually devoid, a hollow shell of a man/woman/cybernetic killing machine.

So the name is to be taken tongue in cheek. Onto the real details.

Common Problems in Distributed Computing¶ ↑

Ruby services are often deployed as a cloud of many processes across several machines, for fault tolerance. This introduces the problem of coordination between those processes. Specifically, how do you keep those processes from stepping on each other’s electronic toes? There are several answers:

  1. Break the processing into N ‘buckets’. Have an individual process fetch a bucket, work on it, and ask for another. This is a very scalable solution as it allows N workers to work on different parts of the same task concurrently. See the StaticQueueWorker mixin.

  2. Elect a leader for a short period of time. The leader is the process which performs the actual processing. After a length of time, a new leader is elected from the group. This is fault tolerant but not as scalable, as only one process is performing the task at a given point in time. See the TokenWorker mixin.

Installation¶ ↑

sudo gem install mperham-politics -s http://gems.github.com

Dependencies¶ ↑

StaticQueueWorker mixin

  • memcached - the mechanism to elect a leader amongst a set of peers.

  • DRb - the mechanism to communicate between peers.

  • mDNS - the mechanism to discover peers.

TokenWorker mixin

  • memcached - the mechanism to elect a leader amongst a set of peers.

Author¶ ↑

Name

Mike Perham

Email

mperham@gmail.com

Twitter

twitter.com/mperham

Homepage

mikeperham.com/

This software is free for you to use as you’d like. If you find it useful, please consider giving me a recommendation at Working with Rails.