- A storage system for Shopping Cart data, and an API to access the data written purely in Python
- Features developed are Leaderless replication, data partitioning, eventual consistency
- Used CRUSH hash function for mapping, Zookeeper for coordination, read-repair using version vectors for consistency, Flask to build the API
- Architecture
- Schema Design
-
Database nodes API design
- Database used in each node -
TinyDB. - Endpoints provided
GET /productslist- Returns the list of products present in that node
GET /product- Takes as query parameter, the name of the product, and returns its quantity and version
POST /product- Takes product's name, quantity and version as input, and updates the information in the database
GET /userslist- Returns the list of users present in that node
GET /user- Takes as query parameter, the email of the user, and returns its cart and version
POST /user- Takes user's email and version as input, and updates the information in the database
POST /addtocart- Takes user's email, cart and version as input, and updates the information in the database
- Database used in each node -
-
Database Node Architecture
- Registers itself to zookeeper, with its IP and flask app port number as data
- Starts the database API
-
Gateway API design
- Endpoints provided
GET /productslist- Calls
GET /productslistfor each database node registered in zookeeper, returns union of the lists.
- Calls
GET /product- Takes as query parameter, the name of the product
- Internally hashes it to an integer
- Finds the mapping of the value to the nodes from CRUSH hash function using read quorum of
(number of nodes + 1)/2 - Calls
GET /producton each node found above - Checks if some data is stale
(version number != latest version) - Performs read-repair if required, takes the
minimum of quantities of all latest versionsas the latest value - Returns the latest quantity and version back.
POST /product- Takes product's name and quantity as input
- Internally hashes it to an integer
- Finds the mapping of the value to the nodes from CRUSH hash function using read quorum of
(number of nodes + 1)/2 - Calls
GET /producton each node found above - Checks if some data is stale
(version number != latest version) - Performs read-repair if required, takes the
minimum of quantities of all latest versions+the quantity present in the requestas the latest value - Calls
POST /producton each node found from CRUSH hash function with the latest data
GET /userslist- Calls
GET /userslistfor each database node registered in zookeeper, returns union of the lists.
- Calls
GET /user- Takes as query parameter, the email of the user
- Internally hashes it to an integer
- Finds the mapping of the value to the nodes from CRUSH hash function using read quorum of
(number of nodes + 1)/2 - Calls
GET /useron each node found above - Checks if some data is stale
(version number != latest version) - Performs read-repair if required, takes the
maximum of quantities of each product in cart among all the latest versions - Returns the latest cart and version back.
POST /userGET /userslist- Calls
GET /userslistfor each database node registered in zookeeper, returns union of the lists.
GET /user- Takes as query parameter, the email of the user
- Internally hashes it to an integer
- Finds the mapping of the value to the nodes from CRUSH hash function using read quorum of
(number of nodes + 1)/2 - Calls
GET /useron each node found above - Checks if some data is stale
(version number != latest version) - Performs read-repair if required, takes the
maximum of quantities of each product in cart among all the latest versions - Returns the latest cart and version back.
POST /createuser- Takes user's email as input
- Internally hashes it to an integer
- Finds the mapping of the value to the nodes from CRUSH hash function using read quorum of
(number of nodes + 1)/2 - Calls
POST /createuseron each node found from CRUSH hash function
POST /addtocart- Takes user's email and products and quantities to be added (cart) as input
- Internally hashes email to an integer
- Finds the mapping of the value to the nodes from CRUSH hash function using read quorum of
(number of nodes + 1)/2 - Calls
GET /useron each node found above - Checks if some data is stale
(version number != latest version) - Performs read-repair if required, takes the
maximum of quantities of each product in cart among all the latest versions - Calls
POST /addtocarton each node found from CRUSH hash function with the latest data
- Endpoints provided
docker-compose up -d --scale dbnode=3
Access the demo video here
| Name | ID |
|---|---|
| Harpinder Jot Singh | 2017A7PS0057P |
| Vishal Mittal | 2017A7PS0080P |
- DB Schema plotter
- Flowchart maker - draw.io
- Containerization Books
- Containerization with LXC
- Practical LXC and LXD
- Eventually Consistent Key-Value Storage -Java
- Cassandra Arhitecture
- Python- Distributed Key Value Store
- Cassandra notes
- Netflix Dynomite


