In high-traffic systems, especially during events like major sales, balancing non-functional requirements such as availability, consistency, and low latency is challenging. Different system components can prioritize these requirements differently based on their purpose:
By tailoring non-functional priorities to specific components, the system ensures efficient performance while handling high traffic effectively.
GET /suppliers/{supplier_id}/inventory
Description: Fetch inventory data for a supplier.
{
"supplier_id": "123",
"items": [
{ "item_id": "101", "stock": 20 },
{ "item_id": "102", "stock": 10 }
]
}
POST /items
Description: Add a new item to the system.
{
"item_id": "103",
"name": "Sony 65” TV",
"category": "Electronics",
"attributes": {
"brand": "Sony",
"resolution": "4K"
}
}
GET /items/{item_id}
{
"item_id": "103",
"name": "Sony 65” TV",
"category": "Electronics",
"stock": 5,
"price": 999.99
}
PUT /items/{item_id}
{
"price": 899.99,
"stock": 4
}
GET /search
Query Parameters: ?query=TV&sort=price&filter=category:Electronics
[
{ "item_id": "101", "name": "Sony 65” TV", "price": 899.99 },
{ "item_id": "102", "name": "Samsung 55” TV", "price": 799.99 }
]
GET /users/{user_id}/wishlist
[
{ "item_id": "101", "name": "Sony 65” TV", "price": 899.99 }
]
POST /users/{user_id}/wishlist
{ "item_id": "101" }
GET /users/{user_id}/cart
[
{ "item_id": "101", "quantity": 1, "price": 899.99 }
]
POST /users/{user_id}/cart
{ "item_id": "101", "quantity": 1 }
POST /orders
{
"user_id": "u123",
"items": [{ "item_id": "101", "quantity": 1 }]
}
GET /orders/{order_id}
{
"order_id": "o123",
"user_id": "u123",
"status": "placed",
"items": [{ "item_id": "101", "quantity": 1 }],
"total_price": 899.99
}
POST /notifications
{
"user_id": "u123",
"type": "order_placed",
"message": "Your order has been placed successfully!"
}
GET /users/{user_id}/recommendations
[
{ "item_id": "102", "name": "Samsung 55” TV", "price": 799.99 }
]
| Column | Type | Description |
|---|---|---|
| user_id | VARCHAR(50) | Primary Key |
| name | VARCHAR(255) | User name |
| VARCHAR(255) | User email | |
| password_hash | VARCHAR(255) | Encrypted password |
| phone | VARCHAR(15) | Contact number |
| Column | Type | Description |
|---|---|---|
| item_id | VARCHAR(50) | Primary Key |
| name | VARCHAR(255) | Item name |
| category | VARCHAR(255) | Item category |
| price | DECIMAL(10,2) | Item price |
| stock | INT | Stock count |
| description | TEXT | Item description |
| Column | Type | Description |
|---|---|---|
| order_id | VARCHAR(50) | Primary Key |
| user_id | VARCHAR(50) | Foreign Key to users |
| status | ENUM('created', 'placed', 'canceled', 'delivered') | Order status |
| total_price | DECIMAL(10,2) | Total order price |
| created_at | TIMESTAMP | Order creation timestamp |
| Column | Type | Description |
|---|---|---|
| order_item_id | VARCHAR(50) | Primary Key |
| order_id | VARCHAR(50) | Foreign Key to orders |
| item_id | VARCHAR(50) | Foreign Key to items |
| quantity | INT | Quantity of the item |
| price | DECIMAL(10,2) | Price of the item at the time of order |
Collection: items
{
"_id": "item_id",
"name": "Sony 65” TV",
"category": "Electronics",
"attributes": {
"brand": "Sony",
"resolution": "4K",
"screen_size": "65 inches"
},
"stock": 10,
"price": 999.99,
"description": "A high-quality 4K TV with advanced features"
}
Index: items
{
"item_id": "101",
"name": "Sony 65” TV",
"category": "Electronics",
"price": 899.99,
"stock": 5,
"description": "A high-quality 4K TV with advanced features"
}
Key-Value Store:
Key: order:o123
Value: {
"order_id": "o123",
"user_id": "u123",
"status": "created",
"expiry_time": "2025-01-15T10:05:00Z"
}
Schema Example:
{
"user_id": "u123",
"search_query": "4K TV",
"timestamp": "2025-01-15T10:01:00Z",
"clicked_items": ["101", "102"]
}