About RideShare
- The RideShare application provides functionality to add a new user, delete an existing user, create a new ride, search for an existing ride between a given source and destination, join an existing ride and delete a ride.
- This project revolves around creating a fault tolerant, highly available database as a service on an AWS EC2 instance for the RideShare application.
- This service has been implemented using master-slave architecture along with Zookeeper (for fault tolerance), RabbitMQ (for communication between workers) within Docker containers.
Design
- Set up 3 AWS instances – users, rides and orchestrator.
- Set up containers for users, rides and orchestrator in their respective instances.
- Set up and testing of load balancer.
- All the incoming requests are received by the load balancer and routed to the user’s or ride’s instance depending on the request.
- The APIs present in users and rides handles all incoming requests. In case of any database operations, a request is sent to the orchestrator instance over port 80.
- The orchestrator instance initially consists of 5 containers – RabbitMQ, Zookeeper, Orchestrator, Master and Slave.
- Eventual consistency is ensured by making use of Advanced Message Queue Protocol implemented using RabbitMQ.
- All read requests are published to the read queue.
- All write requests are published to the write queue.
- Once a write request is processed by the master, a subsequent request is published to the sync queue, in order to maintain consistency between the master and slave workers.
- Once any request is processed, the response is published to the respective response queue.