Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Created July 27, 2016 06:28
Show Gist options
  • Save yuroyoro/55e1f4fb17107fbe1250805ee53bd844 to your computer and use it in GitHub Desktop.
Save yuroyoro/55e1f4fb17107fbe1250805ee53bd844 to your computer and use it in GitHub Desktop.
UberのPostgresqlからNoSQL on MySQLへの移行を読んでざっくりまとめた

Why Uber Engineering Switched from Postgres to MySQL - Uber Engineering Blog のまとめ

Posgresqlだと

  • pgは追記型なので少しの更新でも多くのdiskへのwriteがおきる
  • カラムを一つ更新しただけで多くのindexの書き換えが起こる
  • よって、replicationはWALを送るので更新が多いとWALが大量に送られる
  • repcliationでは物理的なdiskの変更を送る
  • DC間でレプリするときつい
  • bugがあってreplica間でMVCCの不整合が起きる
  • masterとreplica同じdisk上のデータ構成を共有するのでupgradeがつらい
  • cache readはsyscallとosのpage cache経由なので重い
  • 1コネクション1プロセスなので大量コネクションに弱い

MySQLだと

  • MVCCは古いレコードをrollback segmentにcopyするだけ
  • よって更新でindexの書き換えが起こらない
  • replicationは論理的な変更内容を送るだけ
  • replicaでもMVCCの不整合が起きない
  • BufferPoolはuserlandにあるのでカスタマイズ可能
  • 1processでmulti-threadでコネクションを捌くのでoverheadが少ない
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment