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

An example of micro-services and best practice

An example of micro-services and best practice

53850955f15249a1a9dc49df6113e400?s=128

LINE Developers
PRO

June 13, 2019
Tweet

Transcript

  1. ϚΠΫϩαʔϏεͷࣄྫͱ ϕετϓϥΫςΟεΛߟ͑Δ INTEROP TOKYO2019 ΧϯϑΝϨϯε YA-04 HARUKI SATO, LINE Dev1

    Center
  2. • LINE ͰɺαʔόʔαΠυ։ൃνʔϜͷϚωʔδϟʔΛ͍ͯ͠·͢ɻ • νʔϜͷ୲౰ϓϩμΫτ: • LINEελϯϓɺLINEண͔ͤ͑ɺLINE STOREɺLINE΢ΥϨοτʢͷαʔ όʔαΠυʣ •

    ·ͱΊͯࣾ಺Ͱ͸௨শ LINE Shop νʔϜ ࣗݾ঺հ: HARUKI SATO @singing_hacky https://github.com/haruki-sugarsun
  3. େن໛αʔϏεʹͱͬͯͷ ϚΠΫϩαʔϏε

  4. • εέʔϧΞοϓ • ୯ମͷϦιʔεʢe.g. αʔόʔʣΛ૿ڧ͢Δ • εέʔϧΞ΢τ • ଟ͘ͷϦιʔεΛฒ΂ͯશମΛ૿ڧ͢Δ •

    ϚΠΫϩαʔϏε͸εέʔϧΞ΢τͱ਌࿨ੑ͕ߴ͍ େن໛αʔϏεʹͱͬͯͷϚΠΫϩαʔϏε
  5. ৽य़ LINE͓Έ͘͡ͷࣄྫ

  6. None
  7. ؆ུ൛ΞʔΩςΫνϟ DB Apache Kafka LINE Service Web Application Event Consumer

    Users Messaging API ߪೖΠϕϯτ
  8. ؆ུ൛ΞʔΩςΫνϟ DB Apache Kafka LINE Service Web Application Event Consumer

    Users Messaging API ߪೖΠϕϯτ ৽ن࣮૷෦෼
  9. • Web Application ෦෼ • Ϣʔβʔ͕୹࣌ؒʹɾେྔʹΞΫηε͢Δ෦෼ • ͳΔ΂͘௿ϨΠςϯγʔɾInternal Server Error

    ͸ݟͤͨ͘ͳ͍ • → ͋Β͔͡ΊେྔʹinstanceΛฒ΂͓ͯ͘ • → ͋ͱ͔Β࡟ݮͰ͖Δ • Event Consumer ෦෼ • ඇಉظͳॲཧ • εϧʔϓοτ͕े෼͋Ε͹ଟগͷ஗Ԇ͸ڐ༰͞ΕΔ • ࣮֬ʹॲཧ͢Δ͜ͱ͕େࣄ • → ඞཁे෼ͳॲཧೳྗΛ֬อ͓ͯ͘͠ ؆ུ൛ࣄྫ
  10. • ਝ଎ʹ৽ن։ൃͰ͖ͨཧ༝ • طଘͷϚΠΫϩαʔϏεΛ׆༻ • ϢʔβʔೝূɾMessaging APIɾApache Kafka • Apache

    Kafka ʹΑΔඇಉظॲཧͷ࢓૊ΈΛࣄલʹ४උ • Protocol Buffers Λ༻͍ͯޓ׵ੑΛҡ࣋ͭͭ͠มߋՄೳͳ࢓૊Έ • ελϯϓγϣοϓͰ͸ɺ2017೥ʹར༻։࢝͠ɺෳ਺νʔϜ͔Βར༻ྫଟ਺ ʢࠓճͷࣄྫ͸ۃΊͯ؆ུԽͨ͠όʔδϣϯͳͷͰɺ࣮ࡍʹ͸ͦΕͧΕͷ಺ଆͰར༻͢ ΔετϨʔδͳͲؚΊͯϚονͨ͠બఆΛ͢Δʣ ؆ུ൛ࣄྫ
  11. ࠶ར༻ՄೳͳϚΠΫϩαʔϏε

  12. • ҋӢʹϚΠΫϩαʔϏεΛ෼ׂ͢Ε͹ྑ͍΋ͷͰ͸ͳ͍ • େલఏͱͯ͠؅ཧର৅͸গͳ͍΄͏ָ͕ʢαʔϏε਺ɾinstance਺ʣ • “well-shared and well-separated” ͕νʔϜ಺ํ਑ •

    Α͋͘ΔϚΠΫϩαʔϏεԽํ਑ • Α͘࠶ར༻͞Ε͏Δཁૉ • ೝূج൫ɾϩΪϯάج൫ɾϞχλϦϯάج൫ͳͲ͸యܕత • ҰՕॴʹ·ͱΊ͓͖͍ͯͨཁૉ • TransactionͳͲ • ຊ࣭తʹ෼ࢄγεςϜʹͳΔͷͰɺߟྀ͢Δࣄ͕͍͔ͭ͋͘Δ • ωοτϫʔΩϯάͷ஌ࣝɾܦݧɾదͨ͠πʔϧ • ෼ࢄγεςϜͷ஌ࣝɾܦݧɾదͨ͠πʔϧ • ޓ׵ੑΛҡ࣋ͨ͠ rolling update ϚΠΫϩαʔϏεઃܭͷํ਑ྫ
  13. • Armeria • https://line.github.io/armeria/ • API server/client library for modern

    Java • ϚΠΫϩαʔϏεͷͨΊͷػೳ • VerdaʢϓϥΠϕʔτΫϥ΢υʣ • Private X as a service (ϓϩμΫγϣϯ؀ڥͰఏڙத) • VM, Bare-metal, Load Balancer, Managed Database (MySQL, Redis, Elasticsearch), Managed Pub/Sub(Apache Kafka), Storage • Kubernetes as a service, Function as a service͸࣮ূ࣮ݧதͰɺ೥಺ʹஈ֊ తʹϓϩμΫγϣϯ؀ڥʹఏڙ༧ఆ • ϩΪϯάɾϞχλϦϯάج൫ • ࣾ಺ϏοάσʔλͷͨΊͷॲཧج൫ औΓ૊Έࣄྫ
  14. ·ͱΊ

  15. • ϚΠΫϩαʔϏεͷϝϦοτ • ϚΠΫϩαʔϏε͝ͱͷϦιʔεͷ࠷దԽ • ϚΠΫϩαʔϏε͝ͱͷվળ͕͠΍͍͢ • αʔϏεల։ͷਝ଎Խ • ϚΠΫϩαʔϏεͷ՝୊ɾ஫ҙ఺

    • APIͷઃܭ͕ॏཁʹͳΔ • શମ͕ෳࡶܥʹͳΓ΍͍͢ • ҋӢʹ෼ׂ͢ΔͷͰ͸ͳ͘ well-shared and well-separated ·ͱΊ
  16. • ϝϦοτ͸ͱ͘ʹن໛͕େ͖͘ͳΔ৔߹ʹݦஶ • ΤϯυϢʔβʔ޲͚ͷΠϯλʔωοταʔϏε͸ن໛͸େ͖͘ͳΓ͕ͪ • εέʔϧΞ΢τͱ਌࿨ੑ͕ߴ͍ • ຊ࣭తʹ෼ࢄɾฒྻίϯϐϡʔςΟϯάʹͳΔ • Ծ૝ԽɾωοτϫʔΫɾ෼ࢄίϯϐϡʔςΟϯάͷؔ࿈ٕज़ͷਐԽʹࢧ͑ΒΕ͍ͯΔ

    • ཁૉٕज़͸Ϣʔβʔ޲͚αʔϏεҎ֎Ͱ΋༗ޮ • ϓϥΠϕʔτΫϥ΢υؚΊɺʮΫϥ΢υαʔϏεʯ͸ଟ͘ͷؔ࿈αʔϏεΛఏڙ • ͦΕΛબ୒ͯ͠૊Έ߹ΘͤΔ ʴΞϧϑΝ
  17. THANK YOU
 & DISCUSSION?