Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NoSQLの歴史にみる、Cloud Firestoreとの正しい付き合い方

Naomichi Okada
September 01, 2018

NoSQLの歴史にみる、Cloud Firestoreとの正しい付き合い方

Naomichi Okada

September 01, 2018
Tweet

More Decks by Naomichi Okada

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • Naomichi OkadaʢԬా௚ಓʣ / @na0m1chikun • ౦ژେֶम࢜2೥ʢԽֶ޻ֶʣ → தୀ

    • ελʔτΞοϓͰiOSத৺ʹ։ൃશൠ΍ͬͯ·͢ • recruit-lifestyle/FeedbackMan
  2. Firebase Cloud Firestore • Firebase ͔Β2017.10ʹൃදɺݱࡏ΋β൛ • Firebase Realtime Database

    ͷ࣍ੈ୅൛ͱ͍͏ݟํ͕ڧ͍ • υΩϡϝϯτࢦ޲ͷ NoSQL σʔλϕʔε • ಺෦తʹ͸ GCP Cloud Datastore
  3. RDB͸ACIDಛੑΛ࣋ͭ • Atomicity: ݪࢠੑ
 τϥϯβΫγϣϯͷؚ·ΕΔૢ࡞͸ɺશͯߦΘΕΔ or શ͘ߦΘΕͳ͍ ͷ͍ͣΕ͔Ͱ͋Δɻ • Consistency:

    Ұ؏ੑ
 τϥϯβΫγϣϯ͕DBͷ੔߹ੑΛຬͨ͢͜ͱΛอূ͠ɺϧʔϧΛຬͨ͞ͳ͍΋ͷ͸ࣦഊ͢Δɻ • Isolation: ಠཱੑ
 τϥϯβΫγϣϯಉ࢜͸ޓ͍ʹӨڹΛ༩͑ͳ͍ɻ • Durability: Ӭଓੑ
 ίϯϐϡʔλγεςϜ͕Ϋϥογϡͯ͠΋ɺ੒ޭͨ͠τϥϯβΫγϣϯͷ݁Ռ͸ࣦΘΕͳ͍ɻ
  4. ෼ࢄγεςϜͷBASEಛੑ • Basically Available: جຊతʹͲΜͳ࣌Ͱ΋ಈ࡞͢ΔՄ༻ੑ • Soft-state: ৗʹ੔߹ੑΛอͭඞཁ͸ͳ͍ɻ֎෦ͷঢ়گʹԠͯ͡มԽ • Eventually

    Consistent: ࠷ऴతʹ͸੔߹ੑ͕อͨΕΔɺ݁Ռ੔߹ੑ
 • ੔߹ੑΛ؇΍͔ʹ͢Δ͜ͱͰɺ෼ࢄγεςϜʹΑΔεέʔϧΞ΢τΛՄೳʹ͢Δɺ
 େྔσʔλ࣌୅ͷάουϓϥΫςΟε

  5. CAPఆཧ • Consistency: ੔߹ੑ
 શͯͷϊʔυʹ͓͍ͯɺಉ࣌ʹಉ͡σʔλ͕ݟ͑Δɻ • Availability: Մ༻ੑ
 ো֐ʹΑΓɺੜଘϊʔυ͸μ΢ϯ͠ͳ͍ɻ୯Ұো֐఺͕ଘࡏ͠ͳ͍ɻ •

    tolerance to network Partitions: ෼அ଱ੑ
 ωοτϫʔΫͷ෼அʹରͯ͠ɺܧଓͯ͠ಈ࡞Λߦ͏ɻ
 • ͜ͷ3ͭͷཁૉͷ͏ͪɺ࠷େ2ͭ·Ͱ͔͠ಉ࣌ʹຬͨ͢͜ͱ͕Ͱ͖ͳ͍
  6. CA, CP, AP ܕͷಛ௃ • CAܕʢ੔߹ੑʴՄ༻ੑʣ
 Active-StandbyΫϥελߏ੒ΛऔΓɺωοτϫʔΫো֐࣌ʹ͸ยํΛ੾ΓࣺͯΔ
 ྫʣRDBશൠʢMySQL, PostgreSQL…ʣ •

    CPܕʢ੔߹ੑʴ෼அ଱ੑʣ
 ෼அ͞Εͨ2ͭͷΫϥελͷ͏ͪɺϊʔυ਺ͷଟ͍ํͷΈΛੜଘͤ͞ɺ੔߹ੑΛ֬อ
 ྫʣRedis, MongoDB, HBase • APܕʢՄ༻ੑʴ෼அ଱ੑʣ
 ෼அ࣌΋શͯͷϊʔυ͕ϦΫΤετΛडཧɺҰ࣌తʹ੔߹ੑ͕ࣦΘΕΔ͕ޙʹಉظ͢Δ݁Ռ੔߹ੑΛ΋ͭ
 ྫʣFirestore, Cassandra, CouchDB, Couchbase