Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

理想的なマイクロサービスアーキテクチャを目指す継続的改善 / Re-architecturin...

理想的なマイクロサービスアーキテクチャを目指す継続的改善 / Re-architecturing of Microservices #CNDT2019

CloudNative Days Tokyo 2019 で発表した資料です。

理想的なアーキテクチャを目指してマイクロサービスアーキテクチャを継続的に改善する「Re-architecturing」という取り組みについて話しました。

cf. https://cloudnativedays.jp/cndt2019/

Nao Minami

July 22, 2019
Tweet

More Decks by Nao Minami

Other Decks in Technology

Transcript

  1. ©2019 Wantedly, Inc. 3FBSDIJUFDUVSJOHPG .JDSPTFSWJDFT 22.Jul.2019 - Nao Minami (@south37)

    Wantedly, Inc. Cloud Native Days Tokyo 2019 ཧ૝తͳϚΠΫϩαʔϏεΞʔΩςΫνϟΛ໨ࢦ͢ܧଓతվળ
  2. ©2019 Wantedly, Inc. /BP.JOBNJ *OGSBTUSVDUVSF&OHJOFFS 8BOUFEMZ *OD (JU)VCTPVUI 5XJUUFSTPVUI ϚΠΫϩαʔϏεΞʔΩςΫνϟͷվળʹऔΓ૊Ή

     43&ͱͯ͠ͷ໾ׂʢαʔϏεͷ৴པੑʹ੹೚ʣ  ։ൃج൫ͱͯ͠ͷ໾ׂʢΤϯδχΞͷੜ࢈ੑʹ੹೚ʣ
  3. ©2018 Wantedly, Inc. 3FBSDIJUFDUVSJOHͷࡍʹߟ͑ͨ͜ͱ ʮݱঢ়ͷ໰୊఺ʯ͸ݟ͍͑ͯͨ w ໰୊఺7JTJUͱ͍͏ڊେϞϊϦε w ໰୊఺Ϣʔβʔ৘ใͱ͍͏ෳ਺ϚΠΫϩαʔϏεʹࢄΒ͹ͬͨ੹຿ ʮཧ૝తͳঢ়ଶʯ΋ݟ͍͑ͯͨ

    w 7JTJUͷ੹຿͕ద੾ͳϚΠΫϩαʔϏε΁ͱ෼ׂ͞Ε͍ͯͯཉ͍͠ w Ϣʔβʔ৘ใͷ੹຿͸ͭͷϚΠΫϩαʔϏε΁ͱू໿͞Ε͍ͯͯཉ͍͠ ʮݱঢ়ཧ૝ʯ΁ͱͲ͏Ҡߦ͢Δ͔͕՝୊ͩͬͨ w 3FBSDIJUFDUVSJOH͸େ͖ͳมߋͰ͋ΔͨΊɺ։ൃͷ೉қ౓͸ߴ͘ίετ͸େ͖͍ w ࢼߦࡨޡ͠ͳ͕ΒҠߦΛਐΊͨ
  4. ©2018 Wantedly, Inc. ϞϊϦε෼ׂͷεςοϓ ϞϊϦεͷதͰڥքΛ໌֬Խ w ίʔυΛಡΜͰཧղΛਂΊɺ੾Γग़͢΂͖ڥքΛݟ͚ͭΔ w ͜ͷஈ֊Ͱ੾Γग़͠ର৅ͷΫϥεɺϝιουΛܾఆ w

    ίʔυϕʔεͷϦϑΝΫλϦϯάΛߦ͍ɺϢʔεέʔεΛϝιουݺͼग़͠ͱͯ͠දݱ͢Δ w ͜ͷϝιουݺͼग़͕͠ɺޙʹ3FNPUF1SPDFEVSF$BMM 31$ ΁ͱஔ͖׵ΘΔ w ϢʔεέʔεΛຬͨ͢ඞཁ࠷௿ݶͷϝιουΛ༻ҙ͢Δͷ͕ॏཁʢૄ݁߹ͷ࣮ݱʣ ืू ืू ڥքΛ໌֬Խ ڥք͸΅΍͚͍ͯΔ
  5. ©2018 Wantedly, Inc. ϞϊϦε෼ׂͷεςοϓ 4IBSFEMJCSBSZΛར༻ͯ͠ ڞ௨ͷυϝΠϯϩδοΫ Λ࣋ͭϚΠΫϩαʔϏε࣮૷ w εςοϓͰఆٛͨ͠ΠϯλʔϑΣʔεΛ࣋ͭϚΠΫϩαʔϏεΛ࣮૷ w

    ϞϊϦεͱಉ͡ݴޠͰϚΠΫϩαʔϏεΛ࣮૷͢Δ৔߹͸ɺ4IBSFEMJCSBSZΛར༻ w ஈ֊తͳҠߦͷ࠷த΋ʮڞ௨ͷυϝΠϯϩδοΫΛ࣋ͭࣄʯΛอূͰ͖Δ ืू ืूϩδοΫΛදݱ͢Δ4IBSFEMJCSBSZ ืूαʔϏε
  6. ©2018 Wantedly, Inc. JODSFNFOUBMʹਐΊΔͨΊͷ޻෉ ϑϥάΛར༻ͯ͠ɺগͣͭ͠ϚΠΫϩαʔϏε΁ͷ USB⒏DΛ૿΍͢ w ʮ੾Γग़ͨ͠ϚΠΫϩαʔϏε΁ͷ31$ʯ͸ɺϑϥάͰྲྀྔΛίϯτϩʔϧ w গͣͭ͠ྲྀྔΛ૿΍͢

     8BOUFEMZࣾһʹର͚ͯͩ͠ϦϦʔεʢυοάϑʔσΟϯάʣ  Ұ෦ͷϦΫΤετʹରͯ͠ϦϦʔε  શମϦϦʔε w ໰୊͕ى͖ͨ࣌ͷϦεΫΛܰݮ w ϚΠΫϩαʔϏεͰ໰୊͕ى͖ͯ΋USB⒏D͕গͳ͚Ε͹Өڹ͸ݶఆత w ͍͟ͱͳͬͨΒϑϥάΛ0''ʹͯ͠໭͢͜ͱ͕ग़དྷΔ
  7. ©2018 Wantedly, Inc. message EditXXXRequest { int64 id = 1;

    … } ϞϊϦε෼ׂΛਐΊΔ্Ͱ༗ޮٕͩͬͨज़1SPUPDPM#VGGFST ϚΠΫϩαʔϏεͷΠϯλʔϑΣʔε͸1SPUPDPM #V⒎FST*%-Λར༻ͯ͠એݴతʹهड़ w QSPUPpMFΛݟΔ͚ͩͰΠϯλʔϑΣʔε͕෼͔Γɺ಺෦࣮૷Ͱ͸ͳ͘ΠϯλʔϑΣʔεʹ ूதͯٞ͠࿦͕Ͱ͖Δ message EditXXXResponse { … }
  8. ©2018 Wantedly, Inc. ϞϊϦε෼ׂΛਐΊΔ্Ͱ༗ޮٕͩͬͨज़1SPUPDPM#VGGFST 1SPUPDPM#V⒎FSTͰࣗಈੜ੒ͨ͠ίʔυΛར༻ w 4FSWFS w (PαʔόʔͰ͸H31$ HSQDHBUFXBZ

    H31$UP+40/QSPYZ Λར༻ w 3BJMTαʔόʔͰ͸)551ͷCPEZʹ1SPUPDPM#V⒎FSCJOBSZΛར༻ w $MJFOUͷҰ෦ w ϚΠΫϩαʔϏε΁ͷ31$ͷSFRVFTUSFTQPOTFʹ1SPUPDPM#V⒎FSΛར༻ w QSPUPpMFͰએݴͨ͠಺༰ͱ࣮૷ͷҰகΛอূͰ͖Δ request = EditXXXRequest.new(…) response = XXXService.edit(request)
  9. ©2018 Wantedly, Inc. ϞϊϦε෼ׂΛਐΊΔ্Ͱ༗ޮٕͩͬͨज़1VC4VC.FTTBHJOH ϚΠΫϩαʔϏεؒͷ௨৴ʹ 1VC4VC.FTTBHJOHΛར༻ IUUQTDMPVEHPPHMFDPNQVCTVCEPDTPWFSWJFXΑΓҾ༻ w (PPHMF$MPVE1VC4VCΛར༻ w

    5PQJDͱ4VCTDSJQUJPOΛ௨৴  1VCMJTIFS͕5PQJDʹ.FTTBHFΛQVCMJTI  .FTTBHF͸5PQJD͔Β4VCTDSJQUJPO΁഑৴͞ΕΔ  4VCTDSJCFS͕.FTTBHFΛॲཧ w ద੾ͳՕॴͰ͸1VC4VC.FTTBHJOHΛੵۃతʹར༻ w ΠϕϯτۦಈΞʔΩςΫνϟͷ࣮ݱ
  10. ©2018 Wantedly, Inc. 1VC4VC.FTTBHJOHΛબͿϝϦοτ ϚΠΫϩαʔϏεؒͰඇಉظ௨৴ w MBUFODZΛԼ͛Δ͜ͱ͕ग़དྷΔ w 1VCMJTIFS͸4VCTDSJCFSͷॲཧΛ଴ͨͳͯ͘ྑ͍ ϚΠΫϩαʔϏεͷؔ৺͝ͱΛ෼཭

    w ଱ো֐ੑΛߴΊΔ͜ͱ͕ग़དྷΔ w 4VCTDSJCFSαʔϏεʹো֐͕ى͖ͯ΋ɺ1VCMJTIFSαʔϏε͸ӨڹΛड͚ͳ͍ w ͦΕͧΕͷϚΠΫϩαʔϏεͰಠཱʹ։ൃΛਐΊΔ͜ͱ͕ग़དྷΔ w 1VCMJTIFSαʔϏεͷίʔυϕʔεΛมߋͤͣʹ4VCTDSJCFSΛ௥ՃͰ͖Δ
  11. ©2018 Wantedly, Inc. ϞϊϦε෼ׂͷࡍʹ1VC4VC.FTTBHJOHΛͲ͜Ͱར༻͔ͨ͠ʁ "DUJWF3FDPSEͷDBMMCBDLஔ͖׵͑ʹར༻ w 3BJMTͷ03.Ͱ͋Δ"DUJWF3FDPSE͸DBMMCBDLͱ͍͏ػߏΛ࣋ͭ w ϞσϧͷӬଓԽॲཧΛIPPLͯ͠ϝιουΛݺͼग़͢ػೳ w

    ଟ͘ͷ৔߹ʹɺDBMMCBDL͸ʮෳ਺ϞσϧͷؒͰͷ੔߹ੑ୲อʯʹར༻͞Ε͍ͯͨ w FHืूϞσϧͷߋ৽ΛIPPLͯ͠ձࣾϞσϧͰಛఆͷσʔλΛߋ৽͢Δ w ʮϚΠΫϩαʔϏεΛ·͕ͨΔDBMMCBDLʯ͸1VC4VC.FTTBHJOHͰஔ͖׵͑ͨ ืू (PPHMF$MPVE1VC4VC 7JTJU 1VCMJTI 4VCTDSJCF
  12. ©2018 Wantedly, Inc. ஫1VC4VC.FTTBHJOH͸ۜͷ஄ؙͰ͸ແ͍ ஫ҙ఺ϚΠΫϩαʔϏεؒ͸݁Ռ੔߹ʹͳΔ w ඇಉظ௨৴Ͱ͋ΔҎ্ɺߋ৽͕൓ө͞ΕΔ·Ͱͷ஗ԆΛڐ༰͢Δඞཁ͕͋Δ w "DUJWF3FDPSEDBMMCBDL͸ɺଟ͘ͷ৔߹ʹ݁Ռ੔߹Ͱ໰୊ͳ͔ͬͨ w

    ڧ͍੔߹ੑ͕ඞཁͳ৔߹ʹ͸ɺʮಉظ௨৴Λར༻ͨ͠෼ࢄτϥϯβΫγϣϯʯͳͲ͕બ୒ࢶ ஫ҙ఺ෳࡶੑͷ૿େʹରॲ͢Δඞཁ͕͋Δ w ϚΠΫϩαʔϏεΛ·͕ͨΔॲཧͷ׬ྃΛ௥੻͢Δ೉қ౓͸্͕Δ w ໰୊ͷ͋Δ.FTTBHFʹର͢ΔॲஔΛߟ͑Δඞཁ͕͋ΔʢFHEFBEMFUUFSRVFVFͷ༻ҙʣ w 4VCTDSJCFॲཧͷSFUSZ্ݶʹ͍ͭͯ΋ߟ͑Δඞཁ͕͋Δ w .FTTBHF2VFVFࣗମͷো֐ʹඋ͑Δඞཁ͕͋ΔʢFH(PPHMF$MPVE1VC4VCো֐࣌ͷ ରԠϑϩʔ੔උʣ
  13. ©2018 Wantedly, Inc. 8BOUFEMZ7JTJUͷݱঢ় 8BOUFEMZ7JTJU ਪનαʔϏε͸׬શʹ ੾Γग़ͨ͠ w ΠϯλʔϑΣʔε͕খ͘͞ɺਐΊ΍͔ͬͨ͢ ืूαʔϏε͸ॻ͖ࠐΈ

    ͷΈ੾Γग़ͨ͠ w ॻ͖ࠐΈͷػೳ։ൃΛ׆ൃʹਐΊ͔ͨͬͨ w ίετͱϦλʔϯΛߟ͑ͳ͕ΒɺಡΈࠐΈ΋ ੾Γग़͠ΛਐΊΔ༧ఆʢݱࡏ͸4IBSFE MJCSBSZΛར༻ʣ ਪન ॻ͖ࠐΈ31$ ಡΈࠐΈ31$ ಡΈࠐΈϝιουݺͼग़͠ ืू 1VC 4VC 1VC 4VC 7JTJU
  14. ©2018 Wantedly, Inc. 8BOUFEMZ7JTJUͷϞϊϦε෼ׂͷ݁Ռ ϞϊϦε෼ׂͰ࣮֬ʹϝϦοτ͸͋ͬͨ w ։ൃνʔϜʹώΞϦϯά͢Δͱɺ࣮ײͱͯ͠ҎԼͷΑ͏ͳϝϦοτΛײ͍ͯ͡Δͱฉ͍ͨ  Ϟσϧͷݟ௨͕͠ྑ͘ͳΓɺϢʔεέʔε͕ΠϯλʔϑΣʔεͱͯ͠એݴ͞Εͯཧղ͠΍͘͢ ͳͬͨ

     ΠϯλʔϑΣʔεΛઌʹఆٛ͢ΔͨΊɺ5%%Ͱͷ։ൃ͕΍Γ΍͘͢ͳͬͨ  ओ؍తʹ͸ɺ։ൃͷੜ࢈ੑ͕ഒʹͳͬͨ  ো֐ͷӨڹൣғ΋཈͑ΒΕΔΑ͏ʹͳͬͨ ϞϊϦε෼ׂ͸͞ΒʹਐΊΒΕΔ͸ͣ w ʮืूͷಡΈࠐΈʯΛ࢝Ίɺ੾Γग़͍ͨ͠੹຿͸·ͩແ਺ʹ͋Δ
  15. ©2018 Wantedly, Inc. Ϣʔβʔ৘ใͷ੹຿͕ࢄΒ͹ͬͯ͠·ͬͨྺ࢙తܦҢ Ϣʔβʔ 7JTJU 7JTJU $IBU 7JTJU $IBU

    1FPQMF Ϣʔβʔ Ϣʔβʔ 7JTJUҎ֎ͷϚΠΫϩαʔϏεʹ Ϣʔβʔ৘ใΛఏڙ͢ΔͨΊͷ ϚΠΫϩαʔϏε͕஀ੜ ৽ϚΠΫϩαʔϏεͰ͸ػೳ͕ෆ଍ ͠ɺ݁ہ7JTJU΁ͷSFRVFTU͕ߦΘ ΕΔ͜ͱʹͳΔ
  16. ©2018 Wantedly, Inc. Ϣʔβʔ৘ใͷ੹຿ू໿ͷݱঢ় 1FPQMF͔ΒͷಡΈࠐΈ31$ ͸ϢʔβʔαʔϏε΁ҰຊԽ w ݩʑɺಡΈࠐΈܦ࿏͕ෳ਺ଘࡏ͕ͨ͠ҰຊԽ w ࠓޙ΋৽͘͠ϚΠΫϩαʔϏε͕࡞ΒΕͨࡍ͸

    ϢʔβʔαʔϏε͕ར༻͞ΕΔΑ͏ʹͳͬͨ ॻ͖ࠐΈ31$͸ݱࡏҠߦத w εςʔδϯά؀ڥͰͷݕূޙɺগͣͭ͠Ϣʔβʔ αʔϏε΁Ҡߦ͢Δ༧ఆ w ίετͱϦλʔϯΛߟ͑ͳ͕Βɺ7JTJU͔Βͷ੾Γग़͠ ΋ਐΊΔ༧ఆʢݱࡏ͸4IBSFEMJCSBSZΛར༻ʣ ಡΈॻ͖ϝιου ݺͼग़͠ Ϣʔβʔ 1VC 4VC 7JTJU ಡΈࠐΈ31$ 1FPQMF ॻ͖ࠐΈ31$
  17. ©2018 Wantedly, Inc. ಡΈࠐΈ31$ͷू໿͚ͩͰ΋࣮֬ʹϝϦοτ͕͋ͬͨ w 1FPQMFνʔϜʹώΞϦϯάͯ͠ɺҎԼͷΑ͏ͳ੠Λฉ͍ͨ w Ϣʔβʔ৘ใͷऔಘܦ࿏Λ໎Θͳͯ͘ࡁΉͨΊɺʮϢʔβʔ৘ใΛར༻͢ΔϚΠΫϩαʔϏεʯ Λ৽͘͠࡞Γ΍͘͢ͳͬͨ w

    ϢʔβʔͷSFTQPOTFʹpFMEΛ௥Ճ͢Δϑϩʔ͕੔උ͞Εɺࠞཚͳ͘ߦ͑Δ༷ʹͳͬͨ w ϞϊϦε෼ׂͷࡍͱಉ༷ͷϝϦοτ΋ಘΒΕͨ w Ϟσϧͷݟ௨͕͠ྑ͘ͳΔɺΠϯλʔϑΣʔε͕໌ࣔతɺো֐ͷӨڹൣғॖখ ॻ͖ࠐΈ31$΍7JTJU͔Βͷར༻΋ϢʔβʔαʔϏε ʹҠߦ͢ΔࣄͰɺ͞ΒʹϝϦοτΛڗडग़དྷΔ͸ͣ Ϣʔβʔ৘ใͷ੹຿ू໿ͷ݁Ռ
  18. ©2018 Wantedly, Inc. 3FBSDIJUFDUVSJOH͸΍͸Γେม w େ͕͔ΓͳมߋͰ͋Δҝɺ࣌ؒతɾ࿑ྗతίετ͕͔͔Δ w ؆୯ʹཧ૝తͳΞʔΩςΫνϟ·Ͱ͸ḷΓண͚ͳ͍ w ίετͱϦλʔϯΛൺ΂ͯɺऔΓ૊ΉྖҬΛܾΊΔඞཁ͕͋Δ

    ҰํͰɺऔΓ૊ΉࣄͰ࣮֬ʹྑ͘ͳͬͨ w ׬શͳʮϚΠΫϩαʔϏε੾Γ཭͠ʯ͸΋ͪΖΜ͕ͩɺॻ͖ࠐΈͳͲҰ෦͕੾Γ཭͞ΕΔ͚ͩͰ ϝϦοτ͕͋ͬͨ w ͙͢ʹཧ૝తͳঢ়ଶ͸࣮ݱͰ͖ͳ͍͔Βͦ͜ɺܧଓతʹऔΓ૊Ήࣄ͕ॏཁ 3FBSDIJUFDUVSJOHΛৼΓฦͬͯΈͯ
  19. ©2018 Wantedly, Inc. ·ͱΊ ։ൃΛਐΊΔதͰɺෆద੾ͳϚΠΫϩαʔϏε ΞʔΩςΫνϟʹؾͮ͘ࣄ͕͋Δ w ڊେͳϞϊϦεͷଘࡏ w ෳ਺ͷϚΠΫϩαʔϏε΁ͷ੹຿ͷࢄΒ͹Γ

    ܧଓతʹΞʔΩςΫνϟΛվળ͠ଓ͚Δࣄ͕ॏཁ w 3FBSDIJUFDUVSJOH͸େม͕ͩɺࣃΛ৯͍͠͹ͬͯऔΓ૊ΉࣄͰվળͰ͖Δ͸ͣʂ