software-interview-prep

System Architecture

HDD

SSD

RAID

CAP Theorem

MapReduce

For example, create search inverted index:

// Mapper

/*
 * Processes a key/value pair to generate a set of intermediate key/value pairs
 *
 * @param key id of document
 * @param value text of page
 * @returns pair of word and document id
 */
public Tuple<String, String> map(String key, String value) {
  for (String word : tokenize(value))
    return new Tuple<>(word, key);
}
// Reducer

/*
 * Merges all intermediate values associated with the same intermediate key
 *
 * @param key word
 * @param value list of document ids
 * @returns word to document ids pair
 */
public Tuple<String, List<String>> reduce(String key, List<String> value) {
  return new Tuple<>(key, value)
}

Distributed Hash Table

Data Partitioning (Sharding)

Consistent Hashing

Consistent Hashing

(source)

Distributed System Consensus

Resiliency Concepts (Advanced)

System Design Question Concepts

Platform Needs

Membership Protocols (Advanced)

Summary mainly based on this slide deck and the SWIM paper.

Heartbeating

SWIM