serverside-development-and-kaizen-with-golang

 serverside-development-and-kaizen-with-golang

E48409e5c7d5b8919b03d3d3c4a40da7?s=128

azihsoyn

May 18, 2016
Tweet

Transcript

  1. GoαʔόͷϦϦʔεΛ͍͔ʹͯ͠ݮΒ͔ͨ͠ Gunosy Inc. 2016.5 @azihsoyn

  2. ©Gunosy Inc. 2 ࣗݾ঺հ ▪ azihsoyn – Twitter – Github

    – …etc ▪ ۀ຿ – GoͰAPIαʔόͷ։ൃɾӡ༻ ▪ झຯ – ௼Γ(5ׂ) • γʔόεΛϧΞʔͰ • ←͸ઌ೔௼ͬͨγʔόεͰ͢ – Ξχϝ(4ׂ) • ࠓظNo.1͸ࡾऀࡾ༿ – ։ൃ(1ׂ) • Androidͱ͔ @azihsoyn (͋͡;ͦ΍ΜͬͯಡΉΒ͍͠)
  3. ©Gunosy Inc. 3 ͍͖ͳΓͰ͕͢ɺA/Bςετͯ͠·͔͢ʁ

  4. ©Gunosy Inc. 4 Gunosyͷࣾ෩ ▪ ৽ػೳͷެ։ ▪ هࣄͷॱং ▪ νϡʔτϦΞϧ

    ▪ จݴมߋ ▪ ޿ࠂग़͠෼͚ ▪ …etc ਺ࣈ͕ਆΑΓਖ਼͍͠ = (جຊతʹ) ͲΜͳࢪࡦ΋A/Bςετͯ͠ɺޮՌ͕ͳ͔ͬͨΒ΍ΊΔ શ෦A/Bςετ͠·͢
  5. ©Gunosy Inc. 5 ͲͷΑ͏ʹӡ༻͍͔ͯͨ͠ ͦ΋ͦ΋ϋʔυίʔσΟϯάͩͬͨ

  6. ©Gunosy Inc. 6 ͲͷΑ͏ʹӡ༻͍͔ͯͨ͠ ͦ΋ͦ΋ϋʔυίʔσΟϯάͩͬͨ ݻఆ஋ʂʂA/Bͱ͸… ·͔͞ͷ਺஋ʂʂ ͜ͷϢʔβʔʹͨ͠ҙຯ͕ίʔυ͔ΒΘ͔Βͳ͍

  7. ©Gunosy Inc. 7 ͲͷΑ͏ʹӡ༻͍͔ͯͨ͠ ▪ A/B։͍࢝ͨ͠ਓ͕ϓϧϦΫΛૹΔ – ίʔυमਖ਼ – ςετ௥Ճ

    ▪ APIνʔϜ͕ϨϏϡʔ ▪ Ϛʔδ ▪ ϦϦʔε࡞ۀ – git flow – stagingͰಈ࡞֬ೝ – ϦϦʔε࿈བྷ – σϓϩΠ ϋʔυίʔσΟϯάͱ͍͏͜ͱ͸ɺɺɺ ऴྃ࣌΋ಉ༷ͷϑϩʔʂʂ
  8. ©Gunosy Inc. 8 ͜͏͍͏ґཔׂ͕ΓͱΧδϡΞϧʹདྷΔ

  9. ©Gunosy Inc. 9 ໰୊఺ ▪ A/Bςετͷ։࢝ɾมߋɾऴྃʹ͔͔Δίετ͕ߴ͍ – ࠓ೔தʹ͓ئ͍͠·͢ͱ͔ͩͱ1͙࣌ؒΒ͍༨༟Ͱ௵ΕΔ – ࣗ෼ͷ࡞ۀ͕Ͱ͖ͳ͍

    ▪ ͍ΖΜͳνʔϜ͔ΒA/Bͷґཔ͕͘ΔͷͰϦϦʔεස౓΋ଟ͘ͳΔ – 1ϦϦʔε/4.4dayͩͬͨ – ϦϦʔε೔ΛίϯτϩʔϧͰ͖ͳ͍ ▪ ਖ਼ࣜͳϦϦʔεΛ൐͏ͷͰɺٸͳґཔʹରԠͰ͖ͳ͍ – ΋͏developʹϚʔδͯͨ͠ͷʹɺɺɺͱ͔ – ༵ۚ೔ʹA/BΛ։࢝ͨ͘͠ͳ͍ ▪ ίʔυ͔ΒA/Bςετ͕Ͳ͏͍͏ঢ়ଶͳͷ͔Θ͔Βͳ͍ – ΋͏ऴΘͬͨͷ͔ – ͍͔ͭΒ΍ͬͯΔͷ͔
  10. ©Gunosy Inc. 10 Ͳ͏վળ͔ͨ͠

  11. ©Gunosy Inc. 11 A/BςετʹؔΘΔίʔυΛ֎෦ઃఆϑΝΠϧԽ

  12. ©Gunosy Inc. 12 ΍ͬͨ͜ͱ ▪ ෆཁͳ(ऴྃͨ͠)A/BςετͷίʔυΛ࡟আ ▪ ඞཁͳม਺ͷચ͍ग़͠ – ϢʔβʔID,

    OSछผ, ΞϓϦόʔδϣϯ,… ▪ ඞཁͳϩδοΫͷચ͍ग़͠ – mod, ൣғ, Ұக, … ▪ ઃఆϑΝΠϧͷϑΥʔϚοτ – json, yaml, toml, go, ಠࣗDSL… ▪ ઃఆϑΝΠϧ͔Βಈతʹܭࢉ͢ΔϥΠϒϥϦ୳͠ ▪ ӡ༻ํ๏ ཁ͸ϦϑΝΫλϦϯά
  13. ©Gunosy Inc. 13 ෆཁͳA/BςετͷίʔυΛ࡟আ ▪ ຊ౰ʹϨεϙϯεฦ͞ͳͯ͘໰୊ͳ͍͔ʁ – ݻఆ஋͚ͩͲΞϓϦ͕ύʔεͯ͠Δ͔΋ – →Ϩεϙϯε͔Β࡟আͨ͠ΒΫϥογϡ͢Δ͔΋

    ▪ ͦ΋ͦ΋android͚ͩɺios͚ͩͷͨΊͷϑΟʔϧυͱ͔͋ͬͨ ؆୯ͳ͜ͱͰ͸ͳ͔ͬͨ… ΞϓϦνʔϜʹڠྗͯ͠΋Β͍ͳ͕ΒͳΜͱ͔ୀ࣏
  14. ©Gunosy Inc. 14 ඞཁͳม਺ͷચ͍ग़͠ ▪ ϢʔβʔID – Θ͔Δ ▪ OS

    – ·͊Θ͔Δ ▪ ΞϓϦόʔδϣϯ – ΞϓϦΛߋ৽͠ͳ͍ͱA/B։࢝Ͱ͖ͳ͍͸ͣͳͷͰ͍Βͳ͍͸ͣ – ࡟আ ▪ ܕ – boolҎ֎ฦ͞ͳ͍ ϢʔβʔID͚ͩͰ͍͍͸ͣ
  15. ©Gunosy Inc. 15 ඞཁͳϩδοΫͷચ͍ग़͠ ▪ mod ▪ in ▪ is

    ▪ and/or ▪ ݻఆ஋ – ݻఆ஋ฦͯ͠ΔͳΒA/BऴྃͰ͍͍͸ͣ – ޙํޓ׵ͷͨΊʹ࢓ํͳ͘ɺɺɺ ▪ span – ظؒࢦఆͰ͖ΔΑ͏ʹ௥Ճ ͕͜͜Ұ൪೰Μͩɺɺɺ
  16. ©Gunosy Inc. 16 ઃఆϑΝΠϧͷϑΥʔϚοτ jsonҰ୒(طʹଞͷઃఆϑΝΠϧ΋jsonͩͬͨ)

  17. ©Gunosy Inc. 17 ઃఆϑΝΠϧ͔Βಈతʹܭࢉ͢ΔϥΠϒϥϦ୳͠ ▪ ͋Δʹ͸͋ͬͨ – https://github.com/mattn/anko – https://github.com/Knetic/govaluate

    ▪ ࣗ༝ա͗ΔͱٯʹࣄނΓͦ͏ – ͔ͿͬͪΌ͍͚ͳ͍Ϣʔβʔʹద༻ͪ͠Όͬͨͱ͔ ▪ goͷ੩తܕ෇͚ͷϝϦοτ͕ࣦΘΕΔ ▪ ٯʹ੍ݶ͍ͯ͘͠ํ޲ʹγϑτ phpͷeval(bashͷexpr)Έ͍ͨͳͷ͕ཉ͍͠ɺɺɺ ͦ͏ࢥ͍ͬͯͨ࣌ظ͕Զʹ΋͋Γ·ͨ͠ ࣗલͰϥΠϒϥϦ࡞ͬͨ
  18. ©Gunosy Inc. 18 ӡ༻ํ๏ ▪ ઃఆϑΝΠϧΛ௚઀ฤू͢Δͷʁ – ؆୯ͳjsonͩͬͨΒ·ͩ͠΋… – ଞͷਓʹઃఆϑΝΠϧฤूͯ͠΋Β͏ͱࣄނ͕ා͍

    ▪ A/Bςετ͕Ͳ͏͍͏ঢ়ଶ͔෼͔Βͳ͍໰୊΋ղܾͯ͠ͳ͍ – ͔ͱ͍ͬͯ؅ཧπʔϧΘ͟Θ͟࡞Δͷ΋… issueͰ؅ཧ͢Δͷ͸͙ܾ͢·͕ͬͨ
  19. ©Gunosy Inc. 19 ͦΕɺGoogle εϓϨουγʔτͰͰ͖·͢Α GAS+S3Λ࢖ͬͯαʔϏεӡӦ޲͚ઃఆπʔϧΛ௒ઈ؆୯ʹ࡞੒͢Δํ๏ http://qiita.com/hirokidaichi/items/769e330284302a799095

  20. ©Gunosy Inc. 20 ͜ΜͳεϓϨουγʔτ͔Β

  21. ©Gunosy Inc. 21 ͜ΜͳjsonΛੜ੒ { "enable_A_ab_test": [ { "fixed": true

    } ],... "enable_F_ab_test": [ { "span": { "start": "2016-02-15T00:00:00+09:00", "end": null }, "mod": { "value_key": "user_id", "divisor": 20, "values": [ 0,1,2,3,4,5,6,7,10 ] }, "is": { "value_key": "os", "value": "ios" } } ],... }
  22. ©Gunosy Inc. 22 Ϙλϯ1ൃͰS3ʹΞοϓϩʔυ ͋ͱ͸OpsWorksͰۭσϓϩΠ͢Δ͚ͩ

  23. ©Gunosy Inc. 23 ӡ༻ํ๏ ▪ A/B։͍࢝ͨ͠ਓ͕issueΛىථ – 1 A/B 1

    issue – ׂ߹มߋ͸௥ه – ऴྃ࣌ʹclose ▪ APIνʔϜ͕εϓϨουγʔτͰϙνϙνฤू – Ϙλϯ1ͭͰjsonʹม׵ͯ͠S3ʹΞοϓϩʔυ ▪ ઃఆϑΝΠϧΛ࠶ಡࠐ͢ΔͨΊʹۭσϓϩΠ – εςʔδϯάͰͷݕূ͸جຊ͍ͯ͠ͳ͍ – → ͢Ͱʹಈ͍͍ͯͨίʔυͳͷͰͳΜͷෆ҆΋ͳ͍ͨΊ ࠷ऴతʹ͜͏ͳͬͨ 15෼͙Β͍ͰऴΘΔ
  24. ©Gunosy Inc. 24 վળ఺ ▪ Ұճͷ࡞ۀ͕࣌ؒ15෼ʹ୹ॖʂ – ࡞ۀͷ߹ؒʹͰ͖Δ ▪ ϦϦʔεස౓͕1ճ/4.4day

    → 1ճ/7.5dayʹʂ – ϦϦʔε೔ΛίϯτϩʔϧͰ͖ΔΑ͏ʹͳͬͨ ▪ ༵ۚ೔Ͱ΋A/Bͷ։࢝ɾมߋɾऴ͕ྃͰ͖ΔΑ͏ʹͳͬͨ – ࢪࡦΛ஗Βͤͳ͍ ▪ εϓϨουγʔτͰA/Bςετͷঢ়ଶ͕ݟ΍͘͢ͳͬͨ େମ໰୊఺͸ղܾͰ͖ͨ
  25. ©Gunosy Inc. 25 ՝୊΋·ͩ͋Δ ▪ ͦ΋ͦ΋εϓϨουγʔτͰ؅ཧͬͯͲ͏ͳͷʁ – ཤྺͱ͔ݖݶͱ͔ – ཧ૝͸ผγεςϜʹ͍ͨ͠…

    ▪ ؾܰʹมߋͰ͖Δͷ͸͍͍͚ͲɺώϡʔϚϯΤϥʔ͕ى͖΍͘͢ͳͬͨ – A/BࢭΊͨ͸͕ͣࢭ·ͬͯͳ͔ͬͨͱ͔ ▪ ۭσϓϩΠ΋ΊΜͲ͍͘͞ – ఆظతʹ࠶ಡࠐ͢Δʁ(͜Ε͸͍ۙ͏ͪʹͰ͖ͦ͏) ▪ ϩδοΫͷมߋ࣌͸ʁ – ௚ۙͷ՝୊
  26. ©Gunosy Inc. 26 ·ͱΊ ▪ jsonศར ▪ ϓϩηεΩϟογϡ΋ศར – ىಈ࣌ʹઃఆϑΝΠϧಡΈࠐΉ

    ▪ ൚༻ੑΑΓ੍ݶ͢Δํ޲Ͱߟ͑Δ – interfaceଟ༻͢Δ͜ͱʹͳΔͷͰGoͷ੩తܕ෇͚ͷϝϦοτ͕ࣦΘ Εͯ͠·͏ ▪ શ෦ࣗલͰ࡞ΔͷͰ͸ͳ͘ɺ͋Δ΋ͷΛ૊Έ߹Θͤͯ࡞Δ – ؤுͬͯ؅ཧπʔϧ࡞Ζ͏ͱ͠ͳͯ͘Α͔ͬͨ – εϓϨουγʔτ࠷ߴա͗Δ
  27. ©Gunosy Inc. 27 ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

  28. ©Gunosy Inc. 28 ͦͷଞࢿྉ ▪ https://github.com/mattn/anko – phpͷevalతͳͷΛgoͰ୳ͯ͠ ▪ https://github.com/Knetic/govaluate

    – phpͷevalతͳͷΛgoͰ୳ͯ͠ ▪ https://github.com/guregu/buildver – όʔδϣϯ൪߸ൺֱ͢ΔϥΠϒϥϦ ▪ http://qiita.com/hirokidaichi/items/769e330284302a799095 – εϓϨουγʔτ͔ΒS3ʹΞοϓϩʔυ ͓ੈ࿩ʹͳͬͨϥΠϒϥϦͱ͔