Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Distributed System Simulation

This project simulates a basic representation of a distributed system comprising a client, slave, and master application.

The client application requests the completion of jobs, the slave application executes jobs, and the master application manages all the slaves, clients, and jobs.


The flow of a job through the system is as follows:

  • A client sends a job request to the master
  • The master assigns the job request to the slave that will finish it the soonest, considering the job type and the current load on all slaves (load balancing)
  • The slave 'executes' the job (this is simulated by sleeping the slave for a set amount of time; see note below)
  • On completion, the slave sends back the job result to the master
  • The master sends back the job result to the client

For the simulation, we make use of two job types - type A and B. On startup, each slave application is set to be optimized for only one of the job types. A slave application will execute the job type it is optimized for faster than one it is not optimized for. The master application takes this into account when load balancing for better optimization.

How to run

  • Download and install the client, slave, and master applications (found in the releases; alternatively, you can build it from source)
    • They can be installed on the same or separate computers
  • Startup one instance of the master application
  • Startup one or more instances of the client application
  • Startup one or more instances of the slave application
  • On the client and slave applications, enter the IP address where the master application is running:
    • If you are running both applications on the same computer, use 127.0.0.1
    • If the applications are running on different networks, port forwarding will need to be configured on the master application's network to forward all incoming traffic for port 30000 and 30001 to the local machine that is running the master application
  • Connect the slave application(s) to the master application
  • Send job requests to the master from the client application(s)

Master application master-application-running
Slave application slave-application-running
Client application client-application-running

Socket communication

All communication done in this simulation follows a custom protocol similar to TCP, as demoed in this repo. The version used here is slightly more built-out to support additional features, but the core is the same.

About

A simulation demonstrating a distributed system for the completion of jobs with a client, slave, and master application.

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages