Out of Scope:
List non-functional requirements for the system...
Estimate the scale of the system you are going to design...
Total number of users = 500k
Total number of active users = 200k
During peak hours which is during contests, users can go up to 100k
During peak hours one user submits around 10 solutions in an hour; with 100k users it would be 100k * 10 = 1 million submissions per hour ~ 1000 submissions per second.
Storage wise it should not be concern as for 200k users * 10 submission(every day) * 365
Size of submission: less 5Mb
10 **12 bytes of data would be used every year; which is manageable from scalability point of view
Define what APIs are expected from the system...
1) Registration for Contents
POST /user/contest/register
Input:
{
contestId,
}
Output:
{
message: "User Registration successful/ or not
}
No user id is provided due to security concerns as it can be obtained through sessionId or some sort of token
2) Submitting the solution
POST /user/contest/submit/:contestId
{
problemId
codeText
language: ( from dropdown)
}
{
status
AdditonalText:
NumberOfTestsPassed
}
3) Running the solution
POST /user/contest/run/:contestId
{
problemId
codeText
language (dropdown)
}
{
status: List ( Result for each test)
}
4) GET /contest/rankings/:contested
{
user: Partial ( in paginated fashion)
problemResult : List
}
User
Registration:
Contest
Problem:
Submissions:
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
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...
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?