List functional requirements for the system (Ask the chat bot for hints if stuck.)...
1) Authors and publishers can upload their books in different formats
2) Distribution Channels - Deliverying ebooks across various platforms like reading apps,devices and online bookstore
3) Search Service to allow users to search for the book
4) Providing recomendations to user based on their past search history
List non-functional requirements for the system...
1) System should be highly scalable
2) System should be fault tolorent
Estimate the scale of the system you are going to design...
Lets assume we have 5*10^4 authors and 5*10^6 readers we assume that at any given time only 5% of the total users are active then total number of readers which are online is 2,500 and number of readers online 250000 lets assume each writer request to upload a new book or update any descirption of the book takes 0.1 sec and for readres let's assume the time the api take is 0.01 sec so number of writer request served in a second will be 10 and number of read requests served in a second will be 100 so total number of servers required 25000/100=250 and total number of write server 2500/100=25
Define what APIs are expected from the system...
we will be using rest for all the apis for the e book reader platofrm
/v1/book?bookName this api is used to get the book name
Response status code 200
{
bookName:bookName
author:authorName
lastRead:
}
/v1/book api is used to upload the book
RequstBody
{
bookName: bookName
authorName: authorName
noOfPage:total No of pages
MultiPartFile: File which needs to be uploaded
}
/v1/search-books?bookName This api is used to search for the bookName
Response status code 200
{
bookName:bookName
author:authorName
lastRead:
}
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...
As the system is more ready heavy then write heavy so we will be using a relational database like MySQL or oracle we will be having three tables books -> which will have the books details like the bookid,book name,book price similarly we will have the authors table which will store the author details like the author name, author last name,id as many authors can have a book and a single book can belong to many authors we will be creating a pivot table to break this many to many relationship and the id of pivot table will be stored in books and authors table books table will also be storing the object key that will give the presigned url for that object. As s3 guarantees 6 9 durability so our system will be fault to tolorent for scaling sql database we can shard the database based on the first Character of the books which will help us in minimizing the load on the single server.
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...
Each user will make a call to api gateway that will forward the request to the respetive api gateway for that request for popular books we will be storing them on the cdn which will help in easy retirival of the books and less time as the cdn call will always take less time then making a db call fetching from s3 using the object key and then creating the presigned URL and then calling s3 to get the file when author is going to upload his book for the first time we will be making a call to external drm service like google widvine that will check for any unauthorised copy and distribution after successfull verification by the drm the call will be made to upload service will be upload the file to s3 get the object key and then store the object key in oracle database based on the device type the encoder service can encode the object in different types to support different devices finally the book is returned to the user application
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...
Each user will make a call to api gateway that will forward the request to the respetive api gateway for that request for popular books we will be storing them on the cdn which will help in easy retirival of the books and less time as the cdn call will always take less time then making a db call fetching from s3 using the object key and then creating the presigned URL and then calling s3 to get the file when author is going to upload his book for the first time we will be making a call to external drm service like google widvine that will check for any unauthorised copy and distribution after successfull verification by the drm the call will be made to upload service will be upload the file to s3 get the object key and then store the object key in oracle database based on the device type the encoder service can encode the object in different types to support different devices finally the book is returned to the user application
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...
Each user will make a call to api gateway that will forward the request to the respetive api gateway for that request for popular books we will be storing them on the cdn which will help in easy retirival of the books and less time as the cdn call will always take less time then making a db call fetching from s3 using the object key and then creating the presigned URL and then calling s3 to get the file when author is going to upload his book for the first time we will be making a call to external drm service like google widvine that will check for any unauthorised copy and distribution after successfull verification by the drm the call will be made to upload service will be upload the file to s3 get the object key and then store the object key in oracle database based on the device type the encoder service can encode the object in different types to support different devices finally the book is returned to the user application
Explain any trade offs you have made and why you made certain tech choices...
1) Storing books in cdn will help in faster retirieval
2)
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?
Add matchine learning algorithms that provide better recommendation to the user.