https://github.com/mradovic38/bee-social
BeeSocial is a Java-based distributed system that enables decentralized sharing and management of .jpg image files across networked nodes.
https://github.com/mradovic38/bee-social
chord concurrency concurrent-programming decentralized decentralized-applications distributed-systems fault-tolerance java kids multithreading mutex p2p peer-to-peer suzuki-kasami
Last synced: about 2 months ago
JSON representation
BeeSocial is a Java-based distributed system that enables decentralized sharing and management of .jpg image files across networked nodes.
- Host: GitHub
- URL: https://github.com/mradovic38/bee-social
- Owner: mradovic38
- License: mit
- Created: 2025-05-29T15:39:13.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-08-15T12:28:06.000Z (2 months ago)
- Last Synced: 2025-08-15T14:32:27.859Z (2 months ago)
- Topics: chord, concurrency, concurrent-programming, decentralized, decentralized-applications, distributed-systems, fault-tolerance, java, kids, multithreading, mutex, p2p, peer-to-peer, suzuki-kasami
- Language: Java
- Homepage:
- Size: 663 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π BeeSocial - Distributed Image Sharing System
BeeSocial is a Java-based distributed system that enables decentralized sharing and management of
.jpg image files across networked nodes. Designed to simulate a minimal social platform, BeeSocial includes
key distributed systems principles such as self-organization, fault tolerance, and eventual consistency,
while supporting user interactions via a simple command-line interface.## π Features
* **Distributed File System**
* Add and distribute .jpg image files across nodes
* Browse and fetch files from other nodes
* Remove files from the local node* **Node Interactions**
* Follow/unfollow nodes
* Visibility control (public/private profiles)
* **Topology-aware Communication**
* Peer-to-peer **Chord** architecture
* Logarithmic message routing for scalability
* **Fault Tolerance**
* Dual-phase failure detection: weak and strong failure boundaries
* Buddy system for failover and data recovery* **Bootstrap-less Self-Organization**
* Bootstrap server only introduces a node into the system, with no further control
* Decentralized, resilient structure with dynamic join/leave capability
* **Fair Distributed Mutual Exclusion**
* Fair mutex implementation using **SuzukiβKasami** algorithm## π§ͺ Commands (CLI Interface)
| Command | Description |
| ----------------------------- | -------------------------------------------- |
| `follow [ip:port]` | Sends a follow request to the specified node |
| `pending` | Lists incoming follow requests |
| `accept [ip:port]` | Accepts a follow request |
| `upload [relative_path]` | Uploads a file to the network |
| `visibility [public/private]` | Sets the visibility of your files |
| `list_files [ip:port]` | Lists files of another node (if allowed) |
| `remove_file [filename]` | Removes file from the local node |
| `quit` | Gracefully exits the node from the system |
| `stop` | Violently shuts down the node from the system|## βοΈ Configuration
See file [`chord/servent_list.properties`](chord/servent_list.properties)
* `servent_count`: Number of servents in the system
* `chord_size`: Capacity of the Chord architecture
* `root`: Local working directory for storing files
* `cache`: Local working directory for saving files gathered using commands
* `servent{x}.port`: Listening port for the node `{x}`
* `bs,port`: Listening port for the bootstrap node
* `weak_limit`: Time before suspecting a node (ms)
* `strong_limit`: Time before removing a node (ms)**Note:** Config files must be consistent across all nodes.
## π‘ System Architecture
BeeSocial supports the Chord architecture:
* β Fully decentralized
* β Logarithmic routing
* β Fault-resilient, dynamic restructuring## π οΈ Fault Detection
* **Phase 1: Weak Suspect**
* Node unresponsive beyond the weak threshold
* Cross-verification by another stable node (buddy node)* **Phase 2: Strong Failure**
* Node unresponsive beyond strong threshold
* Node removed from the system
* Buddy nodes take over responsibilities## ποΈ Data Redundancy
Each file is stored on the originating node, and at least one replica exists in the system to support fault recovery.
## π Distributed Mutual Exclusion
Supports a **fair mutex algorithm** to control access to shared resources:
* Implemented using SuzukiβKasami token-based algorithm## π§³ Project Structure
```
bee-social/
βββ src/
β βββ app/ # System management
β βββ cli/ # Command-line interface
β βββ fault_tolerance/ # Fault tolerance logic
β βββmutex/ # Mutex implementation
β βββ servent/ # Node logic
βββ chord/
β βββ error/ # Error debug log for each node
β βββ input/ # Input commands for each node
β βββ output/ # Output debug log for each node
β βββ servent_list.properties # System configuration
βββ cache/ # Directory for saving files gathered using commands
βββ root/ # Directory for storing files
βββ README.md
βββ ...
```## π§ͺ Running the System
1. Compile the project:
```bash
javac -d out src/**/*.java
```2. Start [`MultipleServentStarter`](src/app/MultipleServentStarter.java):
```bash
java -cp out app.MultipleServentStarter
```## π Resources
* [SuzukiβKasami Algorithm for Mutual Exclusion in Distributed System - GeeksForGeeks](https://www.geeksforgeeks.org/operating-systems/suzuki-kasami-algorithm-for-mutual-exclusion-in-distributed-system/)
* [Deep dive into Chord for Distributed Hash Table - Abhijit Mondal](https://mecha-mind.medium.com/deep-dive-into-chord-for-distributed-hash-table-e54f1b3411b)