System requirements


Functional:

  • submit task to run it one time or periodically by schedule
  • track task status
  • allow re-run failed task



Non-Functional:

  • scale up when more task being added
  • able to retry failed task





Capacity estimation






API design

  • submit(task_name, task_params)
    • return task_id for tracking
    • task_params define how often to trigger the task and how to run it





Database design

use relational DB

table: task_id task_start_time repeat_mode task_params





High-level design


user submit a task -> API gateway -> LB -> task_server -> message queue -> worker to run it





Request flows

Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...






Detailed component design

since it might have bunch of request coming it




Trade offs/Tech choices

Explain any trade offs you have made and why you made certain tech choices...






Failure scenarios/bottlenecks

Try to discuss as many failure scenarios/bottlenecks as possible.






Future improvements

What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?