Highload Application Flashcards

1
Q

What is Kafka?

A

Kafka is an open source software which provides a framework for storing, reading and analysing streaming data.

Something like Redis but with database-level reliability

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

What is Memcached?

A

Memcached is an open source, high-performance, distributed memory caching system intended to speed up dynamic web applications by reducing the database load. It is a key-value dictionary of strings, objects, etc., stored in the memory, resulting from database calls, API calls, or page rendering.

( Tools for caching )

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

What is ElasticSearch?

A

Elasticsearch is a real-time distributed and open source full-text search and analytics engine.

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

What is Solr?

A

Solr is a scalable, ready to deploy, search/storage engine optimized to search large volumes of text-centric data

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

What is Reliability?

A

The system should continue to work correctly (performing the correct function at the desired level of performance) even in the face of adversity (hardware or software faults, and even human error)

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

What is Maintainability?

A

Over time, many different people will work on the system (engineering and operations, both maintaining current behavior and adapting the system to new use cases), and they should all be able to work on it productively

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

What kind of errors can break Relibity?

A
  • Hardware error ( database broken, turn of light etc… )
  • Program error (Infinity recursion, cascade errors)
  • Human factor ( Accidently remove something important)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What examples of scalability workload params do you know?

A
  • Number of requests to webserver per second
  • Number of read/write database request per second
  • Number of active user in the chat
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Hadoop?

A

Hadoop is an open-source software framework with ability to store and process huge amounts of any kind of data, quickly.

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

What is MapReduce?

A

MapReduce is a module in the Apache Hadoop open source ecosystem. We use MapReduce to write scalable applications that can do parallel processing to process a large amount of data on a large cluster of commodity hardware servers.

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

What is a rolling upgrade?

A

A rolling upgrade is an upgrade of a software version, performed without a noticeable down-time or other disruption of service. ( we have a load balancer and roll upgrade one by one on each server )

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

What is Shared-nothing architecture?

A

Shared Nothing Architecture (SNA) is a distributed computing architecture that consists of multiple separated nodes that don’t share resources. The nodes are independent and self-sufficient as they have their own disk space and memory. In such a system, the data set/workload is split into smaller sets (nodes) distributed into different parts of the system. Each node has its own memory, storage, and independent input/output interfaces.

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

What is replication?

A

Replication is the continuous copying of data changes from one database (publisher) to another database (subscriber).

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

What is a database table partitioning (секционирование/шардинг)?

A

Partitioning is the database process where very large tables are divided into multiple smaller parts. By splitting a large table into smaller, individual tables, queries that access only a fraction of the data can run faster because there is less data to scan.

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

What replication strategies do you know?

A
  • single-leader ( main node send changes to others)
  • multi-leader ( several main nodes send changes to others)
  • leaderless ( send data to all nodes together)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the differences between synchronous, asynchronous and semi-synchronous replication?

A
  • synchronous replication waits untill all child nodes receive all updated info and then send succcess status
  • asynchronous replication doesn’t wait
  • semi-synchronous replication ( works synchronous only with one node and asynchronous with others)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How to add one more child node without downtime and losing data?

A
  1. Create leader db snapshot
  2. Move the snapshot to child db
  3. Register all changes on leader db since making snapshot
  4. Apply these changes to child db
18
Q

What replication data sending strategies do you know?

A
  1. Statement-based replication (SBR)
  2. Write-Ahead Logging (WAL)/ Streaming Replication
  3. Logical replication
  4. Trigger replication
19
Q

What is Statement-based replication (SBR) ? What are pros/cons?

A

Binary log stores the SQL statements used to change databases on the master server. The slave reads this data and reexecutes these SQL statements to produce a copy of the master database.

Problems
- Rand and Time.now function inside the statement
- Auto incremented columns

20
Q

What is Write-Ahead Logging (WAL) replication/ Streaming Replication?

A

WAL stands for Write-Ahead Logging. It is the standard protocol being used to ensure that all the changes made to the database are being logged properly in their order of occurrence. ( we send low level data to replica to restore data )

21
Q

What is Logical replication?

A

Logical replication is a method of replicating data objects and their changes, based upon their replication identity (usually a primary key). We use the term logical in contrast to physical replication, which uses exact block addresses and byte-by-byte replication.

22
Q

What is trigger replication?

A

This replication allows you to run trigger and handle data on the application side. It’s useful if you use a different DB and you need your custom logic.

23
Q

What is replication lag?

A

A replication lag is the cost of delay for transaction(s) or operation(s) calculated by its time difference of execution between the primary/master against the standby/slave node. ( When we have differences between main and child nodes)

24
Q

What is read-after-write consistency?

A

Read-after-write consistency is the ability to view changes (read data) right after making those changes (write data). For example, if you have a user profile and you change your bio on the profile, you should see the updated bio if you refresh the page. There should be no delay during which the old bio shows up.

25
Q

How to solve replication lag for read-after-write consistency?

A
  • Read data that user can edit from the primary node ( user’s profile)
  • Read all from the primary node during the first minute after update.
26
Q

What is Monotonic Reads?

A

Monotonic read consistency guarantees that after a process reads a value of data item x at time t, it will never see the older value of that data item. ( It can happen if user read values from different replicas)

27
Q

What kind of replication lags do you know?

A
  • Read-after-write consistency
  • Monotonic Reads
  • Consistent prefix reads
28
Q

What is consistent prefix reads?

A

Consistent prefix reads guarantee says that if a sequence of writes happens in a certain order, then anyone reading those writes will see them appear in the same order.

29
Q

How to solve conflicts for multy-leader replication? ( When we write different data to the primary node )

A
  • just avoid coflicts ( try not to allow edit the same data on the same node )
  • last write wins ( check request time and accept the latest )
  • Give number to each replica ( replica with biggest number has priority)
  • save conflict to the new data structure and solve them later with user
30
Q

What replication topologies with multy-leader nodes do you know?

A
  • ring(circular) topology ( one by one by ring )
  • star topology ( one in the midle connect to each)
  • all to all topology
31
Q

How to solve conflicts for leaderless replications?

A
  • When user reads data check the version of changes and update outdated values
  • Background process that can update outdated values
32
Q

What Partitioning strategies to dustribute data do you know?

A
  • RANGE partitioning (This type of partitioning assigns rows to partitions based on column values falling within a given range)
  • HASH partitioning ( values goes to hash function and returns random values, this values goes to one of the nodes)
33
Q

What is partitioning hot spot?

A

A partition with disproportionate high load is known as hotspot. Such partitioning is less effective and leads to uneven load distribution among nodes

34
Q

What is document-based partitioning for secondary index ?

A

Document-based partitioning (called the local index). Allows to create local index for each node and make search by several nodes. ( search a car by id and color)

35
Q

What is term-based partitioning for secondary index ?

A

Global index. Allows to split index values by several nodes as well ( for example colors from a to j to one node, others to another)

36
Q

What is data rebalancing?

A

When a new node joins the cluster, some of the partitions are relocated to the new node so that the data remains distributed equally in the cluster. This process is called data rebalancing. ( moving old data to a new node to keep balance)

37
Q

What rebalancing methods do you know?

A
  • With Fixed Number of Partitions
  • Dynamic Partitioning
38
Q

What is Fixed Number of Partitions rebalancing?

A

If there is a fixed number of Partitions say 100 partitions . now if a node is added the new node can steal a few partitions from every node until partitions are fairly distributed once again.( Each node has own range and just move some values to the new node)

39
Q

What is Dynamic Partitioning rebalancing?

A

For data with key range partitioning a fixed number of partitions would be very troublesome. When a partition grows to exceed a configured size it is split into two and one of the portions is sent to the new nodes.

40
Q

What is Two-phase commit transaction?

A

Two-phase commit (2PC) is a standardized protocol that ensures atomicity, consistency, isolation and durability (ACID) of a transaction for distributed systems.

41
Q

What is Two-phase commit coordinator?

A

After the coordinator has received a reply from every participant, it decides whether to commit or to abort the transaction
The following are the two rules, which govern the coordinator global termination decision regarding a transaction:
- If even one participant votes to abort the transaction, the coordinator has to reach a global abort decision.
- If all the participants vote to commit the transaction, the coordinator has to reach a global commit decision.

42
Q

What is XA Transaction?

A

XA is a two-phase commit protocol.