Let's consider the following estimates for capacity and bandwidth:
Based on these estimates, we can calculate the required capacity and bandwidth for the Task Scheduler system:
Considering each task data size as 1 KB and the creation of 6000 tasks per minute, the system will need a database capable of storing and managing this data efficiently. Therefore, the database should be able to handle a large volume of data insertion and retrieval operations.
createTask - creates a task
input: task name, code function to be executed (this could be literal code passed in or reference to some file with entry point)
output: creation success or failure, 201 https code response.
scheduleTask - schedule the task for a specify time to run
input: date time to execute the task, name of the task to be executed
output: schedule success or failure, 201 https code response.
executeTask - immediately executes the task by queuing it up.
input: task name
output: job id
rescheduleTask - reschedules the task for a different time to run.
input: job id
output: job id
listTasks - list tasks
input: none
output: list of tasks
updateTask - updates a task
input: task name, code function or reference to code file
output: update success or failure
deleteTask - deletes a task
input: task id
output: success or failure
We will design the database schema in InfluxDB for a Task Scheduler system, we can follow a structured approach incorporating the key components of InfluxDB's time-series data model.
Measurement: task_schedule
Measurement: task_metrics
Measurement: task_logs
task_schedule: Stores scheduled task information including task name, execution time, task status (pending, in progress, completed), recurrence interval, start date, and end date.
task_metrics: Contains performance metrics data related to task execution such as CPU utilization, memory utilization, disk usage, and timestamp.
task_logs: Records log messages generated during task execution with details like log message, log level, and log timestamp.
InfluxDB is purpose-built for handling time-series data, making it highly efficient for storing and querying timestamped data points. This aligns well with the nature of scheduling tasks with execution times.
Secondly, InfluxDB provides excellent write performance for ingesting time-series data rapidly. This is crucial for a Task Scheduler system where tasks may be created, updated, and executed frequently, requiring efficient data write operations.
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?