A fault-tolerant distributed stock exchange simulation with multiple server replicas and interactive clients.
The system allows clients to:
- deposit and withdraw money
- deposit and withdraw stocks
- place buy and sell orders
- view the current market state
- server discovery via UDP broadcast
- client connection to the best available server based on RTT
- leader election between servers
- reliable FIFO multicast replication
- crash detection and failover
- leader-based order matching
- replicated order book state across servers
- Clients listen for server heartbeat broadcasts and connect to the best available server.
- Servers discover each other through broadcast and maintain a shared group view.
- One server becomes the leader and handles order matching.
- Updates are propagated to the other servers using multicast.
- If a server crashes, the system updates membership and elects a new leader if needed.
client.py— client node implementationserver.py— server node implementationreport.pdf— final course report
Install the only external dependency:
pip install netifacesThe system relies on UDP broadcast for server discovery and IP multicast for message replication.
Because both mechanisms operate only within a local network, all servers and clients must run on the same machine or within the same LAN subnet.
Start one or more servers:
python server.pyStart one or more clients:
python client.pyOn a server terminal, type:
crashThis simulates a server failure and allows you to observe failover and leader re-election.
- Muhammad Amin Guluzade
- Eric Sîrbu
- Mykhailo Zelia
This project was developed as part of a Distributed Systems course.