Cloud Storage

  • Cost Model

    • Commercial cloud storage providers charge by three components:

      1. Storage space
      2. Number of requests (e.g., PUT, GET, LIST, DELETE)
      3. Data transfer (outbound from the cloud)
    • Tiered pricing model:

      e.g., Amazon S3 cost for 50TB per month = 1024GB * \$0.0300 per GB + 49 * 1024GB * \$0.0295 per GB (cheaper)
  • Motivation of Dedeplication (Dropbox)
    Before 2016, Dropbox used AWS to store the data, but the charges of Dropbox are even cheaper than that of AWS, so how does Dropbox make a profit?
    Now, Dropbox has its own data centers but still a majority of users are free riders
    They introduced dedeplication, by removing the duplicated files (the content redundancy)
    Content Redundancy & Control/ Fault Tolerance Redundancy:

    • The deduplication here has no relation with fault tolerance, it represents the content redundancy that Dropbox may create replicas to deal with fault tolerance, but before the replications, they will remove the duplicated contents.
  • Deduplication: An approach that eliminates redundant data on storage. Instead of storing multiple copies of data of the same content, only one copy is stored
    Store only one copy of chunks with same content; other chunks refer to the copy by references

  • Deduplication & Compression:

    • Compression reduces the amount of stored bits compared to the original data
      Transforms data into new representation with higher entropy (irreplaceable)
    • Deduplication detects identical data chunks / similarities between data chunks

      In practice, we would do the deduplication first to filter out the identical chunk and keep the unique chunk, then do the compression into some smaller size representations with high entropy.

      Deduplication after the compression: two files with similar contents (may have many identical chunk), the compressions would change the internal similarity of those identical chunk, so the similarity of thosecompressed files is much lower which cannot perform deduplication.

    • Workflow

      1. Deduplication
      2. Delta compression
      3. Compression

Deduplication

  • Workflow
    1. Fingerprinting (compare by hash): Generate identifiers of data based on content
    2. Chunking: Divide data stream into different chunks and generate fingerprints for chunks
    3. Indexing: Maintain all fingerprints of existing chunks

Fingerprints

Associate a chunk with some identifiers called fingerprint.
By generating a hash for files to some fingerprints (the hash function should generate a fixed value for the identical content). By comparing the generated fingerprints of two files, if their fingerprints are identical, it implies that they have a very high chance that the two files are also the same. The fingerprint comparison is much efficient than comparing two files.

Chunking

Dropbox does not do the fingerprinting on files, it will first split the file into multiple chunks (not directly do fingerprinting on file)
The purposes are to save the space as deduplications on files is not efficient (1 byte difference) and save the upload bandwidth (doesn’t upload the data which is duplicated)

  • Imprementation

    1. Every file is split up into chunks of up to 4MB
    2. Apply SHA-256 to each chunk
    3. Hash values are sent to Dropbox servers, and are compared to the hashes already stored
    4. If a chunk doesn’t exist, upload it
  • Fixed-size chunking: Each file is divided into equal-size chunks

    When inserting something in the beginning where all the contents are shifted, fixed-size chunking will always split the file at the fixed position, all the chunks would be different, which is not suitable for deduplication if file is updated.
  • Variable-size chunking: Enables adaptive boundaries on dividing data into chunks

    • Standard for variable-size chunking: Rabin-Karp Algorithm or Rabin fingerprinting (RFP), which is the polynomial representation of data, used for string pattern recognition

Rabin Fingerprinting

  • String pattern recognition

    Search whether a string OR exists and reports its position with time complexity $O(m(n-m+1))$ (squared)

  • Rabin Fingerprinting

    • reduce strncmp() operations by transforming a pattern into an integer value called the fingerprint

    • Polynomial Representation

      Let the “alphabets” in the universe contain $\{0-9\}$ only.
      Let the input be an array: $t = [t_1, t_2, \dots, t_m, t_{m+1}, \dots, t_n, \dots]$, where $0 \leq t_m \leq 9$

      • Example:

      • Implemented in polynomial way:

      • $O(m)$: to compute $p_0$
      • $O(1)$: to compute each $p_s$
    • Modular Arithmetic
      The Rabin fingerprint can be described as a polynomial with base 10 modulo q

      • Notice: Properties of modular arithmetic

        1
        2
        3
        1. [(a mod n) + (b mod n)] mod n = (a + b) mod n
        2. [(a mod n) - (b mod n)] mod n = (a - b) mod n
        3. [(a mod n) x (b mod n)] mod n = (a x b) mod n
      • With the modular arithmetic, multiple string patterns may map to the same fingerprint

        So we need to call strncmp() to check if the string patterns are actually identical (can’t simply reply on RFP)

    • Summary

      RFP is a function of $d$ and $q$,

      $d$ defines the range of the possible fingerprint values before taking the modulo operation. It should be a value that is larger than the largest value of the set of alphabets in order to avoid unnecessary collisions.

      $q$ is better to choose a large value so as to minimize the number of collisions. But, don’t forget our aim: to have a reasonably large (and small) $q$ so that it is computationally convenient to operate on the fingerprints.

  • Deduplication

    1. Select critical RFP value
      • Record the positions whose RFPs are equal to the critical RFP value
    2. Select “m” as the parameter of the solution
      • Different m gives different sets of RFPs, and different locations of the RFPs that match the critical RFP value (m affects the number of RFPs produced)
    3. Use the critical RFP value to divide chunks

      • for each file, we record the patterns that match the critical RFP value

    • RFP is used for determining chunk boundaries
      • The chosen set of fingerprints creates anchor points
      • It results in variable-sized chunks
      • Most importantly, it is content-dependent

Summary

Given an input data stream (a large file or an input stream to a file system)

  1. Chunking: divide the stream into chunks
    • Fixed-size chunks or variable-size chunks (by RFP)
  2. Generate a fingerprint for each chunk by cryptographic hash (e.g., SHA-1)
  3. For each chunk, check if it has been stored by checking if the fingerprint has been recorded
    • If yes, there is no need to store the chunk, but remember the reference (location) of the chunk
    • If no, store the chunk and record the fingerprint
  • Evaluation metric: Space savings are measured by deduplication ratio
    • Raw logical data size / physical data size (higher means better)

Two key components:

  1. Fingerprint index: a key-value store that keeps track of the fingerprint and its reference
  2. File recipe: a manifest file that records the fingerprints and references of all chunks for each file

Indexing

Maintain all fingerprints of existing chunks

  • Index Structure

    • Keep all mappings of (fingerprint, chunk address, other info)
    • Data structures: hash tables, red-black-tree, etc.
      Similar to key-value stores
      • key: fingerprint (to identify a chunk)
      • values: chunk address (physical location), size of chunk, how many chunks (for deletion), etc.
  • Write

    • If a chunk is new (cannot be deduplicated)
      • Write the chunk to the disk
      • Add (fingerprint, chunk address) to the index structure
    • If a chunk can be deduplicated
      • Read the chunk address and update the chunk address in the file’s indexing structure (file recipe)
  • Option 1: Index Structure in RAM
    Putting whole index structure in RAM, then it needs large amount of RAM
    1TB disk content

    If we want to store 1TB disk content, we need at least 4GB of memory, which is significant

  • Option 2: Index Structure on Disk
    Updating each data chunk and its index keeps the disk head moving, which hurts performance

Bloom Filter

Probabilistic data structure to decide if a key exists in a set

  • 2 Operations:

    1. Insert(key)

      • Set bit positions $h_1(i), \dots, h_k(i)$ to $1$
    2. Lookup(key)

      • Lookup(key) = false → item guaranteed not in the set
      • Lookup(key) = true → item probably in the set
    • False positive:

      Probability thay a bit is not set after 1 insert with k hash functions:

      Probability that a bit is not set after n inserts in a Bloom filter of size m bits using k hash functions:

      Probability that a bit is set after n inserts:

      False positive probability:

      For a given m and n, the value of k that minimizes the probability f is:

      Given fixed n and f, the minimum m is (in bits, / 8 if bytes):

    • Example:

      1. Much smaller than keeping all fingerprints in memory
      2. Independent of the fingerprint size
  • Bloom Filter in Deduplication

    • Two-level index structure

      • Bloom filter in memory
        Check if a fingerprint has been (probably) inserted.
      • Full chunk index mappings on disk
        Check if a fingerprint has been actually inserted
    • Bloom filter for fingerprints

      • Lookup(fp) = false → No chunk index lookup needed
      • Lookup(fp) = true → Lookup on disk required

      Idea: Whenever decide we need to do the deduplication on chunk, we first do the lookup

      • if the lookup fingerprint is false, then I can guarantee that this chunk has not been stored, because if it has been stored, then the return must be true.
      • If the lookup fingerprint is true, then still need to look up the full chunk index on disk as it may be a false positive.
        So, lookup fingerprint is false usually happens when a chunk is new, which is helpful when writing a lot of new chunks. However, backup have lots of redundant data and most of the redundant chunks have been stored before (not new chunk) which still need the full chunk indexing on disk.

Sparse Indexing

  • Chunk Locality: tendency for chunks in backup data streams to reoccur together
    Example: if the last time we encountered chunk A, it was surrounded by chunks B, C, and D, then the next time we encounter A (even in a different backup) it is likely that we will also encounter B, C, or D nearby

  • Segments

    • Divide data stream into chunks
    • Each segment consists of a number of chunks
    • Segment size in order of 10MB
  • Hooks

    • Each segment is characterized by hooks, which are fingerprints of chosen chunks (e.g., Within a segment, there are 2500 chunks, sample some chunk and pick one to generate the fingerprint called hook)
    • All hooks are part of in-memory index (called sparse index)
    • Metadata of a segment, including fingerprints for all chunks, isstored in a manifest
  • Given an incoming segment, check the hooks in the sparse index, and identify already stored segments that are most similar (call them champions — segments with highest number of hooks in common)

    • Champions are segments with highest number of hooks in common
    • Load manifests of selected champions into memory and deduplicate chunks

Extreme Binning

  • File similarity: two backup streams share files with similar chunks

    e.g., If file A has a set of chunks in one backup window, then in the next backup window, file A still contains most of the chunks
  • Associate one representative fingerprint (the minimal fingerprint) to characterize a complete file

  • Broder’s Theorem
    Consider two sets S1 and S2, with H(S1) and H(S2) being the corresponding sets of hashes of the elements of S1 and S2, respectively, where H is chosen uniformly and at random from a min-wise independent family of permutations. Let min(S) denote the smallest element of the set of integers S.

  • Process

    1. To write files (deduplication), each file is chunked and all fingerprints are calculated and find the representative fingerprint
    2. If the representative fingerprint NOT in primary index (cannot find similar files)
      • Store all chunks
      • Create new bin and store all metadata
    • Else
      1. Compute the SHA-1 value
      • If SHA-1 value for complete file is NOT identical (which means some chunks may be modified)
        • Load corresponding bin from secondary storage
        • Store all chunks not in bin
        • Update metadata in bin and store bin
        • Do not update the whole file hash

Read Performance

Fragmentation

Inline deduplication: check if every new chunk can be deduplicated with any existing chunk on the write path: If chunk exists: reference it; If new: add to last write position

Data is no longer sequentially stored, so at restore time, many I/O seeks

  • Offline deduplication

    • Idea: choose the older chunks to remove instead of the latest chunks.
    • In inline deduplication, it always remove the new chunk because the chunk have already been stored.
    • In offline deduplication, it can write the redundant chunks first and remove the existing duplicate chunks at the background (i.e., remove the older one), which can ensure that the latest backup is always sequentially stored.
      • Drawback: Extra I/Os on writing redundant chunks and remove redundant chunks
  • Chunk Rearrangement

    • Similar to how disk fragmentation is resolved
    • But finding a good chunk layout is difficult because chunks are shared across disk
    • Expensive I/O

Containers

  • Deduplication often works on small-size chunks (e.g., 4KB or 8KB)
  • Chunks are grouped into containers, typically of size 4MB or 8MB
  • Containers form the basic units of read/write operations
    • Reading a chunk → reading the whole container (Overhead of reading the whole container is small)
  • Capping

    • Container: a file that holds all chunks
    • Break a backup stream into segments

    • Idea: limit the number of old containers that a segment can refer to

      1. Break a data stream into fixed size segments (20MB)
      2. Determine which chunks are already stored and in which containers
      3. Choose up to T containers (threshold: capping level), ranked by how many chunks they contain, breaking ties to favor the most recent containers
      4. Any duplicate chunks, if not referring to the T containers, are treated as new chunks and be added to the storage (even it is duplicated)

    • Drawback: two extra chunks copies, as there are two chunks would perform deduplications originally, but now we treat them as new chunks
    • Speeded up 2-6X, but consists of 8% deduplication loss
  • Forward Assembly Area
    • Idea:
      • Future knowledge of accesses can be exploited to improve both caching and prefetching
      • Restore is deterministic
    • How it works:
      • Prefetch next M bytes into an in-memory buffer
      • Assemble the M bytes in sequence and return it to the client

Security

Convergent Encryption

For the sensitive data, we would like to encrypt them. However, if we encrypt them directly, but the encrypted files become scrambled and cannot be deduplicated

  • Ideas:

    • Encrypt on a per-chunk basis
    • Use hash value as the cryptographic key

      • Encryption: $C = E_{H(P)}(P)$
      • Decryption: $D_{H(P)}(C)$
    • Use the key $H(P)$ to encrypt and decrypt while the key is unreverable which seems to be safe

      1. If two chunks (in plain) can be deduplicated, then after convergent encryption, they can still be deduplicated
      2. The hashes are securely protected
      3. Outsiders cannot decrypt the content without knowing the hashes $H(P)$
  • Notice:
    Suppose you know that a plaintext chunk P must be an integer from 1 to 100,000. Given a ciphertext chunk C, can you tell what is its original plaintext chunk P?

    • Brute Force Attack: Try to encrypt different plaintext C’ to search one match the ciphertext chunk C.
  • Convergent encryption is vulnerable to offline brute-force dictionary attack

    1. Don’t use the hash as the key
    2. Use a key that is deterministically derived from some one-way function for each chunk, but looks random to outsiders
    • Server-Aided Encryption

      • Key generation: Client sends a fingerprint f to the key manager
      • Key manager generates a key K by: K = OWF(f, s), where OWF(.) is a one-way function and s is a random seed that known to the key manager only
    • Extensions

      1. Rate-limiting key generation requests (avoid online brute-force attacks)
      2. Blinded key generation: key manager can generate the key without knowing f

Side-Channel Attacks

The attacker begins uploading a file and observes whether deduplication occurs. If there’s deduplication,the attacker knows the file copy exists

- Generalized to infer file contents: performing a brute-force attack by trying all possible contents of a file

The root cause is Dropbox does the deduplication on the client side, the client will check whether the same file exists, and if yes don’t upload the file. Therefore, should do the deduplication on the cloud side to prevent the clients from observing the deduplication patterns

DropBox Attacks

  1. Hash Value Manipulation Attack
    Dropbox clients reply on some third partie encryptal softwares to do the encryption, which can be replace with other softwares. Dropbox clients do not verify integrity, so the hacker can modify the software with their own fake hash value

    • If the fake hash doesn’t exist on Dropbox server:

      • Server requests the file from client
      • Nothing happens
    • If the fake hash exists:

      • Server doesn’t ask for the content
      • Instead, the server links the corresponding file/chunk to the hacker’s Dropbox account
      • Hacker can access the file/chunk which belongs to others (own the file)
  2. Stolen Host ID Attack
    Dropbox will assign a unique host ID (a 128-bit key) for client authentication (such that the clients can access the account without re-typing the password)

    • If the host ID is stolen, all files of the user account can be accessed by the attacker
  1. Direct Up/Download Attack

    • Download

      • Transmission protocol is built upon HTTPS
        • As POST data: SHA-256 value & a valid host ID
      1. No check if chunk is linked with account! (Any valid host ID is fine!)
      2. Dropbox hardly deletes any data
      3. Same effect as hash manipulation attack, but less stealthy
      4. Can be detected / prevented by Dropbox
    • Upload

      • Same as retrieval, but for storing chunks
      1. Create Online slack space
      2. Push data to other people’s Dropbox