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

FOLIO のマイクロサービス in Action / FOLIO's Microservic...

FOLIO のマイクロサービス in Action / FOLIO's Microservices in Action

Takuya "Mura-Mi" Murakami

October 26, 2019
Tweet

More Decks by Takuya "Mura-Mi" Murakami

Other Decks in Programming

Transcript

  1. ଜ্୓໵ (@Mura-Mi or @mura_mi) ΞϓϦέʔγϣϯΤϯδχΞ in FOLIO ͜Ε·ͰͷΩϟϦΞ: * Simplex,

    Inc. (2012~2016) * CyberAgent AdTech Studio (2016~2018) * FOLIO (2018~ ) $ whoami 2
  2. ։ൃ։࢝ FOLIO ͷ͔ΜͨΜͳྺ࢙ 9      ૑ۀ

     ςʔϚ౤ࢿ ЌαʔϏε։࢝  ςʔϚ౤ࢿ -*/&ͱ࿈ܞ։࢝  ͓·͔ͤ౤ࢿ αʔϏε։࢝  ϫϯίΠϯ౤ࢿ αʔϏε։࢝  "84Ҡߦ։࢝  ਖ਼ࣜαʔϏε։࢝
  3. FOLIO ͰͷయܕతͳϨΠϠΞʔΩςΫνϟ 16 EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU

    JEMJOUFSOBM JEMFYUFSOBM JEM '0-*0ͷϚΠΫϩαʔϏεʹ͓͚ΔϨΠ Ϡ෼͚Λنఆ͢Δࣾ಺ϑϨʔϜϫʔΫ͸ ಛʹଘࡏ͠ͳ͍ ֤αʔϏεͷ։ൃ։࢝࣌ظʹΑͬͯ͹Β ͖ͭ͸͋Δ͕ɼ࠷ۙͷαʔϏεͷߏ଄͸ ͓͓Αͦ͜ͷ༷ʹͳ͍ͬͯΔ ͜ͷίϯϙʔωϯτͦΕͧΕΛTCUͷα ϒϓϩδΣΫτͱͯ͠ఆٛ͠ɼґଘͷҧ ൓͸ίϯύΠϧ͕௨Βͳ͍Α͏ʹ͍ͯ͠ Δ
  4. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    domain ϨΠϠ 17 ͍ΘΏΔʮϏδωεͷؔ৺ࣄʯ ΤϯςΟςΟɺ஋ΦϒδΣΫτ ϦϙδτϦఆٛ USBJU  ࣮૷͕Ͳͷ༷ʹͳ͍ͬͯΔ͔͸ͳΔ΂͘Ӆ͢ 3%# 3FEJT ώʔϓΩϟογϡ ଞϚΠΫϩ αʔϏε EPNBJO
  5. PBR (Price and Book-Value Ratio, גՁ७ࢿ࢈ഒ཰) = גՁ / BPS

    18 value object: ܭࢉࣜΛܕʹམͱ͠ࠐΉ
  6. PBR (Price and Book-Value Ratio, גՁ७ࢿ࢈ഒ཰) = גՁ / BPS

    18 value object: ܭࢉࣜΛܕʹམͱ͠ࠐΉ ϓϦϛςΟϒ஋͸ϥοϓ͢Δ
  7. PBR (Price and Book-Value Ratio, גՁ७ࢿ࢈ഒ཰) = גՁ / BPS

    18 value object: ܭࢉࣜΛܕʹམͱ͠ࠐΉ ਺ࣜΛϝιουͱͯ͠ද͢
  8. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    domain: Ͳ͜·Ͱִ཭͢Δʁ 20 Ӆ͍ͯ͠Δٕज़ৄࡉ 31$ΞϓϦέʔγϣϯ'8 'JOBHMF'JOBUSB  4DBMB%#Ϛοϐϯά 2VJMM  ϓϨθϯςʔγϣϯ 5ISJGU  Ӆ͍ͯ͠ͳ͍ٕज़ৄࡉ ඇಉظॲཧΛද͢ܕΫϥε 5XJUUFS'VUVSF  δΣωϦοΫϓϩάϥϛϯά TIBQFMFTT  ϚΠΫϩαʔϏεͷϝϦοτͱͯ͠ʮٕज़ҟ࣭ੑʯͱ͋Δ ͕ɼ࣮ࡍ͸ʜ EPNBJO
  9. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    application ϨΠϠ 21 ʮϢʔεέʔε૚ʯͱ΋ݺ͹ΕΔ෦෼ EPNBJOϨΠϠͷ஌ࣝΛ૊Έ߹Θͤͯ"1*΍όο ν࣮ߦ࣌ͷॲཧ಺༰Λهड़͢Δ BQQMJDBUJPO
  10. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    application: සग़ॲཧͱυϝΠϯ΁ͷৠཹ 26 BQQMJDBUJPOϨΠϠͰසग़͢Δॲཧ͸ "QQMJDBUJPO4FSWJDFͱݺΜͰڞ௨Խͨ͠Γ "QQMJDBUJPOϨΠϠͱ%PNBJOϨΠϠͷڥ໨͸ᐆ ດ͕ͩɼBQQΛॻ͖ͳ͕ΒEPNBJOʹ͍࣋ͬͯ ͘ &WBOTຊʹग़ͯ͘Δʮৠཹʯ͸ॏཁͳ࡞ۀ BQQMJDBUJPO
  11. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    presentation ϨΠϠ 27 "1*Λ࣮૷͢Δٕज़ৄࡉ૚ '0-*0ͩͱຆͲ͕5ISJGUͳͷͰɺϢʔεέʔε %UPͱ5ISJGUͷڮ౉͠ͳͲ͕ओͳ໾ׂ QSFTFOUBUJPO
  12. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    idl 35 JEM΄ͱΜͲ5ISJGU*%-ͷΈͰߏ੒͞Εͨαϒϓϩ δΣΫτ 5ISJGUͷ*%-ͷΈΛೖΕͨKBSϑΝΠϧΛެ։ *%-ͷίϯύΠϧ͸ެ։ଆͰ͸ͳ͘ར༻͢Δଆͷ࢓ࣄ  ࣗαʔϏεͷ5ISJGU*%-ΛίϯύΠϧ JEM JEMJOUFSOBM
  13. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    idl-external 36 ґଘ͢ΔϚΠΫϩαʔϏεͷίϯύΠϧΛߦ͏ JEMFYUFSOBM
  14. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    infrastructure 37 EPNBJOϨΠϠͰఆ͚ٛͩॻ͍ͨϨϙδτϦFUDΛ %#ΫΤϦɺ3FEJTίʔϧɺଞϚΠΫϩαʔϏε ίʔϧͰ࣮૷͢Δ JOGSBTUSVDUVSF
  15. Finagle Client Λୟ͍ͯ Domain Model ʹ٧Ί௚͢ 38 external service invocation

    implementation 5ISJGU*%-͔Βੜ੒͞Εͨ'JOBHMF$MJFOU
  16. Finagle Client Λୟ͍ͯ Domain Model ʹ٧Ί௚͢ 38 external service invocation

    implementation ଞαʔϏεͷฦΓ஋ΛυϝΠϯʹॻ͖ى͜͢
  17. EPNBJO BQQMJDBUJPO QSFTFOUBUJPO *OGSBTUSVDUVSF CBUDIPSTFSWFS  FOUSZQPJOU JEMJOUFSOBM JEMFYUFSOBM JEM

    entrypoint 39 ࠷ऴతͳ࣮ߦΫϥε΍DPOpHVSBUJPOΛஔ͘ CBUDIPSTFSWFS  FOUSZQPJOU
  18. ੲ࿩: ࠷ॳ͔Β͜ͷߏ੒Ͱ͸ͳ͔ͬͨ 40 TFSWFS CBUDI QSFTFOUBUJPO DPNNPO %#QFSTJTUFODF JEM EPNBJO

    BQQMJDBUJPO CBUDITQFDJpD BQQMJDBUJPO ҙਤ͍ͯ͠Δ͍ͳ͍ʹؔ ΘΒͣɼυϝΠϯϩδοΫ هड़ͱJEM͕ີ઀ʹͭͳ ͕͍ͬͯͨɽ 3FQPTJUPSZ͕5ISJGUߏ ଄ମΛฦ͢ ଞαʔϏεͷ5ISJGUߏ ଄ମΛͦͷ··࢖͏ TFSWFSTQFDJpD BQQMJDBUJPO TFSWFSTQFDJpD JOGSB CBUDITQFDJpD JOGSB
  19. Thrift ͷੜ੒෺ΛϏδωεϧʔϧهड़ʹ༻͍ͳ͍ 41 υϝΠϯϨΠϠΛ*%-͔Βੜ੒ͨ͠ఆٛʹґଘͤ͞ͳ͍ͷ͕ԿΑ Γେࣄ ϝϯςφϯε࣌ͷϥΠϑαΠΫϧ͕ҧ͏ "1*͸֎෦αʔϏεͱͷܖ໿ɽޙํޓ׵ੑΛۃྗอͭΑ͏ʹ ӡ༻͢Δ ࣗαʔϏε಺ͷσʔλϞσϧ͸αʔϏεͷਐḿʹैͬͯॊೈ ʹݟ௚ͨ͠ΓɼϦϑΝΫλϦϯά͍ͨ͠

    σʔλߏ଄ΛυϥεςΟοΫʹมߋ͢Δ͜ͱ͸ଟ͘ͳ͍͕ɼ ໊લͷݟ௚͠͸͔ͳΓଟ͍ҹ৅ ͜Ε·Ͱݟ͑ͳ͔ͬͨڥք Λݟग़ͨ͠Γ͢Δ  ஋ΦϒδΣΫτΛ࢖͑ͳ͍ɻৼΔ෣͍Λ஋ΦϒδΣΫτ౳ͷυϝ ΠϯΦϒδΣΫτʹدͤΒΕͳ͍
  20. TwitterServer admin ʹϖʔδΛ௥Ճ͢Δ 45 'JOBHMF4FSWJDFΛ5XJUUFS4FSWFSΛఴ͑ͯىಈ͢Δͱɺ )551BENJO6*͕ىಈͯ͠ɺ֤छϝτϦΫε΍UPHHMF ޙ ड़ ͷঢ়ଶ͕֬ೝͰ͖Δɻ ͜ͷ5XJUUFS4FSWFSͷBENJOϖʔδʹ͸ಠࣗͷϖʔδΛ

    ௥Ճ͢Δ͜ͱ͕ग़དྷΔɻ SFBEܥͷ"1*ͷத਎ͷ֬ೝ΍ɺରސ٬ϝοηʔδૹ৴ͷϦτϥΠ ࣮ࢪ༻ͷӡ༻ϢʔςΟϦςΟΛઃ͚Δͷʹ࢖͍ͬͯΔ ຊ൪؀ڥ͸4".-͔ΒϦμΠϨΫτ͢ΔΑ͏ʹͯ͠ɺಛఆͷϩʔϧ ͕Ξλον͞Ε͍ͯͳ͍ͱ৮Εͳ͍Α͏ʹͳ͍ͬͯΔ
  21. ࣗࣾͱଞࣾ: ϑΝαʔυͰ͋Γ෗ഊ๷ࢭ૚ 53 ۚ༥αʔϏεΛࢧ͑ΔγεςϜ͸ɼࣗࣾҎ֎ͷఏڙ͢ΔγεςϜʹ ґΔϘϦϡʔϜ͕େ͖͍ औҾॴϒϩʔΧʔͱͷ஫จ఻ୡ גՁ഑৴ɼίϯηϯαε༧૝σʔλ഑৴ σʔλϕϯμʔ  צఆܥγεςϜ

    ֎෦"41Λར༻  ۜߦৼࠐड෇γεςϜ ఏܞઌαʔϏεͱͷ࿈ܞ FUDʜ σʔλΛड͚౉͢ϓϩτίϧ͕ҧͬͨΓɼϕϯμʔಠࣗͷޠኮ֓ ೦Λϥοϓ͢ΔͨΊʹϚΠΫϩαʔϏεΛݐͯΔɽ'0-*0಺෦͔ Β͢Δͱ෗ഊ๷ࢭ૚ɼ֎෦͔ΒݟΔͱϑΝαʔυͱͯ͠ػೳ͢Δɽ
  22. ྫ: ֎෦γεςϜͱϚΠΫϩαʔϏε 54 σʔλϕϯμʔ 40"1  9.-
 $47WJB4'51  ϕϯμʔಠࣗͷ

    σʔϞϯόΠφϦ ͷαϒεΫϥΠϒ 3&45"1*$BMM '0-*0 ϑϩϯτ ސ٬ࢿ࢈ ࢀরܥ ঎඼؅ཧ -*/&޲͚ 'BDBEF σʔλ഑৴ ϕϯμʔ σʔλऔΓ ࠐΈ
  23. େҬత CQRS తͳϦΞʔΩςΫνϟϦϯά 65 τϥσΟγϣφϧͳূ݊ձࣾʹ͸ʮϑϩϯτϛυϧόοΫΦ ϑΟεʯͱ͍͏৬຿ػೳͷ෼ྨ͕͋Δɽ ϑϩϯτऩӹΛ্͛Δ෦෼ɽ
 ωοτূ݊ͩͱސ٬͕஫จΛग़͠ɼऔҾΛߦ͏෦෼ ϛυϧϑϩϯτͷ׆ಈͷ݁ՌͷϞχλϦϯά όοΫϑϩϯτͷ׆ಈͷ݁Ռͷࣄޙॲཧ

    ࣄ຿ɼצఆFUDʜ  ϑϩϯτϛυϧόοΫ͝ͱʹγεςϜʹٻΊΒΕΔੑ֨͸ҟ ͳΔ ϑϩϯτऔҾओମͷίϚϯυΛड͚෇͚ͯॲཧΛ͢Δݎ࿚͔ ͭߴεϧʔϓοτͰ͋Δ͜ͱɽऩӹྗɽ ϛυϧ෯޿͍σʔλͷҰ؏ੑͷ͋Δࢀর όοΫεέʔϥϏϦςΟ