Core user flow: user goes into website, see questions (videos), write code, and run code.
What kind of availability do we need?
AlgoExpert is not critical, 3 nines of availability ~ 8 hours of downtime in a year.
Performance: latency, and throughput.
Code execution is important. Users want to see results reasonably fast. Almost instant — 1 to 3 seconds. 5 seconds for submissions.
What kind of scale are we planning? How many users we need to server.
10K+ users simultaneously, concurrent users
Are we serving customers only in US? World? Or specific regions?
US, India are most important, primary customer segment.
Website is not static, it has dynamic content too. Can they save the data into website?
We need robust API and database.
Website has not only static content. but users should able to save their code solution.
Static content, assets: we can use blob storage, AWS S3, Google Cloud Storage. Moreover, we can use CDN in North America, US, and India. And this will reduce response time to open homepage, load static content. Amazon CloudFront.
Requests → DNS Load balancing (clients send request to one domain name) to redirect to regions (India, US) → then we could have Path based load balancing on each region (separate code execution)
Authentication and Authorization
We could have different service to check subscriptions
Questions:
All questions list
One questions: description, solutions, hints, test cases, solutions to verify in server for each language.
Maybe we can save our questions list in Blob store, where each question is in JSON format.
Caching the questions:
100 questions, for each question 7 (let’s imagine 10) types of solutions. Each solutions has 1000 to 10K characters (let’s imagine 5K bytes of data). 5K * 10 languages * 100 questions = 5million of bytes = 5MB
Caching other data: Refresh data and cache eviction policy.
Database:
Table for user solutions, and which questions user solved. We can create indexes.
Databases also are replicated in US and India, we can use async application.