Skip to content

Thedtk24/my-cluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Distributed Calculation Cluster

A lightweight, C-based distributed computing cluster using UDP sockets. It allows you to offload arithmetic operations (ADD, SUB, MUL) to a network of worker nodes via a central registry.

Architecture

  • Registry (Master): Manages available nodes, dispatches tasks, and routes results back to the client.
  • Node (Worker): Registers with the master and executes computational tasks.
  • Client: A CLI tool to send tasks to the cluster and receive results.

How to Build

Compile the three components using gcc:

# Compile the Registry (Master)
gcc registry.c -o registry -lpthread

# Compile the Worker Node
gcc node.c -o node -lpthread

# Compile the Client
gcc client.c -o client_app

How to Use

1. Start the Registry

Start the master server on a specific port (e.g., 5000).

./registry 5000

2. Start Worker Nodes

Start one or more workers. Provide the worker's own port and the registry's port.

# syntax: ./node <NODE_PORT> <REGISTRY_PORT>
./node 8001 5000 &
./node 8002 5000 &

3. Send a Command

Use the client to send a calculation request.

# syntax: ./client_app <OPERATION> <OP1> <OP2> [REGISTRY_IP] [REGISTRY_PORT]
./client_app ADD 10 20

Output:

[Client] Sending: CLIENT_TASK:ADD:10:20 to 127.0.0.1:5000
[Client] Waiting for response...
[Client] Received: RESULT:30

Automated Testing

You can run the provided script to test the full flow:

./client.sh

About

A lightweight, fault-tolerant distributed cluster simulator written in C. Features dynamic node discovery, least-load balancing, and an automated task watchdog for seamless compute reliability.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors