Examples Flashcards
1
Q
Design a Sales ranking system by category
A
Basic Design
- User only needs to read, updates/datasource are from another service.
- 1 API for read directly from DB, 1 service for consume the updates/compute and store the result in to DB.
- the ‘another service’ we can assume that it is a API(better than a raw DB)
Improvements:
- Too much DB hits, Too much calculation consider using Cache
- load balancer/ CDN
- more servers
- Database scaling (add more/partitioning)
- Consider using No SQL
2
Q
Design a recipes website for user-input ingredients
A
Key extra point:
- Database data model design
- How to compute the result from many to many relationship
- Would using Nosql help reduce the computation time
- check similar question on CCI - system design question 1 find the documents containing the words
3
Q
Designing a shorting URL
A
- Cacheing - what to cache, how to update cache
2. URL hashing/generating
4
Q
Database model design
A
- list all entities/tables
- each Entity/table have a PK (***ID)
- then add foreign_key(otherID)
5
Q
High level design
A
Client
Server - Read API/ WriteAPI / ComputationService
DataStore - database / External API / Disk
6
Q
Other aspect needs to consider
A
Security, Permissions
7
Q
Build a e-retail company from scratch
A
- brainstorm main usecase : login, browse, select, pay, order
Login Service
Memebership Service
Inventory Order Processing - Physically
Database (implementation of Interfaces)
Domain Services (Interfaces of any ports, so can invoke and usem import domain)
Application(invoke services, ports, import ports, services) Ports(implementation of Interfaces)
common login membership inventory order
In Application
Result1 r1 = service1.processRequest(request); - usecase input port
service2.handle(r1) outputport.handle(rl) - usecase output port