Slide 1

Slide 1 text

ύϥϨϧͷάϧʔϓ௨࿩Λࢧ͑Δ ٕज़ελοΫͱઃܭࢥ૝ TECH STAND #4 ৗ࣌઀ଓSNS~ϥΠϒ഑৴ج൫Λࢧ͑Δٕज़~
 Presented by @yoheimuta Ϣʔβʔ1ਓ͋ͨΓͷ1೔ฏۉ ௨࿩͕࣌ؒ3࣌ؒҎ্

Slide 2

Slide 2 text

ɹύϥϨϧͷ঺հ iOS ͱ Android Ͱ 100ສ DL Ϣʔβʔͷ 70 % ͕ Zੈ୅(~ 24ࡀ) ᶃ༑ୡͱू·Δ ᶄ௨࿩͢Δ ᶅίϯςϯπͰ༡Ϳ ݄ؒ૯௨࿩࣌ؒ͸ 4 ԯ෼Ҏ্ Ϣʔβʔͷ 1 ೔ͷฏۉ௨࿩࣌ؒ͸ 3 ࣌ؒ Apple Store ධՁ͸ 4.7/5 (2ສ݅) ༑ୡͱ12࣌ؒ௨࿩Λͭͳ͛ͨ··΋௝͘͠ͳ͍ ͦͷͱ͖ͷؾ෼ʹ߹ΘͤͯɺYouTube Λ
 ಉ࣌ࢹௌͨ͠Γɺେ෋߽Λͯ͠༡Ϳ

Slide 3

Slide 3 text

@yoheimuta ήʔϜ ޿ࠂ഑৴ɾSDK CtoC ίϚʔε ৗ࣌઀ଓSNS ύϥϨϧͰ࠷ۙ
 ΍ͬͯͨ͜ͱ ͜Ε·Ͱͷ ΩϟϦΞ https://rubyweekly.com/issues/549


Slide 4

Slide 4 text

ຊ೔ͷςʔϚ • ύϥϨϧͷάϧʔϓ௨࿩ʢϥΠϒ഑৴ʣͷج൫ʹ͍ͭͯ • Ի੠ͱө૾Λѻ͏ϝσΟΞαʔόʔ • ͦΕҎ֎ͷσʔλΛѻ͏ API αʔόʔ • ύϥϨϧͷάϧʔϓ௨࿩ج൫Ͱେࣄʹ͍ͯ͠Δ͜ͱ • Ұ؏ͨ͠௨࿩ঢ়ଶΛಘΔͨΊͷΞʔΩςΫνϟͱͦͷมભʹ͍ͭͯ

Slide 5

Slide 5 text

ύϥϨϧͷάϧʔϓ௨࿩ͱ͸ 1) ೖ͍ࣨͨ͠ϧʔϜ Λλοϓ͢Δ

Slide 6

Slide 6 text

ύϥϨϧͷάϧʔϓ௨࿩ͱ͸ 1) ೖ͍ࣨͨ͠ϧʔϜ Λλοϓ͢Δ 2) ௨࿩ʹࢀՃ͢Δ

Slide 7

Slide 7 text

ύϥϨϧͷάϧʔϓ௨࿩ͱ͸ 1) ೖ͍ࣨͨ͠ϧʔϜ Λλοϓ͢Δ 2) ௨࿩ʹࢀՃ͢Δ 3) ϧʔϜΛୀࣨ͢Δ

Slide 8

Slide 8 text

ύϥϨϧͷάϧʔϓ௨࿩ͱ͸ 1) ೖ͍ࣨͨ͠ϧʔϜ Λλοϓ͢Δ 2) ௨࿩ʹࢀՃ͢Δ 3) ϧʔϜΛୀࣨ͢Δ 4) ௨࿩͕ऴΘΔ

Slide 9

Slide 9 text

ύϥϨϧͷάϧʔϓ௨࿩ͱ͸ • ಛఆͷϧʔϜʹೖࣨ͢Δͱͦ͜Ͱάϧʔϓ௨࿩͕࢝·Δ • ϥΠϒ഑৴ͷจ຺Ͱ͍͏ͱɺશһ͕ίϥϘϥΠϒ഑৴͍ͯ͠Δͱଊ͑Δ͜ ͱ͕Ͱ͖Δ • αʔόʔΛ௨ͯ͠ɺϢʔβʔؒͰԻ੠ʢϝσΟΞʣͷ΍ΓऔΓ͕ߦΘΕΔ

Slide 10

Slide 10 text

ύϥϨϧͷάϧʔϓ௨࿩ج൫

Slide 11

Slide 11 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧͷϑϩʔ 1) ઀ଓ͢Δ

Slide 12

Slide 12 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧͷϑϩʔ 1) ઀ଓ͢Δ 2) ೖࣨΛ஌ΒͤΔ HTTPɺWebSocketɺ Push ௨஌ɺͦΕͧΕͰ ࠷৽ͷঢ়ଶ͕൓ө ༑ୡͷ Bob ͕ಉ͡ϧʔϜʹೖ ͍ࣨͯ͠Ε͹Ի੠͕ྲྀΕͯ͘Δ

Slide 13

Slide 13 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧͷϑϩʔ 1) ઀ଓ͢Δ 2) ೖࣨΛ஌ΒͤΔ 3) ੾அ͢Δ ༑ୡͷ Bob ͕ಉ͡ϧʔϜʹೖ ͍ࣨͯ͠Ε͹Ի੠͕ྲྀΕͯ͘Δ HTTPɺWebSocketɺ Push ௨஌ɺͦΕͧΕͰ ࠷৽ͷঢ়ଶ͕൓ө

Slide 14

Slide 14 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧͷϑϩʔ 1) ઀ଓ͢Δ 2) ೖࣨΛ஌ΒͤΔ 3) ੾அ͢Δ 4) ୀࣨΛ஌ΒͤΔ ༑ୡͷ Bob ͕ಉ͡ϧʔϜʹೖ ͍ࣨͯ͠Ε͹Ի੠͕ྲྀΕͯ͘Δ HTTPɺWebSocketɺ Push ௨஌ɺͦΕͧΕͰ ࠷৽ͷঢ়ଶ͕൓ө

Slide 15

Slide 15 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧϑϩʔ 1) ઀ଓ͢Δ 2) ೖࣨΛ஌ΒͤΔ

Slide 16

Slide 16 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧϑϩʔ 1) ઀ଓ͢Δ 2) ೖࣨΛ஌ΒͤΔ 3) ੾அ͢Δ 4) ୀࣨΛ஌ΒͤΔ

Slide 17

Slide 17 text

ύϥϨϧͷάϧʔϓ௨࿩ॲཧϑϩʔ 1) ઀ଓ͢Δ 2) ೖࣨΛ஌ΒͤΔ 3) ੾அ͢Δ 4) ୀࣨΛ஌ΒͤΔ 1->2ɺ3->4 Λਖ਼֬ ͔ͭૉૣ͘ߦ͍͍ͨ 🙏

Slide 18

Slide 18 text

ύϥϨϧͷάϧʔϓ௨࿩ঢ়ଶ؅ཧ Connection Ͱ ௨࿩ঢ়ଶΛ؅ཧ Original

Slide 19

Slide 19 text

ύϥϨϧͷάϧʔϓ௨࿩ঢ়ଶ؅ཧ Connection Ͱ ௨࿩ঢ়ଶΛ؅ཧ ෳ੡ͨ͠ɺ௨࿩ঢ় ଶΛ؅ཧ Copy Original

Slide 20

Slide 20 text

ύϥϨϧͷάϧʔϓ௨࿩ঢ়ଶ؅ཧ Alice ͷ௨࿩ঢ়ଶ͕
 ೋॏ؅ཧ͞Ε͍ͯΔ Connection Ͱ ௨࿩ঢ়ଶΛ؅ཧ ෳ੡ͨ͠ɺ௨࿩ঢ় ଶΛ؅ཧ Copy Original ิ଍: ϧʔϜ͝ͱʹઐ༻αʔόʔΛ ׂΓ౰ͯͯɺͦͷ 1 ୆͕઀ଓ؅ཧ ͱϩδοΫΛ·Δͬͱ࣮૷͢ΔΑ ͏ͳ࡞Γʢex. ϦΞϧλΠϜήʔϜ αʔόʔʣͰ͸ͳ͍ͱ͍͏ҙຯ

Slide 21

Slide 21 text

ύϥϨϧͷάϧʔϓ௨࿩ঢ়ଶ؅ཧ Connection Ͱ ௨࿩ঢ়ଶΛ؅ཧ ෳ੡ͨ͠ɺ௨࿩ঢ় ଶΛ؅ཧ Copy Original Q. ௨࿩ঢ়ଶͷೋॏ؅ཧͷͲ ͕͜໰୊ͳΜ͚ͩͬʁ

Slide 22

Slide 22 text

ύϥϨϧͷάϧʔϓ௨࿩ঢ়ଶ؅ཧ Connection Ͱ ௨࿩ঢ়ଶΛ؅ཧ ෳ੡ͨ͠ɺ௨࿩ঢ় ଶΛ؅ཧ Copy Original A. ෼ࢄγεςϜʹ ͓͚ΔҰ؏ੑͷ
 ໰୊͕ൃੜ͢Δ Q. ௨࿩ঢ়ଶͷೋॏ؅ཧͷͲ ͕͜໰୊ͳΜ͚ͩͬʁ

Slide 23

Slide 23 text

෼ࢄγεςϜʢDistributed Systemʣ ෼ࢄγεςϜͱ͸ɺओʹωοτϫʔΫʹΑΓ઀ଓ͞Εͨෳ਺ͷίϯϐϡʔλ ʹΑͬͯߏ੒͞ΕͨγεςϜͷ͜ͱͰ͋Δɻ
 ରٛޠ͸ɺूதγεςϜʢӳޠ: central system, centralized systemʣɻ “ — https://ja.wikipedia.org/wiki/෼ࢄγεςϜ ෼ࢄγεςϜ͸ɺϢʔβʹରͯ͠୯ҰͰटඌҰ؏ʢcoherentʣͨ͠γεςϜ ͱͯ͠ݟ͑Δಠཱͨ͠ίϯϐϡʔλͷू߹Ͱ͋Δ “ — λωϯό΢Ϝ&ϑΝϯɾεςΟʔϯஶ, ਫ໺Β༁
 ෼ࢄγεςϜ ݪཧͱύϥμΠϜ

Slide 24

Slide 24 text

Ұ؏ੑ(Consistency) Ұ؏ੑͱ͸ɺ෼ࢄγεςϜͰෳ੡Λͨ͠ࡍʹൃੜ͢Δ
 ໰୊Ͱ͢ɻ
 
 Ұ؏ੑ͕ʮ͋Δʯͱ͸ɺෳ੡σʔλͷ͋Δ෼ࢄγεςϜͰɺ ؍࡯ऀ͔ΒʮҰҙͳσʔλΛอ͍࣋ͯ͠Δ༷ʹݟ͑Δʯঢ়ଶ Λࢦ͠·͢ɻ
 
 Ұ؏ੑ͕ʮͳ͍ʯͱ͸ɺෳ੡σʔλͷ͋Δ෼ࢄγεςϜͰɺ ؍࡯ऀ͔Βʮ୯ҰσʔλΛอ͍࣋ͯ͠ͳ͍༷ʹݟ͑Δʯঢ়ଶ Λࢦ͠·͢ɻ “ — https://techblog.yahoo.co.jp/architecture/2015-04-ditributed-consistency/
 ෼ࢄγεςϜͷҰ؏ੑʹؔ͢Δಈ޲ʹ͍ͭͯ

Slide 25

Slide 25 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 4) ੾அ͢Δ 3) ೖࣨΛ஌ΒͤΔ 6) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 5) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν

Slide 26

Slide 26 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 4) ੾அ͢Δ 3) ೖࣨΛ஌ΒͤΔ 6) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 5) ୀࣨΛϦΫΤετ ΄΅ϦΞϧλΠϜ
 ʹಉظ͕औΕΔ👍 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν

Slide 27

Slide 27 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 4) ੾அ͢Δ 3) ೖࣨΛ஌ΒͤΔ 6) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 5) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν ⚠ ΫϥΠΞϯτʹ
 ҟৗʢΫϥογϡɾ ճઢஅʣ͕ൃੜ͢Δ ͱɺഁ୼

Slide 28

Slide 28 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 5) ੾அ͢Δ 4) ೖࣨΛ஌ΒͤΔ 8) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 6) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν 3) ઀ଓΛ
 ௨஌͢Δ 7) ੾அΛ
 ௨஌͢Δ 2. ϝσΟΞαʔόʔ͔Βͷ Πϕϯτ௨஌ͰҰ؏ੑΛ֬ อ͢ΔΞϓϩʔν

Slide 29

Slide 29 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 5) ੾அ͢Δ 4) ೖࣨΛ஌ΒͤΔ 8) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 6) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν 3) ઀ଓΛ
 ௨஌͢Δ 7) ੾அΛ
 ௨஌͢Δ 👍 ΫϥΠΞϯτʹ
 ҟৗ͕ൃੜͯ͠΋ɺ Ұ؏ੑ͕ಘΒΕΔ 2. ϝσΟΞαʔόʔ͔Βͷ Πϕϯτ௨஌ͰҰ؏ੑΛ֬ อ͢ΔΞϓϩʔν

Slide 30

Slide 30 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 5) ੾அ͢Δ 4) ೖࣨΛ஌ΒͤΔ 8) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 6) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν 3) ઀ଓΛ
 ௨஌͢Δ 7) ੾அΛ
 ௨஌͢Δ ⚠ Πϕϯτ௨஌͕ ϩετɾେ෯஗Ԇ͢ ΔՄೳੑ͕͋Δ 2. ϝσΟΞαʔόʔ͔Βͷ Πϕϯτ௨஌ͰҰ؏ੑΛ֬ อ͢ΔΞϓϩʔν

Slide 31

Slide 31 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 5) ੾அ͢Δ 4) ೖࣨΛ஌ΒͤΔ 8) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 6) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν 2. ϝσΟΞαʔόʔ͔Βͷ Πϕϯτ௨஌ͰҰ؏ੑΛ֬ อ͢ΔΞϓϩʔν 3) ઀ଓΛ
 ௨஌͢Δ 7) ੾அΛ
 ௨஌͢Δ 3. ϝσΟΞαʔόʹఆظత ʹঢ়ଶΛ໰͍߹ΘͤͯҰ؏ ੑΛ֬อ͢ΔΞϓϩʔν ఆظόονͰ ิਖ਼͢Δ

Slide 32

Slide 32 text

௨࿩ঢ়ଶͷҰ؏ੑΛߟྀͨ͠ΞʔΩςΫνϟ 2) ઀ଓ͢Δ 5) ੾அ͢Δ 4) ೖࣨΛ஌ΒͤΔ 8) ୀࣨΛ஌ΒͤΔ 1) ೖࣨΛϦΫΤετ 6) ୀࣨΛϦΫΤετ 1. ΫϥΠΞϯτଆͰҰ؏ੑ Λ֬อ͢ΔΞϓϩʔν 2. ϝσΟΞαʔόʔ͔Βͷ Πϕϯτ௨஌ͰҰ؏ੑΛ֬ อ͢ΔΞϓϩʔν 3) ઀ଓΛ
 ௨஌͢Δ 7) ੾அΛ
 ௨஌͢Δ 3. ϝσΟΞαʔόʹఆظత ʹঢ়ଶΛ໰͍߹ΘͤͯҰ؏ ੑΛ֬อ͢ΔΞϓϩʔν ఆظόονͰ ิਖ਼͢Δ 👍 Πϕϯτ͕ϩετ͠ ͯ΋݁Ռ੔߹ੑΛ୲อ Ͱ͖Δ

Slide 33

Slide 33 text

݁Ռ੔߹ੑ(Eventual Consistency) ݁Ռ੔߹ੑͱ͸…Ұ࣌తͳҰ؏ੑ͕อͨΕ͍ͯͳ͍ঢ়ଶΛڐ༰͠ɺ࣌ؒͷܦաͱͱ΋ ʹ࠷ऴతʹҰ؏ੑ͕อͨΕ͍ͯΔঢ়ଶʹҠߦ͢ΔҰ؏ੑϞσϧͰ͢ɻ ݁Ռ੔߹ੑ͸ɺଟ͘ͷNoSQLͳͲͷ෼ࢄγεςϜͷ࣮૷Ͱ࠾༻͞Ε͍ͯΔҰ؏ੑϞσ ϧͰɺ࣮૷͕༰қͳͷ͕ར఺Ͱ͢ɻ݁Ռ੔߹ੑͷ෼ࢄγεςϜͱͯ͠͸ɺ DNSʢDomain Name Systemʣ΍ɺ෼ࢄσʔλϕʔεͰ͸લड़ͨ͠Amazon Dynamo΍ CassandraͳͲ͕୅දతͰ͢ɻ “ — https://techblog.yahoo.co.jp/architecture/2015-04-ditributed-consistency/
 ෼ࢄγεςϜͷҰ؏ੑʹؔ͢Δಈ޲ʹ͍ͭͯ

Slide 34

Slide 34 text

·ͱΊ: ύϥϨϧͷάϧʔϓ௨࿩Λࢧ͑Δٕज़ ελοΫͱઃܭࢥ૝ • ύϥϨϧͷάϧʔϓ௨࿩ج൫͸ɺϝσΟΞαʔόʔͱ API αʔόʔͰߏ੒ • API αʔόʔ͸ GCP / GKE ্ͰՔಇ͍ͯ͠Δ • ΫϥΠΞϯτɺϝσΟΞαʔόʔɺAPI αʔόʔͷ͏ͪɺࠓճ͸ϝσΟΞ αʔόʔͱ API αʔόʔؒͰ௨࿩ঢ়ଶͷ݁Ռ੔߹ੑΛ֬อ͢ΔΞʔΩςΫ νϟΛ঺հ • ۩ମతͳ࣮૷্ͷ഑ྀ΍ɺΫϥΠΞϯτͱϝσΟΞαʔόʔͰͷ௨࿩ঢ় ଶͷҰ؏ੑΛ֬อ͢ΔͨΊͷऔΓ૊Έʹ͍ͭͯ͸ɺϖʔδ਺ͷ౎߹্ׂ Ѫͨ͠

Slide 35

Slide 35 text

@yoheimuta ex. ϑϦʔΫ Ξ΢τ @cou929 ex. hey ಸྑ୓ւ ࠓճൃදͨ͠ج൫ ͷϝΠϯ࣮૷ऀ ࢁాਸਔ ex. LINE ླ໦ݴੜ ex. BASE @jarinosuke ex. ϝϧϖΠ ɹύϥϨϧ͸ੵۃ࠾༻தͰ͢ 😎 • ٕज़໘Ͱಛʹ΍Γ͍ͨ͜ͱ • ͜͜·Ͱ঺հͨ͠Α͏ͳ؍఺ ΛؚΊɺ௨࿩ج൫ΛΑΓ҆ఆ ͤ͞Δ͜ͱ • ௨࿩͠ͳ͕ΒଞͷεϚϗήʔ ϜΛͯ͠΋ʰམͪͳ͍ʱʰϥ ά͘ͳΒͳ͍ʱʰిྗΛফඅ ͠ͳ͍ʱΛ௥ٻ͢Δ͜ͱ • ϘΠνΣϯͳͲ໘ന͍Ի੠ػ ೳΛ࡞͍ͬͯ͘͜ͱ ۀ຿ҕୗͰख఻ͬͯ͘Ε ͍ͯΔ EN ͕ 8 ໊