More on this book
Community
Kindle Notes & Highlights
by
Alex Xu
Read between
September 7, 2020 - January 31, 2023
Non-relational databases might be the right choice if: •Your application requires super-low latency. •Your data are unstructured, or you do not have any relational data. •You only need to serialize and deserialize data (JSON, XML, YAML, etc.). •You need to store a massive amount of data.
A master database generally only supports write operations. A slave database gets copies of the data from the master database and only supports read operations.
Advantages of database replication: •Better performance: In the master-slave model, all writes and updates happen in master nodes; whereas, read operations are distributed across slave nodes. This model improves performance because it allows more queries to be processed in parallel. •Reliability: If one of your database servers is destroyed by a natural disaster, such as a typhoon or an earthquake, data is still preserved. You do not need to worry about data loss because data is replicated across multiple locations. •High availability: By replicating data across different locations, your
...more
A cache is a temporary storage area that stores the result of expensive responses or frequently accessed data in memory so that subsequent requests are served more quickly.
Consider using cache when data is read frequently but modified infrequently.
A CDN is a network of geographically dispersed servers used to deliver static content. CDN servers cache static content like images, videos, CSS, JavaScript files, etc.
Each web server in the cluster can access state data from databases. This is called stateless web tier.
To further scale our system, we need to decouple different components of the system so they can be scaled independently. Messaging queue is a key strategy employed by many real-world distributed systems to solve this problem.
A message queue is a durable component, stored in memory, that supports asynchronous communication. It serves as a buffer and distributes asynchronous requests.
Sharding separates large databases into smaller, more easily managed parts called shards. Each shard shares the same schema, though the actual data on each shard is unique to the shard.
When choosing a sharding key, one of the most important criteria is to choose a key that can evenly distributed data.
The ability to ask good questions is also an essential skill, and many interviewers specifically look for this skill.

