auser / stoplight forked from jashmenn/stoplight

fully distributed mutex server in erlang based on the sigma algorithm

This URL has Read+Write access

name age message
file .gitignore Wed Aug 19 10:11:01 -0700 2009 added bootfiles to gitignore [jashmenn]
file .gitmodules Tue Aug 18 13:50:12 -0700 2009 added gen_server_mock as a submodule [jashmenn]
file Emakefile Tue Aug 18 14:00:55 -0700 2009 corrected case on Emakefile [jashmenn]
file INSTALL Mon Aug 17 11:14:30 -0700 2009 added INSTALL [jashmenn]
file README.mkd Wed Aug 19 13:29:18 -0700 2009 updated readme to reflect being able to specify... [jashmenn]
file Rakefile Tue Aug 18 15:42:58 -0700 2009 updated .app to properly show modules [jashmenn]
directory conf/ Wed Aug 19 12:17:11 -0700 2009 updated readme with new running instructions [jashmenn]
directory deps/ Wed Aug 19 13:20:43 -0700 2009 updated gen_cluster, updated stoplight_misc to ... [jashmenn]
directory doc/ Wed Aug 19 12:18:13 -0700 2009 added todo [jashmenn]
directory ebin/ Tue Aug 18 15:42:58 -0700 2009 updated .app to properly show modules [jashmenn]
directory include/ Tue Aug 18 11:43:09 -0700 2009 started adding request ttl [jashmenn]
directory priv/ Fri Jul 31 10:30:10 -0700 2009 started work on starting and joining cluster of... [jashmenn]
directory scripts/ Wed Aug 19 10:10:35 -0700 2009 updated client to search for servers [jashmenn]
directory src/ Wed Aug 19 13:20:43 -0700 2009 updated gen_cluster, updated stoplight_misc to ... [jashmenn]
directory test/ Tue Aug 18 14:01:36 -0700 2009 added empty ebin to ensure directory is created [jashmenn]
README.mkd

Stoplight

Introduction

Stoplight is a distributed mutex server, based on the Sigma algorithm.

Mutual exclusion: No two different clients are in their critical sections at the same time.

Features:

  • progress guaranteed in the face of process crashes (i.e. lockout-freedom, will not deadlock)
  • assumes asynchronous and unreliable communication
  • survives server and client memory loss
  • endures messages being lost, duplicated or delivered out of order (non-FIFO)
  • mutual exclusion guaranteed if f<n/3 where f is the number of failed servers and n is the total number of servers.

Install

Prerequisites

  • ruby / rubygems / rake
  • gem sources --add http://gems.github.com
  • gem install auser-skelerl auser-dslify

Build

cd stoplight
rake

Layout

    .
    |-- EMakefile
    |-- INSTALL
    |-- README.mkd
    |-- deps                 # dependencies
    |-- doc                  # documentation
    |-- ebin                 # app, bootscripts, ebin files
    |-- include              # headers 
    |-- priv
    |   `-- tasks            # rake tasks
    |-- scripts              # scripts to start/stop stoplight
    |-- src                  # main source
    `-- test                 # tests

Testing Locally

Open three windows:

window 1.

STOPLIGHT_NODENAME="stoplight@your-ip" ./scripts/stoplight-server

window 2.

STOPLIGHT_SERVER="stoplight@your-ip" ./scripts/stoplight-client
1> {Resp, Pid} = stoplight_client:lock(green, 1000).
{crit,<6078.82.0>}

window 3.

STOPLIGHT_SERVER="stoplight@your-ip" ./scripts/stoplight-client
1> {Resp, Lob} = stoplight_client:lock(green).        
{no,<6078.91.0>}

back to 2.

2> stoplight_client:release(Pid).
ok

back to 3.

2> {Resp2, Lob2} = stoplight_client:lock(green).
{crit,<6078.91.0>}

Clustering

On Server Machine 1

STOPLIGHT_NODENAME="stoplight@192.168.133.128" ./scripts/stoplight-server

On Server Machine 2

STOPLIGHT_NODENAME="stoplight@192.168.1.66" STOPLIGHT_SERVER="toplight@192.168.133.128" ./scripts/stoplight-server
1> nodes().
['stoplight@192.168.133.128']

On Client Machine

STOPLIGHT_SERVER="stoplight@192.168.133.128" ./scripts/stoplight-client

Configuration

stoplight servers is a valid application configuration option. This means when starting the server you can specify a list of addresses to other servers like so:

STOPLIGHT_NODENAME='stoplight@192.168.1.66' STOPLIGHT_SERVER_START_ARGS="-stoplight servers ['stoplight@192.168.133.128']" ./scripts/stoplight-server 

Acknowledgements

  • Stoplight Icon by alessandro "mentalrey" rei from his KDE "Dark Glass Icon Project" - http://www.mentalrey.it/project.html

Similar Projects