Loading...
For a single minute of data:
For retaining 24 hours of data for analysis, we need a total of 1.728 TB of storage.
If we extend this to 7 days of data retention, the required storage will be:
Get Top 'K' Requests API
Purpose: Retrieve the top 'K' most frequent requests in a specified time interval.
Endpoint: /api/top-requests
Method: GET
Parameters:
k (required, integer): The number of top requests to retrieve (maximum value = 100).
interval (required, string): The time interval for which to get the top 'K' requests. Supported values: 1min, 10min, 1hour.
timestamp (optional, ISO 8601 format): The specific timestamp to query (if not provided, the current time will be used).
Response:
{
"interval": "1min",
"timestamp": "2023-10-10T12:00:00Z",
"k": 10,
"top_requests": [
{ "url": "/home", "count": 150000 },
{ "url": "/api/login", "count": 120000 },
{ "url": "/products", "count": 110000 },
{ "url": "/cart", "count": 90000 },
{ "url": "/checkout", "count": 80000 },
{ "url": "/search", "count": 70000 },
{ "url": "/api/signup", "count": 60000 },
{ "url": "/products/123", "count": 50000 },
{ "url": "/category/electronics", "count": 40000 },
{ "url": "/api/logout", "count": 30000 }
]
}
Set K and Time Interval Configuration API
Purpose: Adjust the default 'K' value and time intervals globally or for specific users/clients.
Endpoint: /api/configure
Method: POST
Request Body:
k (optional, integer): Set a global maximum value for 'K' (e.g., 100).
intervals (optional, list of strings): List of valid intervals that clients can query (e.g., ["1min", "10min", "1hour"]).
Response:
{
"status": "success",
"message": "Configuration updated",
"k": 100,
"intervals": ["1min", "10min", "1hour"]
}
Get Historical Data API
Purpose: Retrieve top 'K' requests for a past time window. This can be useful for audits or longer-term analysis.
Endpoint: /api/historical-data
Method: GET
Parameters:
start_time (required, ISO 8601 format): The start time for the time window.
end_time (required, ISO 8601 format): The end time for the time window.
k (required, integer): The number of top requests to retrieve.
interval (optional, string): The time interval to query, default is 1hour.
Response:
{
"interval": "1hour",
"start_time": "2023-10-10T10:00:00Z",
"end_time": "2023-10-10T11:00:00Z",
"k": 5,
"top_requests": [
{ "url": "/home", "count": 500000 },
{ "url": "/products", "count": 480000 },
{ "url": "/api/login", "count": 470000 },
{ "url": "/cart", "count": 460000 },
{ "url": "/checkout", "count": 450000 }
]
}
Purpose: Stores all incoming web requests along with metadata such as URL, timestamp, and other details.
Storage Considerations:
Purpose: Stores pre-aggregated counts of requests for different URLs over defined time windows. This allows for fast querying when retrieving the top 'K' requests.
Storage Considerations:
interval_start ensures that each time window can be queried independently.Purpose: Stores global system configurations such as the default 'K' value and available time intervals.
Storage Considerations:
/home or /api/login) from their browser or mobile app./home or /products) that is received by the Load Balancer.