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

RPA実行環境のFargateへの移行 / Migrating RPA Infrastructure to Fargate

RPA実行環境のFargateへの移行 / Migrating RPA Infrastructure to Fargate

yuki-yano

June 12, 2019
Tweet

More Decks by yuki-yano

Other Decks in Technology

Transcript

  1. RPA࣮ߦ؀ڥͷ
    Fargate΁ͷҠߦ
    BizteXגࣜձࣾ ໼໺ ༟थ

    View full-size slide

  2. ΞδΣϯμ
    • BizteX cobit αʔϏεͷ঺հ
    • طଘͷΠϯϑϥߏ੒ʹ͍ͭͯ
    • FargateҠߦʹࢸͬͨܦҢ
    • ݕূ/੾Γସ͑
    • FargateԽ͕΋ͨΒͨ͠ޮՌ
    • FargateҠߦͰൃੜͨ͠໰୊
    • ࠓޙͷల๬

    View full-size slide

  3. αʔϏε঺հ
    ࠃ಺ॳΫϥ΢υ31"

    View full-size slide

  4. ਓ͕ۀ຿Λ࣮ߦ
    ैདྷͷ࡞ۀ 31"
    σδλϧϩϘο
    τ͕ۀ຿Λ୅ߦ
    ೖྗ ݕࡧ ूܭ ొ࿥ ૹ৴
    ܁Γฦ͠ߦ͏
    ೖྗ ݕࡧ ूܭ ొ࿥ ૹ৴
    "VUPNBUJPO
    ਓʹ୅ΘΓσδλϧϩϘοτ͕ 1$ ্ͷಈ࡞Λ୅ߦ
    3PCPUJD1SPDFTT"VUPNBUJPO

    View full-size slide

  5. ैདྷͷ31"ΑΓ΋؆୯ɾεϐʔσΟʔɾ௿ίετ
    ΦϯϓϨϛεܕ
    ߏஙظ͕ؒ௕͍
    ઐ໳త
    ίετ͕ߴ͍
    εϐʔσΟʔͳಋೖ
    ୭Ͱ΋Χϯλϯ
    ௿ίετ
    Ϋϥ΢
    υܕ

    View full-size slide

  6. طଘͷΠϯϑϥߏ੒
    "84
    ΫϥΠΞϯτ
    8 αʔό 4JEFLJR
    ΞϓϦέʔγϣϯαʔό
    &$ Πϯελϯε
    &$4
    3%4 3FEJT
    4FMFOJVN 4FMFOJVN
    ϩϘ࣮ߦ
    ϩϘ࣮ߦ

    View full-size slide

  7. Πϯϑϥͷ՝୊
    • Sidekiq͕ϝϞϦෆ଍Ͱམͪͨࡍʹෳ਺ͷϩ
    ϘοτΛר͖ࠐΉʢސ٬΁ͷӨڹʣ
    • ΞϓϦέʔγϣϯαʔόͱϩϘ࣮ߦαʔό͕
    ಉҰΠϯελϯεͰಈ࡞͍ͯ͠Δ͜ͱʹΑΔ
    ໰୊ͷ੾Γ෼͚ͷࠔ೉͞
    • ࣌ؒʹΑͬͯඞཁͳϦιʔεྔ͕ҧ͏͜ͱʹ
    ର͢Δ࠷దԽͷෆ଍

    View full-size slide

  8. Πϯϑϥͷ՝୊
    • Sidekiq͕ϝϞϦෆ଍Ͱམͪͨࡍʹෳ਺ͷϩ
    ϘοτΛר͖ࠐΉʢސ٬΁ͷӨڹʣ
    • ΞϓϦέʔγϣϯαʔόͱϩϘ࣮ߦαʔό͕
    ಉҰΠϯελϯεͰಈ࡞͍ͯ͠Δ͜ͱʹΑΔ
    ໰୊ͷ੾Γ෼͚ͷࠔ೉͞
    • ࣌ؒʹΑͬͯඞཁͳϦιʔεྔ͕ҧ͏͜ͱʹ
    ର͢Δ࠷దԽͷෆ଍

    View full-size slide

  9. FargateԽʹࢸͬͨܦҢ
    Πϯϑϥίετ
    ىಈ࣌ͷ

    Φʔόʔϔου
    ҆ఆ͢Δ͔
    &$
    ˓

    ΞϓϦέʔγϣϯαʔό
    ͱಉډ
    ˓

    ͳ͠
    º

    4JEFLJR͕མͪͨͱ͖ʹ
    ෳ਺ϓϩηεΛ

    ר͖ࠐΉ
    &$4

    &$

    º

    ίϯςφΠϯελϯε
    &$Πϯελϯε
    ʹ

    ՝ۚ
    ˓

    ਺ඵͰىಈ͢Δ
    ˚
    &$Πϯελϯεʹґଘ
    ͢Δ
    &$4

    'BSHBUF

    ˓

    ίϯςφͷ

    εϖοΫʹରͯ͠

    ࣌ؒ՝ۚ
    ˚

    ෼લޙ͔͔Δ
    ˓

    ಠཱ࣮ͨ͠ߦ؀ڥ

    View full-size slide

  10. Πϯϑϥίετ
    • ECS(EC2) *εέʔϧΠϯ͠ͳ͍৔߹
    • t3.2xlarge 8CPU/32GB 0.4352USD/࣌ؒ 25୆

    0.4352USD * 24࣌ؒ * 30೔ * 25୆ = ໿7800USD/݄
    • Fargate
    • 1CPU/8GB 0.05USD/1CPU࣌ؒ 0.0055USD/1GB࣌ؒ

    (0.05USD * 1CPU + 0.0055USD * 8GB) * 24࣌ؒ * 51೔

    = ໿115USD/݄

    View full-size slide

  11. ݕূ/੾Γସ͑
    • ݕূΛ҆શʹߦ͏ͨΊͷݕূ༻؀ڥͷߏங
    • Fargate༻ͷDockerΠϝʔδΛ༻ҙ
    • ෛՙࢼݧ
    • ࣮ࡍͷΠϯϑϥҠߦ

    View full-size slide

  12. ݕূ༻؀ڥߏங
    • ຊ൪؀ڥ͔͠ଘࡏ͠ͳ͔ͬͨͨΊɺࢼݧΛߦ
    ͏ͨΊͷ੾Γ཭ͨ͠؀ڥΛ৽ͨʹ࡞੒ͨ͠
    • AnsibleͱPackerͰطଘϦιʔεΛ؅ཧ͍ͯ͠
    ͨͨΊൺֱత௿ίετͰߏஙͰ͖ͨ
    • ͱ͸͍͑ࠓޙCloudFormation͔Terraform΁
    ͷҠߦ͸ߦ͍͍ͨ

    View full-size slide

  13. Fargate༻ͷDockerΠϝʔδΛ༻ҙ
    • AnsibleͷplaybookΛࢀߟʹಉ౳ͷ؀ڥΛߏங
    • Rails + JVM
    • ίετ௿
    • FargateͰRails͕ىಈͰ͖Δ͜ͱΛ֬ೝ
    • CircleCI͔ΒECRʹDockerΠϝʔδΛpush

    View full-size slide

  14. ෛՙࢼݧ
    • ಉ࣮࣌ߦ਺
    • FargateͷίϯςφΛ1CPU/8GBͷઃఆͰ200ಉ࣮࣌ߦ
    • ղܾ͍ͯ͠ͳ͍໰୊
    • ͍͔ͭ͘ͷίϯςφͷ࣮ߦ։࢝ͷ஗Ԇ(࠷େ6෼)
    • ຊ൪؀ڥͰ͸ಉ࣌ىಈ͸࠷େ20−30݅ఔ౓

    View full-size slide

  15. ࣮ࡍͷΠϯϑϥҠߦ
    • RedashͰ࠷΋ϩϘ࣮ߦͷεέδϡʔϧొ࿥͕গͳ͍࣌ؒΛௐࠪ
    • ே6࣌
    • ੾Γ໭͠ͷݕ౼
    • ؀ڥม਺ͷมߋͰϞʔυΛ੾Γସ͑Մೳʹͨ͠
    • ౰೔ʹ͍͖ͳΓCircleCI͕௨Βͳ͘ͳΔ໰୊͕ൃੜ
    • ؔ܎ͳ͍෦෼(npmύοέʔδ)Ͱى͖͍ͯͨ
    • warning͕ग़ͯΔͱ͜Ζ͸͜·Ίʹमਖ਼͠·͠ΐ͏ɾɾɾ

    View full-size slide

  16. طଘͷΠϯϑϥߏ੒
    "84
    ΫϥΠΞϯτ
    8 αʔό 4JEFLJR
    ΞϓϦέʔγϣϯαʔό
    &$ Πϯελϯε
    &$4
    3%4 3FEJT
    4FMFOJVN 4FMFOJVN
    ϩϘ࣮ߦ
    ϩϘ࣮ߦ

    View full-size slide

  17. FargateҠߦޙͷΠϯϑϥߏ੒
    "84
    ΫϥΠΞϯτ
    8 αʔό 4JEFLJR
    ΞϓϦέʔγϣϯαʔό
    &$ Πϯελϯε
    &$4
    ϩϘ࣮ߦ ϩϘ࣮ߦ
    'BSHFUF
    3%4 3FEJT
    4FMFOJVN 4FMFOJVN
    ϩϘ࣮ߦ

    View full-size slide

  18. FargateҠߦ͕΋ͨΒͨ͠ޮՌ
    • ϩϘͷ҆ఆՔಇ
    • ΞϓϦέʔγϣϯαʔόͷϦιʔε࡟ݮ
    • ϝϞϦ 64GB => 32GB
    • δϣϒʢϩϘ࣮ߦʣ͕਺೔Ҏ্ଓ͍ͯམͱͤͳ͍ঢ়ଶ
    ͷΠϯελϯεΛ࡟ݮ
    • ϝτϦΫεଌఆͷվળ

    View full-size slide

  19. FargateҠߦͰൃੜͨ͠໰୊
    • ίϯςφىಈ࣌ؒʹ͔͔ΔΦʔόʔϔου
    • ैདྷͷ࣮૷ͱFargateҠߦޙͷ࣮૷͕ࠞࡏ͍ͯ͠Δ
    • ΞϓϦέʔγϣϯαʔό͕ίϯςφԽͰ͖͍ͯͳ͍͜ͱ
    ʹىҼ͢Δ࣮ߦ؀ڥͷҧ͍
    • ίϯςφىಈͷࣦഊ
    • APIίʔϧ࣌ʹΤϥʔ
    • ίϯςφʹର͢ΔENIΞλονͷࣦഊ

    View full-size slide

  20. ίϯςφىಈ࣌ؒ
    • ECS(EC2) => 5ඵલޙ
    • Fargate => 1෼લޙ
    • ϩϘͷεέδϡʔϧ࣮ߦʹؔͯ͠͸Sidekiq͕
    λεΫΛ਺෼લʹىಈͯ͠଴ػ͓ͯ͘͜͠ͱ
    Ͱճආ

    View full-size slide

  21. ࣮ߦ؀ڥͷҧ͍
    • ߏஙํ๏͕ҟͳΔ౎߹্ɺΞϓϦέʔγϣϯαʔό(AnsibleͰ
    AMI) ͱ৽͍࣮͠ߦ؀ڥ(DockerfileͰDocker image)ʹҧ͍͕͋Δ
    • apt-getͰೖΔύοέʔδͷόʔδϣϯ͕ඍົʹҧ͏
    • ImageMagickͷσϑΥϧτઃఆͷࠩ
    • ؀ڥม਺ΛΞϓϦέʔγϣϯαʔόͱಉ౳ʹ͢Δඞཁ͕͋Δ
    • ඞཁͳ؀ڥม਺ΛΞϓϦέʔγϣϯαʔό͔Β౉͢͜ͱͰղܾ
    • ؀ڥม਺ͷͣΕʹΑΔো֐͕1݅ى͖ͯ͠·ͬͨ(λΠϜκʔϯ)

    View full-size slide

  22. ىಈͷࣦഊ
    • APIίʔϧ੍ݶʹҾ͔͔ͬͬͯΤϥʔ͕ൃੜ͢Δ
    • αϙʔτʹ໰͍߹Θ͕ͤͨ۩ମతͳ਺ࣈ͸ෆ໌ɺϦτϥ
    ΠͰճආ
    • ίϯςφىಈ࣌ʹENI(Elastic Network Interface)
    ͷΞλονʹࣦഊ͢Δ
    • ͜Εʹ͍ͭͯ΋ݱঢ়ճආࡦ͸ͳ͍ɺൃੜ͸1ϲ݄਺݅ఔ౓
    ͳͷͰϦτϥΠͰΧόʔ

    View full-size slide

  23. ࠓޙͷల๬
    • ࠷େ2500ίϯςφಉ࣮࣌ߦ΁ͷ௅ઓ
    • Seleniumͷ࣮ߦΛFargateͷαΠυΧʔ΁Ҡߦ
    ͢Δ
    • ΞϓϦέʔγϣϯαʔόͷίϯςφԽ
    • ΑΓεέʔϦϯά͠΍͍͢ߏ੒΁ͷҠߦ

    View full-size slide