Skip to content
Son's blog
All writing

Building a database on S3

Paper notes · Source updated

Building a database on S3

Summary

in scope

out of scope

what are the advantages of building on S3?

what are the limitations?

Problems

(answers at the end)

  1. problem: reading from S3 at best at 100ms (100x-1000x local disk) is too slow for a database.
  2. problem: low bandwidth with small objects.
  3. problem: S3 uses last update wins policy.
  4. problem: the system is eventually-consisten and it can take undetermined amount of time before updates of one client are visible to others.
  5. problem: a PU queue can only be checkpointing by 1 client at a time.

Terms

Details

how many levels of consistency is designed?

  1. naive
  2. basic
  3. monotonicity
  4. atomic

what is the Naive approach?

basic

monotonicity

atomicity

how different levels of consistency affects latency and cost?

Transaction running time

how to deal with concurrent clients update records on the same page?

  1. coordinate the updates -> limit the scalability

coordinate updates = synchronize updates

s3 vs disk

why only 1 PU queue can be used at a time?

commit protocol

What happens if a client crashes during a commit?

why are log records idempotent?

what is a redo log record? how is it different from undo?

a table user with userid=1, username=before
a SQL update executed in txn T1 `UPDATE user where userid=1 SET username='after'

redo: txn=t1, table=user, rowid=1, column=username, value='after', action=update
undo: txn=t1, table=user, rowid=1, column=username, value='before', action=update

in what case atomicity is violated?

how to ensure atomicity?

todo

what happens if a PU queue is checkpointed by multiple clients?

what is the protocol to synchronize concurrent update transactions then?

what is a checkpoint strategy? what are the options? what is proposed by the paper?

Transactional properties

Which specific transactional properties this section provides implementation strategies for? - atomicity and - all client-side consistency levels - monotonic reads - monotonic writes - read your writes - write follows read
Which ACID properties are impractical to achive? - Isolation and Strong Consistency.
Why is strong consistency considered different from client-side consistency? - Strong consistency refers to the whole system, every clients scope. This guarantees that every clients agree on a global order of operations. This often means Linearizability`` for operations and `Serializability` for transactions. - Client-side consistency refers to only 1 client and its sequence of operations. This guarantees only the consistency for one client operations, not globally for every clients.
What is the mechanism to ensure atomicity? ``` 3 steps for commit operation. Step 2 and 3 can be async. 1. send all log records to ATOMIC queue. Commit record sent last. 2. Send all log records to PU queues. 3. Delete commit record from ATOMIC queue. ```

Answers

  1. solution: aggresive caching.
  2. solution: batching objects into big pages.
  3. solution: all commit protocol ensures there is enough time (seconds) between updates to same objects.
  4. solution: the eventual time can be capped by checkpointing. Tuning checkpoint interval (trade-off increasing cost ~ checkpoint more frequent) to e.g. 10 seconds -> all clients must see updates after 10 seconds.
  5. solution: using multiple PU queues.