Giter Site home page Giter Site logo

distributed-argon's Introduction

Distributed Argon

A distributed implementation of argon built using Cloud Haskell with a PostgreSQL database.

About

Distributed-Argon uses cloud haskell, implementing the work-stealing and the master/slave algorithm, for distributing the workload of argon, a library which measures code complexity.

The program accepts a GitHub repository and then calculates the complexity for every file of every commit in the project, storing the results in a database. I created another repository Charting-Complexity to generate the graphs.

Implementation

I decided to implement two algorithms and graph their results against eachother.

  1. Work-Stealing

A worker nodes steal work from the manager. the manager sends each file on a first-come-first-serve basis. The workers evaluate the complexity, return the result and request more work from the manager. This implementation is often referred to as the self-scheduling or work-stealing pattern.

Link to implementation in the source

  1. Master/Slave

A manager node decides on the distribution of the work. the manager splits up the work evenly (per-file basis) and distributes an even amount to each worker.

Link to implementation in the source

The manager stores the results it receives from the workers in a database as they come in non-deterministically.

Discussion

As I would have expected, the work-stealing pattern was a faster approach on average. This can be seen from the sample results provided below. Rather than the manager sending files, and the workers waiting, it is faster for the manager to send work to whoever is ready. In the master/slave there is the potential for lost working time while a manager is waiting for a worker to finish some previous task. This does not occur with the work-stealing pattern however, as the manager simply sends the work to whoever is ready.

Results

Work-Stealing

Master/Slave

The database

A PostgreSQL database is used to store the revelant information relating to a repositories complexity and the time taken with various amounts of nodes. There a database maintains two

Relations

Repository

Id Url Nodes Start Time End time
1 https://github.com... 2 2017-11-26 15:02:36.830273+00 2017-11-26 15:03:25.63044+00

Commit Info

Id Commit Start Time End Time
1 22939d... 2017-11-26 15:02:36.830273+00 2017-11-26 15:02:36.830273+00

Commit Results

Id Commit File Path Complexity
1 22939d... Distributed-Argon/src/Lib.hs JSON data

Prerequisites

To build with stack

stack build

To run

Fire up two shells and execute the following scripts.

Start the worker nodes

bash workers.sh

Start the mananger node

bash run.sh <Github Repository> <pattern> The patterns can be work-stealing or master-slave

Note

The number of workers, host address and port numbers, can be edited by altering the worker.sh and manager.sh scripts.

Viewing the results

I have built a graphical display of the results using Chart.js. A link to that repo can be found here

Alternatively, as all the necessary information is stored in a database, it can therefore be manipulated in any way you see fit.

Thanks

To all the argon contributors for allowing me to display my distributed programming skills with their great library!

distributed-argon's People

Contributors

mcgizzle avatar

Stargazers

 avatar

Watchers

 avatar  avatar

distributed-argon's Issues

Master/Slave Strategy

Extend the program to carry out the work using the master-slave algorithm.

This will make the graphing more interesting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.