List functional requirements for the system (Ask the chat bot for hints if stuck.)...
Create Advertisements, update
View Advertisements
Feed with most recent / relevant advert
Search adverts
List non-functional requirements for the system...
Highly Available
Low Latency feed for looking at adverts
Scalable to handle popular products
Estimate the scale of the system you are going to design...
1 million DAU
30% post every day -> 300k posts/day
user sees 10 posts a day -> 10 million reads/day -> 100 reads/second
Define what APIs are expected from the system...
POST /advert/
{
name
price
type
}
GET /advert/?id
GET /advert/?keyword
POST /remove_advert/
{
id
reason
}
GET /feed/
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
AuthUser
user
username
AdvertTable
name_of_product
posted_by : FK to the AuthUser
posted_on
product_status: available/sold/removed
price
details
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...
The user can post their advertisement using the post API so after the post so after the hit the endpoint are are load balancer gets the request and Roots it to our post post service module the post service model can then add the data to our database for our main database about the words information 2-hour load balancer and I get service can then return can then query our weed replica to get details about that specific advertisement in addition to this in order to make it more optimized we can add a lettuce to improve the Quarry time
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...
Let's dive deeper into the database the database you can in this case you can use both SQL and non-sql and no SQL because of the fact that lots lots of the products can be unstructured and we can use no excel in that case but we can also use SQL we can use it as a structured we can use its structure to work in those decline to call them call details and then can add the type of the product and the user can then just Define the product and the details of the page so in this case you can use close SQL because we're estimating about 100,000 flights per minute which should be enough which process Cruella should be able to handle next weekend use elastic search for querying data elastic search is very fast I couldn't get up because it uses inward indexes were and basically and the word as the key and the value was a list of all posts where that specific word in Accra that can really oh that's been really helpful optimize our social time and addition to that we can also use composite indexes were the keys can be injectors or by grams by grams where the word where the keys can be accomplished a pair of two words could even more unique but it might take a little more storage and a little more time when up when adding stuff to it but
Explain any trade offs you have made and why you made certain tech choices...
Kafka can introduce lag during high traffic, can increase technical overhead
Elastic search + database can dramatically increase the storage needs
Try to discuss as many failure scenarios/bottlenecks as possible.
In case of high posts database writes can overload.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?