Shared Code Management With Incomplete Microservices

Ad4c3c738e57a9bbcb800871e81c232d?s=47 itosho
October 30, 2017

Shared Code Management With Incomplete Microservices

Dev7++ Study Night 第3回の登壇資料です。『“不完全”なマイクロサービスでの共有コードの扱いについて
』というテーマで話しました。

Ad4c3c738e57a9bbcb800871e81c232d?s=128

itosho

October 30, 2017
Tweet

Transcript

  1. ҰาΛࢧ͑Δ %FW 4UVEZ/JHIU $POOFIJUP JOD4IP*UP 4IBSFE$PEF.BOBHFNFOU
 8JUI*ODPNQMFUF.JDSPTFSWJDFT 

  2. $POOFIJUP*OD 1SPpMF ҏ౻ᠳ !JUPTIP  (PMBOHͱ໺ٿͱΞΠυϧ͕޷͖Ͱ͢ $POOFIJUP JOD&OHJOFFS
 ʢ4VQFSTIJQגࣜձ͔ࣾΒग़޲தʣ

  3. $POOFIJUP*OD w དྷि։࠵͞ΕΔ೫໦ࡔॳͷ౦ژυʔϜެԋʹ͍ͭͯ
 ࠙਌ձͰ࿩͍ͨ͠
 w lෆ׬શzͳϚΠΫϩαʔϏεͰͷڞ༗ίʔυͷѻ͍ʹ͍ͭͯ
 ݁࿦Λઌʹݴ͓ͬͯ͘ͱɺۜͷ஄ؙ͸͋Γ·ͤΜɻ "HFOEB  ࠓ೔࿩͢͜ͱ

  4. %FW 4UVEZ/JHIU ෆ׬શͳϚΠΫϩαʔϏεͱ͸ʁ 

  5. $POOFIJUP*OD 8IBU`TlJODPNQMFUFz.JDSPTFSWJDFT w ωΠςΟϒԽʢΞϓϦʣͷਪਐ w αʔϏεͷ֦େʢϚϚϦϓϨϛΞϜʣ w ։ൃϝϯόʔͷ૿Ճʢ໊ˠ໊ʣ  ͜ͷ൒೥ؒͰίωώτͰى͖ͨมԽ

  6. $POOFIJUP*OD w ڊେͳϞϊϦγοΫγεςϜ͔Βͷ୤٫ w αʔϏεʢϦϙδτϦʣͷ૿Ճ w νʔϜͷࡉ෼Խʢίϯ΢ΣΠͷ๏ଇʣ  ϞϊϦγοΫͰ΋ϚΠΫϩαʔϏεͰ΋ͳ͍͕ɺ
 αʔϏε͕෼཭͠͸͡Ί͍ͯΔঢ়ଶ

    ෆ׬શͳϚΠΫϩαʔϏε ˞ޡղ͕ͳ͍Α͏ʹัଊ͓ͯ͘͠ͱɺ
 ɹݱ࣌఺Ͱίωώτ͸ϚΠΫϩαʔϏεΛ໨ࢦ͍ͯ͠ΔΘ͚Ͱ͸͋Γ·ͤΜɻ
 ɹʢϞϊϦγοΫͱݺ΂Δཁૉ΋ଟ͘࢒͍ͬͯ·͢ʣ 8IBU`TlJODPNQMFUFz.JDSPTFSWJDFT ͦͷ݁ՌɺԿ͕ى͖͔ͨʁ
  7. %FW 4UVEZ/JHIU ڞ༗ίʔυΛͲ͏؅ཧ͢Δ͔ʁ 

  8. $POOFIJUP*OD )PXUPNBOBHFTIBSFEDPEFT w ֤αʔϏεʢϦϙδτϦʣؒͰൃੜ͢Δίʔυͷॏෳ  ෆ׬શͳϚΠΫϩαʔϏε͕΋ͨΒ͢՝୊ ڞ༗ίʔυͷछྨ w ϏδωεϩδοΫ
 ୯७ʹαʔϏεؒͷ੹຿͕ᐆດͰ͋Δ͜ͱଟ͍


    αʔϏεͷద੾ͳϞσϧԽΛ͢Ε͹ॆ෼ʹରॲՄೳ
 جຊతʹഉআ͢΂͖
 w ੩తσʔλʢࠓ೔࿩͢ͷ͸ͪ͜Βʣ
 %#Ͱ؅ཧ͢Δ΄ͲͰ͸ͳ͍ྻڍܕͰදݱग़དྷΔΑ͏ͳσʔλ
 ྫʣࠃίʔυɺੑผɺখ͞ͳΧςΰϦʔɺઃఆ৘ใͳͲ
 ্هͷΑ͏ͳ৘ใٴͼͦͷ৘ใʹؔ࿈͢ΔϩδοΫ
 ෛ࠴ʹͳΓͮΒ͍ͷͰॏෳ͕͕ͤͪͩ͞ɺঃʑʹมߋ͕໘౗ʹͳΔɻ
  9. %FW 4UVEZ/JHIU ରॲ๏"1*ύλʔϯ 

  10. $POOFIJUP*OD "QQSPBDI"1*1BUUFSO w ੩తσʔλ͚ͩΛ؅ཧ͢Δ"1*ʢαʔϏεʣΛ࡞੒͢Δ w ֤αʔϏε͸"1*Λݺͼग़ͯ͠੩తσʔλʹΞΫηε͢Δ  ੩తσʔλͷίʔυ΋"1*Խ͢Δ

  11. $POOFIJUP*OD "QQSPBDI"1*1BUUFSO w ׬શʹ%3:ͳঢ়ଶʹͳΔ w ࠷΋ϚΠΫϩαʔϏεతͳΞϓϩʔν  1SPT $POT w

    )551௨৴ʹΑΔΦʔόʔϔου w 4USJDU͗͢ΔΞϓϩʔν w ͨͩࠃ΍౎ಓ෎ݝͷ৘ใ͕ཉ͍͚ͩ͠ͳͷʹʜ
  12. %FW 4UVEZ/JHIU ରॲ๏ϥΠϒϥϦύλʔϯ 

  13. $POOFIJUP*OD "QQSPBDI-JCSBSZ1BUUFSO  ੩తσʔλͷίʔυΛϥΠϒϥϦԽ͢Δ w ੩తσʔλؔ࿈ͷίʔυ܈ΛҰͭͷϥΠϒϥϦʹ·ͱΊΔ w ϥΠϒϥϦ͸֤ݴޠඪ४ͷύοέʔδ؅ཧ͔Βར༻ग़དྷΔΑ͏ʹ͢Δ w ֤αʔϏε͸ϥΠϒϥϦܦ༝Ͱ੩తσʔλʹΞΫηε͢Δ

  14. $POOFIJUP*OD w "1*ύλʔϯΑΓ΋Φʔόʔϔου͕গͳ͍ w ֤αʔϏε͕ಉ͡ݴޠͰ࣮૷͞Ε͍ͯΔ৔߹͸ಋೖίετ͕௿͍ w ࠷΋ݱ࣮తͳΞϓϩʔν
 4UBDL0WFSqPXͰ΋͜ͷΞϓϩʔν͕ࢧ࣋͞Ε͍ͯͨ  1SPT

    $POT w "1*ύλʔϯΑΓ΋αʔϏεؒͷ݁߹౓͕ߴ·Δ
 ύοέʔδ؅ཧΛར༻͢Δ͜ͱͰ͋Δఔ౓ϦεΫ͸Լ͛ΒΕΔ w ֤αʔϏε͕ҟͳΔݴޠͰ࣮૷͞Ε͍ͯΔ৔߹͸%3:ʹͳΓͮΒ͍ w ϚΠΫϩαʔϏεͷϝϦοτͷͻͱͭͰ͋Δʮٕज़ҟ࣭ੑʯΛڗडͮ͠Β͍ "QQSPBDI-JCSBSZ1BUUFSO ˞4IBSJOHDPEFBOETDIFNBCFUXFFONJDSPTFSWJDFT IUUQTTUBDLPWFSqPXDPNRVFTUJPOTTIBSJOHDPEFBOETDIFNBCFUXFFONJDSPTFSWJDFT
  15. %FW 4UVEZ/JHIU ରॲ๏ೋ૚ϥΠϒϥϦύλʔϯ 

  16. $POOFIJUP*OD "QQSPBDI#JMBZFS-JCSBSZ1BUUFSO  ຊ౰ʹ%3:Խ͍ͨ͠΋ͷ w ੩తσʔλͦͷ΋ͷͰ͋ΓɺͦͷपลϩδοΫͰ͸ͳ͍ɻ
 ྫ੩తσʔλ΁ͷ%"0తͳϝιου౳ w ϥΠϒϥϦ͔ΒϩδοΫͱσʔλΛ෼཭ͯ͋͛͠Ε͹͍͍ͷͰ͸ʁ

  17. $POOFIJUP*OD "QQSPBDI#JMBZFS-JCSBSZ1BUUFSO  ೋ૚ϥΠϒϥϦύλʔϯͷΠϝʔδ ˙ΞΠυϧ&$ αʔϏε" ʢ$BLF1)1ʣ αʔϏε# ʢ3BJMTʣ 1)1ϥΠϒϥϦ

    ʢ$PNQPTFSʣ 3VCZϥΠϒϥϦ ʢ(FNʣ ੩తσʔλʢ50.-ʣ (JU4VCUSFFΛར༻ͯ͠ɺ
 ੩తσʔλΛऔΓࠐΉɻ IUUQTHJUIVCDPNJUPTIPJEPMFDDPOTUBOUTNBTUFS IUUQTHJUIVCDPNJUPTIPJEPMFDTFSWJDF IUUQTHJUIVCDPNJUPTIPJEPMFDTFSWJDF IUUQTHJUIVCDPNJUPTIPJEPMFDDPOTUBOUTQIQ IUUQTHJUIVCDPNJUPTIPJEPM@FD@DPOTUBOUT@SVCZ ˞ίʔυ͸งғؾͳͷͰɺΠϝʔδΛ௫Ήఔ౓ʹࢀর͍ͯͩ͘͠ʜɻ ˞੩తσʔλ͸50.-Λ࢖͍ͬͯ·͕͢ɺ͓޷ΈͰ:".-ͳΓ+40/ͳΓࣗ༝ʹར༻͍ͯͩ͘͠͞ɻ
  18. $POOFIJUP*OD  1SPT "QQSPBDI#JMBZFS-JCSBSZ1BUUFSO w ੩తσʔλ͕Ұݩ؅ཧग़དྷΔ w ෳ਺ݴޠͰ΋%3:Խग़དྷΔ $POT w

    ௨ৗͷϥΠϒϥϦύλʔϯಉ༷ʹαʔϏεؒͷ݁߹౓͸ߴ͘ͳΔ w (JU4VCUSFFΛར༻͢ΔͷͰ؅ཧ͕ෳࡶʹͳΔϦεΫ
 ن໛͕খ͚͞Ε͹֤αʔϏε͕50.-ϑΝΠϧΛ(JU4VCUSFFͰऔΓࠐΉͷ΋͋Γʁ
 ΫϥΠΞϯτϥΠϒϥϦͰར༻͢Δͷ͸ආ͚ͨ΄͏͕ϕλʔʁ
  19. %FW 4UVEZ/JHIU ରॲ๏ 

  20. $POOFIJUP*OD "QQSPBDI  ׬શͳϚΠΫϩαʔϏεΛͭ͘Δ w ڞ༗ίʔυͷ໰୊ͷଟ͘͸ෆ׬શͳϚΠΫϩαʔϏεނʹى͜Δ w ڥք͚ͮΒΕͨίϯςΩετͷ΋ͱద੾ʹαʔϏεΛ෼ׂ͢Ε͹0,ʁ ͔͠͠ɺڞ༗ίʔυ͕θϩʹͳΔ͜ͱ͸ͳ͍ w

    5IPVHIU8PSLTࣾͷ4BN/FXNBOࢯᐌ͘ɺ
 lͭͷϚΠΫϩαʔϏε಺Ͱ͸%3:ΛഁΒͳ͍͚ΕͰ΋ɺ
 ͢΂ͯͷαʔϏεʹΘͨΔ%3:ͷҧ൓ʹ͸׮େʹରॲ͠·͢ɻz
  21. %FW 4UVEZ/JHIU ·ͱΊ 

  22. $POOFIJUP*OD 1PFN  ׬ᘳͳγεςϜͳͲଘࡏ͠ͳ͍ w ϚΠΫϩαʔϏε΋ۜͷ஄ؙͰ͸ͳ͍ w αʔϏεͷϑΣΠζ΍ن໛ʹΑͬͯ΋ਖ਼ղ͸ҟͳΔ w ͋ΒΏΔΞʔΩςΫνϟ͸खஈͷͻͱͭʹա͗ͳ͍

    w ׬ᘳͳγεςϜ͸ଘࡏ͠ͳ͍͚Ͳɺ
 ͔ͩΒͱݴͬͯͦ͜ΛఘΊΔͷ͸Ͱ͸ͳ͘ɺ
 ͦΕͰ΋ɺগ͠Ͱ΋׬ᘳͰ͋Ζ͏ͱ౒ྗΛଓ͚͍ͯ͘͜ͱେ੾
 ʜͳͷ͔ͳʁ
  23. $POOFIJUP*OD 3FGFSFODF w ʰϚΠΫϩαʔϏεΞʔΩςΫνϟʱʢΦϥΠϦʔɾδϟύϯ ʣ
 ஶɿ4BN/FXNBO ؂༁ɿࠤ౻௚ੜ ༁ɿ໦Լ఩໵
 w .JDSPTFSWJDFTJP


    IUUQNJDSPTFSWJDFTJP w ࣾ಺Ͱԣஅతʹ࢖͑Δ1)1ϥΠϒϥϦΛॻ͜͏ʂ
 IUUQTPUBIBUFOBCMPHDPNFOUSZ w (JUTVCUSFFͷύϫʔ
 IUUQKBQBOCMPHTBUMBTTJBODPNUIFQPXFSPGHJUTVCUSFF  ࢀߟจݙࢀߟαΠτ
  24. %FW 4UVEZ/JHIU ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠