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

マイクロサービス化を支える継続的切り替え術

Shia
August 24, 2019

 マイクロサービス化を支える継続的切り替え術

Shia

August 24, 2019
Tweet

More Decks by Shia

Other Decks in Technology

Transcript

  1. ϚΠΫϩαʔϏεԽΛࢧ
    ͑Δܧଓత੾Γସ͑ज़
    TIJB!ΫοΫύου

    View full-size slide

  2. ࣗݾ঺հ
    w γϜαϯϤϯ !TIJB

    w ΫοΫύουגࣜձࣾ

    View full-size slide

  3. ࠓ೔ͷ࿩͸
    wϞόΕͽ෼཭
    ‣ γεςϜ෼཭࣌ͷ੾Γସ͑ઓུ

    View full-size slide

  4. ϞόΕͽͱ͸
    wΨϥέʔ޲͚ͷαʔϏε
    wػೳ௥Ճ͸΄΅͍ͯ͠ͳ͍
    wΞΫςΟϒͳϢʔβʔ͸ݮΒͳ͍

    View full-size slide

  5. ෼཭ͷ֓ཁ

    View full-size slide

  6. ෼཭ͷϙΠϯτ
    wڊେͳϞϊϦγοΫΞϓϦ͔Βͷ෼཭
    w"1*ܦ༝ͰϦιʔεΛऔಘ͢Δ
    ‣ %#XJUIOαʔϏε͸ਏ͍
    ‣ ͢Ͱʹ࢖͑ΔϦιʔε"1*͕͋Δ

    View full-size slide

  7. ෼཭ͷϙΠϯτ
    DB

    View full-size slide

  8. ෼཭ͷϙΠϯτ
    DB
    API αʔϏε

    View full-size slide

  9. ෼཭ͷϙΠϯτ
    w݁ՌɺϏδωεϩδοΫ͸΄΅࠶࣮૷ʹ

    View full-size slide

  10. ෼཭ͷن໛ײ
    wΤϯυϙΠϯτͷ਺͸ݸ΄Ͳ
    w෼཭ݩίʔυ͸໿ສߦ΄Ͳ

    View full-size slide

  11. ੾Γସ͑ઓུΛߟ͑Δ

    View full-size slide

  12. ཁ݅
    wҰؾʹ੾Γସ͑ͳ͍ʂʂʂʂʂ
    ‣ ࣄނͬͨ৔߹ɺ֬ೝ͠ͳ͍ͱ͍͚ͳ͍ίʔ
    υͷ෼ྔ͕ଟ͍
    ‣ ͦ΋ͦ΋ࣄނΔ֬཰͕ߴ͍͔Β΍Ί͓͍ͯ
    ͨ΄͏͕͍͍

    View full-size slide

  13. ͭ·ΓɺͲͬͪʹྲྀ͔͢
    Ͱ͖Δ͚ͩࡉ੍͔͘ޚ͍ͨ͠

    View full-size slide

  14. چαʔϏε
    ཁ݅
    ৽αʔϏε
    GET /recipes

    View full-size slide

  15. چαʔϏε
    ཁ݅
    ৽αʔϏε
    ͦΕҎ֎
    GET /recipes

    View full-size slide

  16. ख๏MPDBUJPOͰؤுΔ
    location /recipes {
    proxy_pass new_service;
    }
    location / {
    proxy_pass old_service;
    }

    View full-size slide

  17. چαʔϏε
    ৽αʔϏε
    ͦΕҎ֎
    GET /recipes
    ख๏MPDBUJPOͰؤுΔ

    View full-size slide

  18. ख๏MPDBUJPOͰؤுΔ
    ࣮૷Λ༻ҙ͢Δ
    ৽αʔϏεΛσϓϩΠ
    /(*/9ͷઃఆΛߋ৽ͯ͠Ϧϩʔυ

    View full-size slide

  19. ख๏MPDBUJPOͰ͸ؤுΕͳ͍
    wσϓϩΠຖʹ/(*/9ͷઃఆΛॻ͖௚͠
    ͍ͨʁ
    wύε͸ಉ͚ͩ͡Ͳॲཧ͸ҧ͏৔߹͸ʁ
    ‣ (&5SFDJQFTWT1045SFDJQFT

    View full-size slide

  20. ਅͷཁ݅
    w੾Γସ͑खॱΛ؆୯ʹ͍ͨ͠
    wΤϯυϙΠϯτ ΞΫγϣϯ
    ୯ҐͰ੾
    Γସ͍͑ͨ

    View full-size slide

  21. ৽αʔϏεʹ੾Γସ͑ͷ
    ܾఆݖΛҠৡ͢Δ

    View full-size slide

  22. w৽αʔϏε͸
    ‣ ॲཧՄೳͳΒॲཧͯ͠ฦ͢
    ‣ ແཧͳΒແཧͱฦ͢
    ख๏੾Γସ͑ͷܾఆݖΛҠৡ͢Δ

    View full-size slide

  23. ख๏੾Γସ͑ͷܾఆݖΛҠৡ͢Δ
    چαʔϏε
    ৽αʔϏε

    View full-size slide

  24. ख๏੾Γସ͑ͷܾఆݖΛҠৡ͢Δ
    چαʔϏε
    ৽αʔϏε
    GET /recipes
    200 OK
    200 OK

    View full-size slide

  25. ख๏੾Γସ͑ͷܾఆݖΛҠৡ͢Δ
    چαʔϏε
    ৽αʔϏε
    GET /recipes Ҏ֎
    ະ࣮૷ͩΑʂʂ

    View full-size slide

  26. ख๏੾Γସ͑ͷܾఆݖΛҠৡ͢Δ
    چαʔϏε
    ৽αʔϏε
    GET /recipes Ҏ֎
    200 OK
    200 OK
    ະ࣮૷ͩΑʂʂ

    View full-size slide

  27. w৽αʔϏεଆΛσϓϩΠ͢Δ͚ͩͰ͢΂
    ͕ͯ׬݁͢Δ
    ख๏੾Γସ͑ͷܾఆݖΛҠৡ͢Δ

    View full-size slide

  28. ख๏࣮૷ྫ
    upstream backend {
    server new_service max_fails=0;
    server old_service backup;
    }
    server {
    location / {
    proxy_next_upstream http_503 non_idempotent;
    proxy_pass backend;
    }
    }
    ৄ͍͠આ໌͸͜͜ͰݟΕ·͢
    https://techlife.cookpad.com/entry/2019/03/05/115000

    View full-size slide

  29. ऴΘΓ
    wͪΐͬͱؤுΕ͹ࡉ͔͍୯ҐͰɺ҆શʹ
    ָͯ͠੾Γସ͕͑Ͱ͖Δ

    View full-size slide