Cheatsheet Flashcards
1
Q
- Clarify and agree on the scope of the system
A
User cases(description of sequences of events that, taken together, lead to a system doing something useful) Who is going to use it? How are they going to use it?
Constraints/Traffic 1. requests per second 2. read/write ratios 3. Data storage Special system requirements such as multi-threading, read or write oriented.
Assumptions (can always be solved later)
- Assume data source are there
- Assume some service are there
2
Q
- High level architecture design (Abstract design)
A
Sketch the important components and connections between them, but don’t go into some details.
- Application service layer(serves the requests) - List different services required
- Data Storage layer
Usually a scalable system includes (WSDC) webserver (load balancer), service (service partition), database (master/slave database cluster) caching systems.
3
Q
- Component Design
A
- Component + specific APIs required for each of them. - Object oriented design for functionalities.
- Map features to modules: One scenario for one module.
- Consider the relationships among modules:
1. Certain functions must have unique instance (Singletons) 2.Core object can be made up of many other objects (composition). 3.One object is another object (inheritance) - Database schema design
4
Q
- Understanding Bottlenecks
A
- Too less servers(for too many users)
- Too many data
- Too many DB access/expensive computation - cache/pre compute
5
Q
- Scaling your abstract design
A
Vertical scaling
You scale by adding more power (CPU, RAM) to your existing machine.
Horizontal scaling
You scale by adding more machines into your pool of resources.
Caching - Load balancing Caching - CDN - Application caching (In-memory) Precalculating results Pre-generating expensive indexes Frequently accessed DB data - Database caching tends to be "free". When you flip your database on, you're going to get some level of default configuration which will provide some degree of caching and performance. Those initial settings will be optimized for a generic usecase, and by tweaking them to your system's access patterns you can generally squeeze a great deal of performance improvement.
Load balancing/Reverse proxcy
Database replication
Master-slave
Master-Master
Database partitioning
Functional partitioning
sharding
Map-Reduce
6
Q
Key topics for designing a system
A
- Concurrency
Do you understand threads, deadlock, and starvation? Do you know how to parallelize algorithms? Do you understand consistency and coherence? - Networking
Do you roughly understand IPC and TCP/IP? Do you know the difference between throughput and latency, and when each is the relevant factor? - Abstraction
You should understand the systems you’re building upon. Do you know roughly how an OS, file system, and database work? Do you know about the various levels of caching in a modern OS? - Real-World Performance
You should be familiar with the speed of everything your computer can do, including the relative performance of RAM, disk, SSD and your network. - Estimation
Estimation, especially in the form of a back-of-the-envelope calculation, is important because it helps you narrow down the list of possible solutions to only the ones that are feasible. Then you have only a few prototypes or micro-benchmarks to write. - Availability & Reliability
Are you thinking about how things can fail, especially in a distributed environment? Do know how to design a system to cope with network failures? Do you understand durability?
7
Q
Web App System design considerations:
A
- Security (CORS)
- Using CDN
A content delivery network (CDN) is a system of distributed servers (network) that deliver webpages and other Web content to a user based on the geographic locations of the user, the origin of the webpage and a content delivery server.
This service is effective in speeding the delivery of content of websites with high traffic and websites that have global reach. The closer the CDN server is to the user geographically, the faster the content will be delivered to the user.
CDNs also provide protection from large surges in traffic. - Full Text Search
Using Sphinx/Lucene/Solr - which achieve fast search responses because, instead of searching the text directly, it searches an index instead. - Offline support/Progressive enhancement
Service Workers - Web Workers
- Server Side rendering
- Asynchronous loading of assets (Lazy load items)
8.Minimizing netwrok requests (Http2 + bundling/sprites etc)
9.Developer productivity/Tooling
10.Accessibility - Internationalization
- Responsive design
- Browser compatibility