1 Scale From Zero To Millions Flashcards
What is the right choice for non relational DB?
- application requires super low latency
- data are unstructured, or you do not have any relational data
- you only need to serialize or deserialize data (JSON, XML etc)
- you need to store a massive amount of data
What is scale up?
It’s vertical scaling, adding more power (CPU, RAM etc).
Great option if traffic is low.
Limitations:
- it has hard limit on resources;
- it doesn’t have failover and redundancy.
What is the scale out?
Its horizontal scaling, adding more servers into your pool of resources.
Great option if traffic is high.
What is failover and redundancy?
Failover - is the process of automatically transferring a workload or operations from a failed or offline component to a backup or standby component.
Example: In a server cluster, if one server fails, the failover mechanism redirects traffic and requests to another server that can take over the responsibilities of the failed server.
Redundancy - involves having backup or duplicate components or systems in place to ensure that there is a backup available in case the primary component or system fails.
Example: Redundancy can be implemented in various ways, such as having duplicate power supplies, network paths, or servers. If one component fails, the redundant one takes over to prevent service disruption.
Why private IPs are used for communication between servers?
For better security.
They are reachable only between servers in the same network and unreachable over the internet.
The load balancer communicates with web servers through private IPs.
What is DB replication?
Database replication involves copying data from one database to another in real-time, providing redundancy and improved performance.
It ensures high availability, fault tolerance, and facilitates tasks such as load balancing and disaster recovery in various applications.
Advantages:
- better performance;
- reliability - data is still preserved if one of the servers is destroyed;
- high availability;
What operations are allowed on master and what on slaves?
Master - only supports write operations;
Slave - gets copies of the data from master and supports read operations.
What is multi-master replication?
Multi-master replication is a database replication setup where multiple database nodes can act as both master and replica simultaneously.
In this configuration, each node has the ability to accept write operations, making updates independently, and these changes are then propagated to other nodes in the system, allowing for decentralized and bidirectional data synchronization.
What is circular replication?
Circular replication is a type of database replication where a set of databases are interconnected in a circular chain, and each database serves as both a master and a replica.
In this configuration, updates made to any database in the circular chain are propagated to the next database in the sequence until the changes complete the loop by reaching the starting database.
This creates a closed-loop replication topology, enabling bidirectional data synchronization among multiple database nodes.
CDN
Content Delivery Network
A cache layer (for expensive responses or frequently accessed data) or shifting static content (JS/CSS/Image/Video etc).
Caching Strategies.
Cache-aside
Read-through
Write-through
Write-around
Write-back or Write-behind
https://codeahoy.com/2017/08/11/caching-strategies-and-how-to-choose-the-right-one/
When to use cache?
- when data is read frequently but modified infrequently
What is SPOF
Single point of failure - if it fails, it will stop the entire system from working.
Expiration and eviction policies.
Expiration - once data is expired, it is removed from the cache.
Eviction - once cache is full, any new requests cause existing items to be removed.
LRU (most popular)
LFU
FIFO etc
How to move user session out of the web tier?
Stateless web tier. The user state is moved out of the web tier to the shared persistent storage.