Skip to content
[Go] - Bully algorithm visualization & implementation written in Golang.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
assets
build/docker
cmd
conf update(conf): exclude test files for linting Feb 6, 2019
deployments
vendor
.gitignore
LICENSE
Makefile
README.md
bully.go
bully_test.go
glide.lock
glide.yaml
messages.go
peer.go
peer_test.go
peers.go
peers_test.go

README.md

Bully Algorithm Visualization

intro logo

codecov CircleCI Go Report GoDoc License

Table of Contents

What this repository is about

This repository contains source code of an implementation of the bully algorithm written in Go and a small browser visualization tool.

This has been made for learning purposes about distributed algorithms, Bully algorithm being the simplest leader election algorithm to implement.

Finally, I feel like implementing an algorithm myself helps me to understands it better and I thought it could be interesting to someone else.

What is the Bully algorithm ?

The Bully algorithm is one of the simplest algorithm made to design a coordinator among a set of machines.

Quickstart

First, go get this repository:

go get -d github.com/timtosi/bully-algorithm

Quickstart with Docker

❗️ If you don't have Docker and Docker Compose installed, you still can execute this program by compiling the binaries.

This program comes with an already configured Docker Compose file launching five nodes and the browser based user interface.

You can use the run target in the provided Makefile to use it easily:

asciicast

You can access the visualization through your browser at localhost:8080. If you want to test the cluster behaviour, you can stop and resume some of the nodes with docker commands.

💡 If you want to update the number of node or change some IDs you will have to update the configuration file and the Docker Compose file accordingly.

Quickstart without Docker

First compiles and launch the visualization server:

cd $GOPATH/src/github.com/timtosi/bully-algorithm/cmd/data-viz
go build && ./data-viz

Visu

Then launch at least two nodes with specifying their ID in argument:

cd $GOPATH/src/github.com/timtosi/bully-algorithm/cmd/bully
go build && ./bully 0

💡 IDs should by default be comprised between 0 to 4 but you should be able to update peer address default configuration easily.

Nodes

You can access the visualization through your browser at localhost:8080.

FAQ

None so far 🙌

License

Every file provided here is available under the MIT License.

Not Good Enough ?

If you encouter any issue by using what is provided here, please let me know ! Help me to improve by sending your thoughts to timothee.tosi@gmail.com !

You can’t perform that action at this time.