Skip to content

mohamed-stifi/Distributed-Master-Worker-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To implement a distributed MapReduce system with a master-worker architecture, we will set up two programs:

  1. Master Program: This will manage task assignment and track task status.
  2. Worker Program: This will request tasks from the master, perform the assigned task, and report back.

We’ll use Remote Procedure Call (RPC) to facilitate communication between the master and worker processes. Below is a structured approach to solving the problem.

1. System Setup

1.1 Requirements

  • Python is the chosen language due to its support for RPC with xmlrpc library.
  • We need two types of files:
    • Master: Handles task distribution, tracks task completion, and manages worker failures.
    • Worker: Asks for tasks, performs them, and sends results back.

1.2 Components

  • Master:

    • Assigns tasks to workers.
    • Monitors worker progress (task timeouts are set to 10 seconds).
    • Redistributes tasks if a worker fails or times out.
  • Worker:

    • Requests a task from the master.
    • Processes the task (like counting words in a file).
    • Reports completion to the master.

2. Implementation

2.1 Master Program

We'll start by implementing the Master that handles task assignment and worker monitoring.

2.2 Worker Program

The Worker will ask for tasks, execute them, and send back the results.

3. Execution and Testing

  • Run the master on one terminal:
    python master.py
  • Run multiple workers on separate terminals:
    python worker.py

4. Explanation & Monitoring

  • The master initializes tasks and monitors them. If a worker fails to complete within 10 seconds, the task is reassigned.
  • Each worker independently asks for a task, processes it, and reports completion.

5. Improvements & Considerations

  • Load Balancing: More sophisticated task distribution could be implemented for large-scale data.
  • Failure Handling: Currently, only task timeout is handled. Worker node failures should be monitored too.
  • Security: Authentication and encryption mechanisms would be necessary for real-world distributed systems.

What do you think? 😊

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages