1 Scale From Zero To Millions Flashcards

1
Q

What is the right choice for non relational DB?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is scale up?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the scale out?

A

Its horizontal scaling, adding more servers into your pool of resources.

Great option if traffic is high.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is failover and redundancy?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why private IPs are used for communication between servers?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is DB replication?

A

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;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What operations are allowed on master and what on slaves?

A

Master - only supports write operations;
Slave - gets copies of the data from master and supports read operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is multi-master replication?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is circular replication?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

CDN

A

Content Delivery Network

A cache layer (for expensive responses or frequently accessed data) or shifting static content (JS/CSS/Image/Video etc).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Caching Strategies.

A

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/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When to use cache?

A
  • when data is read frequently but modified infrequently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is SPOF

A

Single point of failure - if it fails, it will stop the entire system from working.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Expiration and eviction policies.

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How to move user session out of the web tier?

A

Stateless web tier. The user state is moved out of the web tier to the shared persistent storage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the sticky session?

A

It a way to route the request to the right server that has user session, Most load balancers are capable with sticky sessions.

Adding or removing servers is much more difficult with this approach.

17
Q

What DB is better to use for user sessions?

A

Redis, NoSQL etc. Any that is easy to scale.

18
Q

GeoDNS

A

Let’s say we have US-East and US-West data centers. GeoDNS will resolve domain names to IPs based on the location of a user.

19
Q

Message queue.

A

It’s a buffer and it distributes asynchronous requests.

The producer and the consumer can be scaled independently.

20
Q

What is sharding?, Sharding key?

A

Sharding separates large DBs into smaller, more easily managed parts called shards. Each shard shares the same scheme, though the actual data on each shard is unique to the shard.

Sharding key consists of one or more columns that determine how data is distributed. It’s important to choose a key that can evenly distribute data.