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

取引ドメインでの取り組み / mercari transaction domain

取引ドメインでの取り組み / mercari transaction domain

2021/12/16(木)
メルカリBackendエンジニア、次の一手とは?Microservice化を振り返る
Microservice化の裏側と、新しい課題、そしてRFSへ
https://mercari.connpass.com/event/232504/

Yuichi Takada

December 16, 2021
Tweet

More Decks by Yuichi Takada

Other Decks in Technology

Transcript

  1. 6 Transaction team • ঎඼ߪೖ͔ΒऔҾ׬ྃ·ͰͷҰ࿈ͷϫʔΫϑϩʔͷ؅ཧ • औҾΛαϙʔτ͢Δػೳ ◦ औҾϝοηʔδ ◦

    औҾΩϟϯηϧ • endpoint ΋ DB ΋ɺ·ͩ׬શʹ Monolith ͷதʹ͋Δ औҾυϝΠϯͱ͸
  2. 7 Transaction team • ܾࡁ (Payment) • Ϋʔϙϯ (Coupon) •

    ഑ૹ (Shipping) • ձܭ (Accounting) • ௨஌ (Notification) • ঎඼ (Item) • ͳͲͳͲ ؔ࿈͢ΔଞυϝΠϯʢଞνʔϜʣ
  3. 12 Domain code ྠಡձ • طଘΛཧղ͢Δ͜ͱ ◦ ࣮૷ ◦ ґଘ͍ͯ͠Δ

    table ΍ microservices ◦ ΤϯυϙΠϯτͷར༻͞ΕΔγφϦΦ ◦ ো֐࣌ͷӨڹ ◦ Code ͷվળ఺ • ࣮ࡍͷϦϑΝΫλϦϯά΍ઃܭ͸είʔϓ֎ Goal
  4. 13 Domain code ྠಡձ • υϝΠϯ஌ࣝ • υϝΠϯ΁ͷ Ownership •

    Onboarding ίϯςϯπ • ࣍ʹऔΓ૊Ή՝୊ ಘΒΕͨ͜ͱ
  5. 19 Domain boundary violation detection • Afferent Couplings (Ca) ◦

    ଞυϝΠϯ͔Βͷґଘ • Efferent Couplings (Ce) ◦ ଞυϝΠϯ΁ͷґଘ What
  6. 20 Transaction package Shipping package Notification package A B C

    D E F Afferent Couplings(Ca) Efferent Couplings(Ce)
  7. 21 Domain boundary violation detection • Afferent Couplings (Ca) ◦

    ଞυϝΠϯ͔ΒऔҾυϝΠϯ΁ͷґଘ • Efferent Couplings (Ce) ◦ औҾυϝΠϯ͔ΒଞυϝΠϯ΁ͷґଘ
  8. 26 औҾυϝΠϯͷ෼ׂ • औҾυϝΠϯ͸େ͖͍ ◦ 50 endpoints ◦ CRUD 70

    tables • ฒߦ։ൃΛՄೳʹ͠ɺ։ൃͷੜ࢈ੑΛߴΊΔ Why
  9. 28 ·ͱΊ • Domain code ྠಡձ • Domain boundary violation

    detection • औҾυϝΠϯͷ෼ׂ औΓ૊Έ
  10. 29 ·ͱΊ • 10 ݄͔Βൃ଍͠ɺ3ϲ݄໨ • ׆ಈΛ௨ͯ͠νʔϜͱͯ͠੒௕ ◦ ՝୊͸վળͷνϟϯε •

    औҾ͸ෳࡶͰॏཁͳυϝΠϯ ◦ ೉͠͞ͱ͓΋͠Ζ͕͋͞Δ νʔϜͷݱࡏ