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

LINE Developers

June 13, 2019
Tweet

More Decks by LINE Developers

Other Decks in Technology

Transcript

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

    View full-size slide

  2. • LINE ͰɺαʔόʔαΠυ։ൃνʔϜͷϚωʔδϟʔΛ͍ͯ͠·͢ɻ
    • νʔϜͷ୲౰ϓϩμΫτ:
    • LINEελϯϓɺLINEண͔ͤ͑ɺLINE STOREɺLINE΢ΥϨοτʢͷαʔ
    όʔαΠυʣ
    • ·ͱΊͯࣾ಺Ͱ͸௨শ LINE Shop νʔϜ
    ࣗݾ঺հ: HARUKI SATO
    @singing_hacky
    https://github.com/haruki-sugarsun

    View full-size slide

  3. େن໛αʔϏεʹͱͬͯͷ
    ϚΠΫϩαʔϏε

    View full-size slide

  4. ● εέʔϧΞοϓ
    ● ୯ମͷϦιʔεʢe.g. αʔόʔʣΛ૿ڧ͢Δ
    ● εέʔϧΞ΢τ
    ● ଟ͘ͷϦιʔεΛฒ΂ͯશମΛ૿ڧ͢Δ
    ● ϚΠΫϩαʔϏε͸εέʔϧΞ΢τͱ਌࿨ੑ͕ߴ͍
    େن໛αʔϏεʹͱͬͯͷϚΠΫϩαʔϏε

    View full-size slide

  5. ৽य़ LINE͓Έ͘͡ͷࣄྫ

    View full-size slide

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

    View full-size slide

  7. ؆ུ൛ΞʔΩςΫνϟ
    DB
    Apache Kafka
    LINE Service
    Web Application Event Consumer
    Users
    Messaging API
    ߪೖΠϕϯτ
    ৽ن࣮૷෦෼

    View full-size slide

  8. ● Web Application ෦෼
    ● Ϣʔβʔ͕୹࣌ؒʹɾେྔʹΞΫηε͢Δ෦෼
    ● ͳΔ΂͘௿ϨΠςϯγʔɾInternal Server Error ͸ݟͤͨ͘ͳ͍
    ● → ͋Β͔͡ΊେྔʹinstanceΛฒ΂͓ͯ͘
    ● → ͋ͱ͔Β࡟ݮͰ͖Δ
    ● Event Consumer ෦෼
    ● ඇಉظͳॲཧ
    ● εϧʔϓοτ͕े෼͋Ε͹ଟগͷ஗Ԇ͸ڐ༰͞ΕΔ
    ● ࣮֬ʹॲཧ͢Δ͜ͱ͕େࣄ
    ● → ඞཁे෼ͳॲཧೳྗΛ֬อ͓ͯ͘͠
    ؆ུ൛ࣄྫ

    View full-size slide

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

    View full-size slide

  10. ࠶ར༻ՄೳͳϚΠΫϩαʔϏε

    View full-size slide

  11. ● ҋӢʹϚΠΫϩαʔϏεΛ෼ׂ͢Ε͹ྑ͍΋ͷͰ͸ͳ͍
    ● େલఏͱͯ͠؅ཧର৅͸গͳ͍΄͏ָ͕ʢαʔϏε਺ɾinstance਺ʣ
    ● “well-shared and well-separated” ͕νʔϜ಺ํ਑
    ● Α͋͘ΔϚΠΫϩαʔϏεԽํ਑
    ● Α͘࠶ར༻͞Ε͏Δཁૉ
    ● ೝূج൫ɾϩΪϯάج൫ɾϞχλϦϯάج൫ͳͲ͸యܕత
    ● ҰՕॴʹ·ͱΊ͓͖͍ͯͨཁૉ
    ● TransactionͳͲ
    ● ຊ࣭తʹ෼ࢄγεςϜʹͳΔͷͰɺߟྀ͢Δࣄ͕͍͔ͭ͋͘Δ
    ● ωοτϫʔΩϯάͷ஌ࣝɾܦݧɾదͨ͠πʔϧ
    ● ෼ࢄγεςϜͷ஌ࣝɾܦݧɾదͨ͠πʔϧ
    ● ޓ׵ੑΛҡ࣋ͨ͠ rolling update
    ϚΠΫϩαʔϏεઃܭͷํ਑ྫ

    View full-size slide

  12. ● 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͸࣮ূ࣮ݧதͰɺ೥಺ʹஈ֊
    తʹϓϩμΫγϣϯ؀ڥʹఏڙ༧ఆ
    ● ϩΪϯάɾϞχλϦϯάج൫
    ● ࣾ಺ϏοάσʔλͷͨΊͷॲཧج൫
    औΓ૊Έࣄྫ

    View full-size slide

  13. ● ϚΠΫϩαʔϏεͷϝϦοτ
    ● ϚΠΫϩαʔϏε͝ͱͷϦιʔεͷ࠷దԽ
    ● ϚΠΫϩαʔϏε͝ͱͷվળ͕͠΍͍͢
    ● αʔϏεల։ͷਝ଎Խ
    ● ϚΠΫϩαʔϏεͷ՝୊ɾ஫ҙ఺
    ● APIͷઃܭ͕ॏཁʹͳΔ
    ● શମ͕ෳࡶܥʹͳΓ΍͍͢
    ● ҋӢʹ෼ׂ͢ΔͷͰ͸ͳ͘ well-shared and well-separated
    ·ͱΊ

    View full-size slide

  14. ● ϝϦοτ͸ͱ͘ʹن໛͕େ͖͘ͳΔ৔߹ʹݦஶ
    ● ΤϯυϢʔβʔ޲͚ͷΠϯλʔωοταʔϏε͸ن໛͸େ͖͘ͳΓ͕ͪ
    ● εέʔϧΞ΢τͱ਌࿨ੑ͕ߴ͍
    ● ຊ࣭తʹ෼ࢄɾฒྻίϯϐϡʔςΟϯάʹͳΔ
    ● Ծ૝ԽɾωοτϫʔΫɾ෼ࢄίϯϐϡʔςΟϯάͷؔ࿈ٕज़ͷਐԽʹࢧ͑ΒΕ͍ͯΔ
    ● ཁૉٕज़͸Ϣʔβʔ޲͚αʔϏεҎ֎Ͱ΋༗ޮ
    ● ϓϥΠϕʔτΫϥ΢υؚΊɺʮΫϥ΢υαʔϏεʯ͸ଟ͘ͷؔ࿈αʔϏεΛఏڙ
    ● ͦΕΛબ୒ͯ͠૊Έ߹ΘͤΔ
    ʴΞϧϑΝ

    View full-size slide

  15. THANK YOU

    &
    DISCUSSION?

    View full-size slide