Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

CAP Theorem (Hello Interview) のメモ

0
Last updated at Posted at 2026-05-02

この記事で学んだことをメモる。

Summary

C = consistnecy
A = availability
P = partition tolearance

Strong Consistency が求められる例

深掘りする必要はないが、うまく説明することが必要。
(Does read always have to see the latest write?)

TODO: 以下のstrong consistency が求められる例を簡潔に説明する。(youtube 動画)

  • 飛行機の座席予約 (動画)
  • アマゾンの商品購入 (動画)
  • 株の売買 (動画)
  • Ticket Master (記事)
  • Tinder のマッチング (記事)

Strong Consistency の保証方法

以下に詳しい。

Postgres の場合

  • Pessismistic Locking (SELECT FOR in a transaction)
  • Optimistic Concurrency Control (UPDATE WHERE version = x + retry mechanism)
  • Serializale isolation (BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; + retry mechanism)

📝 Serializale (実行結果の直列性) は Linearizable (操作の直列性 = 現実時間の順序と一致しているか)の保証を含まない。実際に中で順序待ちのキューができるわけでもない。あたかも直列に実行されたかのように互いに影響を与えないように行われ、もし矛盾が生じればエラーが発生される、ということである。

DynamoDB の場合

DynamoDBはstrong consistencyを保障する。
TODO: どうやって?item100個までだっけ? See my DynamoDB Qiita page?

様々な consistency level

  1. Strong Consistency: all reads reflect most recent write
  2. Causal Consistency: related events appear in order
  3. Read-your-writes Consistency: user sees their own updates
  4. Eventual Consistency: updates will propagate eventually
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?