Implement a Large-Scale Distributed System
- Subject Code :
DDE602
Task Summary In this assignment, you will be implementing a peer-to-peer (P2P) application. The system will have a master and slaves and will be responsible for basic file sharing between peers.
The master in the system will implement a centralised index and be responsible for discovering new slaves, monitoring them, keeping track of what files they have and finally, redirecting peers to them to download the file.
Demonstrate an understanding of P2P computing concepts;
Apply P2P concepts in code; and
Produce scalable, fault tolerant and robust systems.
Context
Master
The master will listen on a well-known port for slaves to join the network. A slave will connect to the master when it wishes to advertise files available for download. The master will make note of that slave and periodically test its responsiveness. In the event that the slave cannot be reached, the master will remove the slave from its memory and no longer advertise it or its services to other peers.
Once joined, a slave will advertise to the master what files it has available for download. In this network, the names of the objects are mutually exclusive; that is, no other slave can advertise the same file name.
Slaves
In this network, slaves can either advertise files that can be downloaded by peers or they can search and download a specified file from a peer once it has been discovered by the master.
When a slave wishes to advertise files available for download, it contacts the master and advertises the file is available for download. Similarly, a slave may revoke a file being downloaded at any time. When this occurs, the master updates its central index of what is available on what peer.
When a slave wishes to download a file, it contacts the master and performs a search. If the file is found in the centralised index, the master returns the address of the slave and the requesting slave attempts to download the object from its peer.
Architecture and Behaviour
As the developer of this system you have complete design authority over how it will be implemented. In developing the system, you should take reasonable steps to ensure its robustness and best performance. Task Instructions To complete this assignment, follow these steps:
Step 1: Implement a P2P environment with one master instance and multiple slave instances, all listening to different ports. This can be implemented in a single computer or over multiple computers. Then, write programs for all the instances to connect with each other using necessary protocols
Step 2: Implement your P2P system,such that if the master fails, peers can continue to discover and download files from one another.
Step 3: Implement the following: o A protocol is implemented in the master to accept registrations from peers. o The master implements an algorithm to monitor peers and manage the registrations of failures to connect to peers. o The master is able to accept registrations of a file from peers and enforce mutual exclusion constraints. o Peers implement a protocol to register availability and the files to the master. o Slaves implement threads to act as both peers and slaves as outlined above. Both peers and slaves have the ability to identify and download objects using sockets. o The master and slaves should be able to do all of the above in a scalable fashion with a growing number of activities between them.
Step 4: You can use the programming language of your choice. However, Python is recommended for this type of project. The code must be well formatted and conform to Python naming conventions. You also need to provide sufficient comments in the code.