Slide 1

Slide 1 text

Cloud connect the world as a Glue AWS Dev Day 2017 Track 2 Masahiro Nagano @kazeburo

Slide 2

Slide 2 text

Me • Masahiro Nagano / ௕໺խ޿ • @kazeburo • Mercari, Inc
 Principal Engineer
 Site Reliability Engineering (SRE) Team • BASE, Inc Technical Advisor

Slide 3

Slide 3 text

SRE Team ͷ঺հ

Slide 4

Slide 4 text

SRE • Site Reliability Engineering ͷུ • Google ͷӡ༻νʔϜΛ཰͍Δ Ben Treynor ͕ఏএ • Google ͷ༷ʑͳϓϩμΫτɾαʔϏεΛԣஅͯ͠ɺιϑτ΢ΣΞΤ ϯδχΞϦϯάΑΓαΠτ/αʔϏεͷ৴པੑΛ޲্ͤ͞Δ Software Engineering/Teamͱͦͷ࣮ફ = Google SRE

Slide 5

Slide 5 text

Google SRE • ιϑτ΢ΣΞΤϯδχΞ(SWE)ͱͯ͠࠾༻ • ӡ༻ͷۀ຿Λ50%ҎԼʹ཈͑Δ • 50%͸ΦϖϨʔγϣϯͷࣗಈԽɺιϑτ΢ΣΞͷ৴པੑ޲্ʹ͋ͯΔ • ΤϥʔόδΣοτͱ͍͏ߟ͑ํ • SREͱSWEͷSLAΛऔΓܾΊɺར֐ΛҰகͤ͞Δ http://landing.google.com/sre/book.html

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Mercari SRE • ͍ͭͰ΋շద͔ͭ҆શʹར༻Ͱ͖Δʮ৴པੑͷߴ͍ʯαʔϏεͷ࣮ݱ • ʮ৽نαʔϏεͷ։ൃҎ֎ͷΤϯδχΞϦϯά͸શ෦΍Δʯ • 2015/11 ʮΠϯϑϥνʔϜʯ͔ΒSRE΁ • ʮΠϯϑϥʯΑΓ΋αʔϏεࢦ޲ • ݱࡏϝϯόʔ͸ʮ6ਓʯઈࢍืूத

Slide 8

Slide 8 text

Mercari SRE ͷۀ຿ൣғ Operations Software Eng. ج൫ߏங OnCall (ো֐ରԠ) Automation εέʔϥϏϦςΟɾՄ༻ੑվળ ϛυϧ΢ΣΞߏங ΞϓϦέʔγϣϯͷઃܭϨϏϡʔ ϩάऩूɾ෼ੳج൫ͷߏஙɺӡ༻ αʔόϓϩϏδϣχϯάɾσϓϩΠͷ੔උ ηΩϡϦςΟʗෆਖ਼ར༻ݕग़

Slide 9

Slide 9 text

Agenda • ϝϧΧϦͱ͸ / ੈք3ڌ఺Ͱͷ։ൃӡ༻ମ੍ʹ͍ͭͯ • ϝϧΧϦͷΞʔΩςΫνϟ / Ϋϥ΢υͷར༻ • ڑ཭Λ௒͑ΔɺੈքΛܨ͙γεςϜ

Slide 10

Slide 10 text

Mercari • ࠃ಺࠷େڃͷϑϦϚΞϓϦ • 3෼Ͱ؆୯ʹग़඼ • ҆৺҆શͳܾࡁ

Slide 11

Slide 11 text

Mercari KPI μ΢ϯϩʔυ਺ GMV(૯औҾֹ) 6500ສDL(JP+US) ݄ؒ100ԯԁҎ্ ग़඼਺ 1೔100ສ඼Ҏ্

Slide 12

Slide 12 text

μ΢ϯϩʔυ਺ਪҠ(JP) JP μ΢ϯϩʔυ਺ 4000ສ (2016/11)

Slide 13

Slide 13 text

೔ຊ࠷େͷϑϦϚΞϓϦ 1,200 1෼ؒͷग़඼਺(peek࣌ؒଳ) ඼Ҏ্

Slide 14

Slide 14 text

ग़඼͔Β͙͢ʹചΕΔ 24 ࣌ؒҎ಺ ചΕͨ঎඼ͷ໿50%͕ 24࣌ؒҎ಺ʹऔҾ੒ཱ

Slide 15

Slide 15 text

Global Service JP 2016/08 US AppStore 3Ґ US UK 2017/03/15 ϦϦʔε

Slide 16

Slide 16 text

Global Development Team Tokyo San Francisco London San Francisco/London ʹΦϑΟε ݱ஍࠾༻ɺग़޲ऀɺ௕ظग़ு߹Θͤͯ ΤϯδχΞ͕਺໊͔Β਺े໊

Slide 17

Slide 17 text

Global Development Team • Tokyo • ։ൃͷத৺ɻJPʹՃ͑ͯશͯͷregionͷ։ൃ • San Fransisco • αʔϏεͷϩʔΧϥΠζ • ݴޠ͚ͩͰ͸ͳ͘ɺจԽ΍श׳ͷϩʔΧϥΠζ • London • αʔϏε্ཱͪ͛ϑΣʔζ / ݱ஍ͷ๏ྩͳͲʹ߹ΘͤͨϩʔΧϥΠζ

Slide 18

Slide 18 text

Global Development ͷ೉͠͞ 10:00 1:00 18:00 9࣌ؒ 7࣌ؒ લ೔ Tokyo San Francisco London 3ڌ఺ἧͬͯإΛ߹ΘͤΔ͜ͱ͕͔ͳΓ೉͍͠

Slide 19

Slide 19 text

Global Development ͷਐΊํ(1) • Ϋϥ΢υΛ׆༻ͯ͠ίϛϡχέʔγϣϯΛਤΔ • ଠฏ༸ɾେ੢༸Λ·͍ͨͩPull ReqeuestϨϏϡʔ • Slack • Video Conference • ϦϞʔτϖΞϓϩ(εΫϦʔϯڞ༗)

Slide 20

Slide 20 text

Global Development ͷਐΊํ(2) • ཱࣗͨ͠νʔϜͱͯ͠՝୊ղܾ͢Δ • ϓϩδΣΫτϚωʔδϟͱɺΫϥΠΞϯτ͔ΒαʔόαΠυΤϯ δχΞ·ͰϑϧελοΫͷϓϩμΫτνʔϜΛݱ஍Ͱ݁੒ • νʔϜؙ͝ͱग़ு • iOS/Android͸RegionʹΑͬͯfork͋Δ͍͸ɺbranchΛ෼͚ɺޓ͍ ͷӨڹΛݮΒ͢

Slide 21

Slide 21 text

SREͷέʔε • 6ਓͷ͏ͪɺ1ਓ͕௕ظUSग़ுத • ݱ஍։ൃͷαʔϏεͷΦϖϨʔγϣϯͷ೺Ѳ • ि1ͰUSͱͷSync MTG • ே9࣌(PDT 17:00) ʹࣗ୐ʹͯ Video Conference • UKͱ͸Ҋ݅ϕʔεͰ༦ํʹMTG • OnCall ౰൪͸ே9͔࣌Βࣗ୐଴ػɻUS͔Βͷ࡞ۀґཔʹ͋ͨΔ

Slide 22

Slide 22 text

Mercari Architecture

Slide 23

Slide 23 text

Infrastructure ੴङDC ઐ༻αʔό JP Cloud US Cloud UK Hybrid & Multi Cloud

Slide 24

Slide 24 text

Infrastructure history (1) • 2013/07 JP ϦϦʔε • ͘͞ΒΠϯλʔωοτͷVPS 1୆ʹWeb΋DB΋͢΂ͯࡌͤͨ • ΠϯϑϥετϥΫνϟઐ೚ऀ͍ͳ͍தͰɺ਎ۙͳٕज़Λબ୒ • ϦϦʔεޙ2ϲ݄Ͱ͘͞ΒΫϥ΢υɺઐ༻αʔόʹҠߦ͖ͯͨ͠

Slide 25

Slide 25 text

Infrastructure history (2) • 2014/09 US ϦϦʔε • AWS (Oregon) ʹͯαʔϏεߏங • JPϦϦʔε౰ॳʹൺ΂ͯΤϯδχΞ͕૿͑ɺAWSܦݧऀ΋ଟ͘ͳͬͨ • ͦΕͰ΋·ͩΠϯϑϥετϥΫνϟઐ೚ऀ͸গͳ͘ɺAWSͷϚωʔδυ αʔϏεΛଟ͘ར༻ͯ͠αʔϏεΛߏங • USࠃ಺ͷઐ༻αʔόར༻΋ݕ౼͕ͨ͠ɺUSͷεέʔϧ͸༧૝ͮ͠Β͘ɺ Ϋϥ΢υͷॊೈ͞Λ೔ຊΑΓ΋ॏཁࢹͨ͠

Slide 26

Slide 26 text

Infrastructure history (3) • (2015/02 kazeburo ೖࣾ) • 2015/11 SREνʔϜൃ଍ • ͘͞ΒΠϯλʔωοτͱAWSͷϋΠϒϦουͳΠϯϑϥετϥΫνϟ ͷ্ͷΞʔΩςΫνϟΛਐԽͤ͞ɺ৴པੑͱεέʔϥϏϦςΟͷ޲্ • 2017/03 UK ϦϦʔε • ৽͍ٕ͠ज़తνϟϨϯδͱͯ͠GCPΛબ୒

Slide 27

Slide 27 text

Architecture • ࡾ૚+αͳγϯϓϧͳΞʔΩςΫνϟ • Reverse Proxy = nginx
 Application = Apache+mod_php
 Database = MySQL
 Cache = memcached
 Search = Solr • ଟ͘Λ෺ཧαʔόʹͯߏ੒ • εέʔϧΞοϓ΋εέʔϧΞ΢τ΋ߦ͏Diagonal Scaleࢦ޲ • Databaseʹ͸ ioMemory ΍ NVMe Λ౥ࡌͨ͠αʔόΛ࠾༻ nginx nginx nginx ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. Users Client Multimedia Corporate data center Traditional server Mobile Client WS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers fic DNS-RR App App App App App App MySQL MySQL memcached memcached util util cloud cloud JP

Slide 28

Slide 28 text

Architecture JP ͷΞʔΩςΫνϟΛجຊ౿ऻ EC2/GCE (αʔό) Λத৺ͨ͠ߏ੒ ɾ USಠࣗͷαʔϏε΍
 খن໛ʙதن໛DBʹ͸ RDS UKͰ͸Cloud Load BalancerΛར༻ nginx nginx nginx ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. Users Client Multimedia Corporate data center Traditional server Mobile Client anagement onsole IAM Add-on Example: IAM Add-on man Intelligence Tasks (HIT) Assignment/ Task Requester Workers DNS-RR App App App App App App MySQL MySQL memcached memcached util util US RDS EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 EC2 nginx nginx nginx ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corpora data cen Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific App App App App App App MySQL MySQL memcached memcached util util GCE cloud load balancer GCE GCE GCE GCE GCE GCE GCE GCE GCE GCE GCE GCE GCE GCE UK

Slide 29

Slide 29 text

αʔόத৺ͷ Architecture • ϝϯςϯεϏϦςΟɾεέʔϥϏϦςΟઓུͷڞ௨Խ • গਓ਺Ͱͷӡ༻ • Ansible Playbook ࠶ར༻ • εέʔϧ͕ઌߦ͍ͯ͠ΔJPͰ࣮੷͋Δߏ੒ • US Ͱͷ App Store ϥϯΩϯά3ҐͷτϥϑΟοΫ΋໰୊ͳ͘ӡ༻ • EC2ͷIaaSͱͯ͠ͷύϑΥʔϚϯεɺ৴པੑ͸͔ͳΓ޲্͍ͯ͠Δ

Slide 30

Slide 30 text

Mercari Architecture ·ͱΊ • 3ͭͷRegionͰ࠾༻͢ΔΠϯϑϥετϥΫνϟ͕ҟͳΔ • JP/US/UK ͸αʔόΛத৺ͱͨ͠ArchitectureΛ࠾༻ • AWSͰ΋Ϋϥ΢υΒ͍͠ઃܭ͸ͤͣɺن໛Ͱઌߦ͢ΔJPʹ߹Θͤ Δ͜ͱͰɺӡ༻ͷڞ௨ԽͱলྗԽ • ϝϧΧϦͰ͸Ϋϥ΢υΛੵۃతʹ࢖͍ͬͯͳ͍ʁ • JP/US/UK ڞ௨ͷΠϯϑϥετϥΫνϟͰར༻͍ͯ͠·͢

Slide 31

Slide 31 text

Mercari Global Infrastructure

Slide 32

Slide 32 text

Global Infrastructure • Mercari JP/US/UK ͷΠϯϑϥετϥΫνϟ͸ಠཱ͍ͯ͠Δ • σʔλΛαʔϏεΛߦ͏Ҭ಺ʹཹΊΔඞཁੑ • ͍͔ͭ͘ͷΫϥ΢υαʔϏεΛڞ௨ͯ͠ར༻ • ւ֎ͰͷΞΫηεվળ • Ϋϥ΢υͷߴ͍εέʔϥϏϦςΟɾ৴པੑʹΑΓαʔϏεͷՄ༻ ੑΛอͭ

Slide 33

Slide 33 text

Global Infrastructure JP US UK DNS: Amazon Route53 CDN: Akamai, CloudFront Storage: Amazon S3 Analysis: Google BigQuery Common Micro Services ܾࡁ/෺ྲྀ/Domestic Service ܾࡁ/෺ྲྀ/Domestic Service ܾࡁ/෺ྲྀ/Domestic Service ڞ௨ΞʔΩςΫνϟ αʔό͕த৺ ֤Region Ϋϥ΢υ͕த৺ ৴པੑͷߴ͍AWSͷ αʔϏε͕ڬΈࠐΉ

Slide 34

Slide 34 text

Amazon Route53 • ߴ͍Մ༻ੑͱ৴པੑͷDNS • Roadworker Λར༻ • github.com/codenize-tools/roadworker • Routefile ΛGithubͰ؅ཧ • Pull RequestͷmergeޙɺCIΛܦ༝ͯ͠ ࣗಈ൓ө hosted_zone "mercari.jp." do rrset "api.mercari.jp.", "CNAME" do ttl 30 resource_records( "endpoint-api.mercari.jp" ) end end #Routefile PR Github Travis-CI Route53

Slide 35

Slide 35 text

Amazon Route53 + HealthCheck • DNS-RR ӡ༻࣌ͷ໰୊఺ • αʔόো֐࣌ʹDNSͷॻ͖׵͑ʹ͕͔͔࣌ؒΔ • ϒϥ΢βͳͲͷҰ෦ΫϥΠΞϯτ͸DNS-RRͷ৔߹ɺҰ෦ͷαʔόʹ઀ଓ͕Ͱ͖ ͳ͍৔߹ɺଞͷαʔό΁઀ଓ͠௚͢ͷͰো֐ʹΑΔӨڹ͸େ͖͘ͳΓʹ͍͘ɻ • ϚΠΫϩαʔϏεԽ͕ਐΉͱ༷ʑͳϒϥ΢βҎ֎ͷΫϥΠΞϯτ͕઀ଓ͢Δɻ ଟ͘͸DNS-RRͷো֐࣌ͷ࠶઀ଓ͸࣮૷͞Εͯͳ͍ • Route53 ͷ Health CheckΛ࢖͍ղܾ(Λݕূத)

Slide 36

Slide 36 text

Route53 + Health Check with Roadworker [“153.x.y.150”, "153.x.y.151"].each do |ip| rrset "endpoint-ha.mercari.jp.", "A" do ttl 30 weight 1 set_identifier “endpoint-ha-“ + ip.gsub(/\./,'-') health_check "http://#{ip}/hc", :request_interval => 30, :failure_threshold => 3 resource_records( "#{ip}" ) end end Health CheckʹΑΓ DNS-RR Ͱ΋Մ༻ੑΛߴΊΒΕΔ #Routefile

Slide 37

Slide 37 text

(࿩͸ͦΕ·͕͢) ಺෦ DNS • શͯͷαʔόʹunboundΛಋೖ • ϩʔΧϧΩϟογϡʹΑΔύϑΥʔϚϯε޲্ • resolv.confΑΓՄ༻ੑ্͕͕Δ • DNSαʔόͷunboundͰϦΫΤετΛৼΓ෼͚ • *.local ͸BIND͕ݖҖαʔό • *.consul ͸consul DNS interface App App App App App App DNS DNS unbound unbound unbound unbound unbound unbound DNS unbound Consul/DNS BIND *.consul *.local

Slide 38

Slide 38 text

(࿩͸ͦΕ·͕͢) ಺෦DNSͰCNAME • ಺෦DNSͰϚωʔδυαʔϏεͷΤϯυϙΠϯτͷCNAMEΛઃఆ • ΞϓϦέʔγϣϯ͔Β઀ଓ͸CNAMEܦ༝ • ϚωʔδυαʔϏε͔ΒϚωʔδυαʔϏε΁ͷҠߦɺϚωʔδυ αʔϏε͔ΒEC2΁ͷҠߦɺ·ͨͦͷٯͷҠߦ͕΍Γ΍͍͢ db-cstool-master IN CNAME cstool-db.XXXXX.us-west-2.rds.amazonaws.com.

Slide 39

Slide 39 text

Amazon S3 • ߴ͍Մ༻ੑͱ৴པੑͷετϨʔδ • ঎඼ը૾ɺϩάɺσʔλϕʔεͷόοΫΞοϓͳͲ͋ΒΏΔσʔλ Λ֨ೲ • IAMΛར༻ͨ͠ߴ౓ͳΞΫηε؅ཧͱૄ݁߹ͷ࣮ݱ • αϒγεςϜ͔ΒͷσʔλΠϯϙʔτɾΤΫεϙʔτ • ֎෦αʔϏεɾύʔτφʔͱͷσʔλड͚౉͠खஈ

Slide 40

Slide 40 text

͋ΒΏΔσʔλͷετϨʔδ: ঎඼ը૾ App App App App App App Client Multimedia Corporate data center Traditional server Mobile Client ent IAM Add-on Example: IAM Add-on ligence HIT) Assignment/ Task Requester Workers ঎඼ը૾σʔλ͸ಉظతʹॖখ/Ξοϓϩʔυ AWS SDK for PHPΛར༻ɻෳ਺ͷը૾Λฒߦͯ͠PUTͯ͠଎౓޲্ ग़඼! ਺ඦສຕ/day

Slide 41

Slide 41 text

͋ΒΏΔσʔλͷετϨʔδ: ϩά Log Log ΞΫηεϩάʗΤϥʔϩάͳͲ֤छϩά͸fluentܦ༝Ͱू໿ͯ͠S3ʹ֨ೲ aws-cli ·ͨ͸ fluent-plugin-s3 batch + aws-cli > 1TB/day App App App App App App

Slide 42

Slide 42 text

͋ΒΏΔσʔλͷετϨʔδ: όοΫΞοϓ MySQL Master MySQL BackupSlave MySQL͸ຖ೔xtrabackup(ि1Ͱmysqldump) backup༻slave͔ΒbackupΛऔಘɻaws-cliͰసૹ > 1.2TB(ѹॖࡁ)/day xtrabackup + aws-cli MySQL Master MySQL BackupSlave

Slide 43

Slide 43 text

Amazon S3 as a Hub MySQL SaaS / ࣾ಺ Microservices + IAM ػցֶशʗෆਖ਼ݕ஌ ෺ྲྀɾܾࡁ ৴པੑͷߴ͍S3ΛHubͱͯ͠ɺૄ݁߹Λ࣮ݱ SFTP Partner goofys App App App App App App nginx nginx nginx consulͰઃఆΛ഑෍ σʔλͷimport/export ACL ML API ML API ֶशσʔλͷimport

Slide 44

Slide 44 text

ػցֶश΁ͷऔΓ૊Έ • αʔϏεͰར༻தɾݕূத • ݕࡧ݁ՌͷվળɻߦಈղੳʹΑΓɺ঎඼ͷݕࡧΠϯσοΫεʹΩʔ ϫʔυΛ௥Ճ͠ɺΑΓݟ͚ͭ΍͘͢ • ग़඼࣌ͷՁ֨αδΣετ • ػցֶशΛͩΕͰ΋ࢼ͢͜ͱ͕Ͱ͖Δ؀ڥΛ • Amazon ML΋ݕ౼

Slide 45

Slide 45 text

ڑ཭Λ௒͑ͯੈքΛܨ͙

Slide 46

Slide 46 text

ڑ཭ͱϨΠςϯγ • ޫ͸50msecʹ஍ٿ൒प΋Ͱ͖ͳ͍ɻԕڑ཭ͱͷ௨৴͸ίετ͕ߴ͍ • σʔληϯλʔؒɺΫϥ΢υؒͷڑ཭͕͋Δ৔߹ʹ͸ɺͦΕΛࠀ෰ ͠ɺޮ཰ͷྑ͍௨৴Λߦ͏ඞཁ • (ੴङԕ͍໰୊)

Slide 47

Slide 47 text

ࠃ಺ͱࠃ֎ͷϨΠςϯγ ੴ AWS ౦ GCP 18ms 70-100ms 140ms GCP 6ms ͍͍ͩͨͷ஋ ଠฏ༸/๺ถେ཮/େ੢༸͸΋ͱΑΓɺੴङ΋ԕ͍

Slide 48

Slide 48 text

ߴϨΠςϯγ؀ڥͰͷHTTPS௨৴ • ௨ৗͷTCP HandshakingʹՃ͑਺ճͷ΍ΓͱΓ͕ඞཁ • RTT 26msecͰHTTPSͷ௨৴Λߦͳͬͨ৔߹ɺ200msecҎ্͔͔Δ • RTT 100msec௒͑Δͱɺ600msecҎ্ • ࢀߟ) mercari APIͷϨεϙϯελΠϜ(90percentile)͸ 100msec

Slide 49

Slide 49 text

ԕڑ཭઀ଓ͢ΔϢʔεέʔε • ΫϥΠΞϯτ͕ԕ͍ͱ͜Ζ͔ΒαʔϏεʹΞΫηε͢Δ • ւ֎, US౦ւ؛/੢ւ؛ • ΞϓϦέʔγϣϯͷίʔυ͔ΒଞͷΫϥ΢υ(σʔληϯλʔ)ʹ
 ΞΫηε͢Δ • SaaSɺϚΠΫϩαʔϏε

Slide 50

Slide 50 text

ΫϥΠΞϯτ͔Βͷ઀ଓվળ • CDNΛར༻͢Δ • Cloudfront, Akamai, Fastly • ΫϥΠΞϯτ͸ۙ͘ʹ͋ΔCDNͷΤοδαʔόͱTLS Handshaking • CDN ͱ Origin ؒ͸ίωΫγϣϯू໿΍ઐ༻ωοτϫʔΫΛར༻͢ Δ͜ͱͰߴ଎Խ • www.mercari.com ͸CDNΛར༻

Slide 51

Slide 51 text

CDNͷར༻: mercari Web JP US UK mercari.com/ mercari.com/jp/ mercari.com/uk/ CDN azon Web Services LLC or its affiliates. All rights reserved. Client Multimedia Corporate data center Traditional server Mobile Client AM Add-on Example: IAM Add-on Assignment/ Task Requester Workers ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. Users Client Multimedia Corporate data center Traditional server Mobile Client anagement nsole IAM Add-on Example: IAM Add-on man Intelligence Tasks (HIT) Assignment/ Task Requester Workers ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. Users Client Multimedia Corporate data center Traditional server Mobile Client et AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers on l Turk vice Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Traditional server Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Corporate data center Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Requester Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights reserved. User Users Client Multimedia Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Human Intelligence Tasks (HIT) Assignment/ Task Reques Workers Amazon Mechanical Turk Non-Service Specific ©2011 Amazon Web Services LLC or its affiliates. All rights re User Users Client Mul Mobile Client Internet AWS Management Console IAM Add-on Example: IAM Add-on Amazon Mechanical Turk Human Intelligence Tasks (HIT) Assignment/ Task Workers Amazon Mechanical Turk Non-Service Specific ੴङDC

Slide 52

Slide 52 text

ΞϓϦέʔγϣϯ͔ΒΫϥ΢υ΁ΞΫηε • ΞϓϦέʔγϣϯͰHTTPS௨৴ͷKeepAliveΛߦ͏ • PHP ApplicationͰͷKeepAlive͸೉͍͠ • ϦΫΤετॲཧޙʹϝϞϦ͕ΫϦΞ͞Εɺ TCP઀ଓ΋੾ΕΔ • ϚϧνϓϩηεͰ͋ΓɺKeepAliveͯ͠΋ޮ཰͕ѱ͍ • => ͦ͜Ͱ Connection PoolingΛ໨తͱͨ͠ Proxy ServerΛ։ൃ

Slide 53

Slide 53 text

chocon • GoͰ࣮૷ͨ͠γϯϓϧͳ
 Proxy Server • OSSͱͯ͠ެ։ • github.com/kazeburo/chocon • ൒೥Ҏ্ͷՔಇ࣮੷

Slide 54

Slide 54 text

chocon % curl -H ‘Host: example.com.ccnproxy-https’ http://10.0.0.1/v1/foo *.ccnproxy-https IN CNAME chocon.local. ಺෦DNSΛ׆༻͢ΔͱURLͷϗετ໊Λมߋ͢Δ͚ͩ chocon Web Client https://example.com/ ʹproxy http http or https keepAlive Private Network % curl http://example.com.ccnproxy-https/v1/foo

Slide 55

Slide 55 text

Before chocon $ ./httpstat.sh /dev/null https://microservice.example.com/hc HTTP/1.1 200 OK Server: nginx/1.11.5 Date: Thu, 01 Jun 2017 00:43:49 GMT Content-Type: application/json; charset=utf-8 Content-Length: 22 Expires: Thu, 01 Jun 2017 01:43:49 GMT Cache-Control: max-age=3600,public Body stored in: /tmp/httpstat-body.263264511496278239 DNS Lookup TCP Connection SSL Handshake Server Processing Content Transfer [ 2ms | 24ms | 197ms | 25ms | 0ms ] | | | | | namelookup:2ms | | | | connect:26ms | | | pretransfer:223ms | | starttransfer:248ms | total:248ms

Slide 56

Slide 56 text

After chocon $ ./httpstat.sh /dev/null https://microservice.example.com.ccnproxy-https/hc HTTP/1.1 200 OK Cache-Control: max-age=3600,public Content-Length: 22 Content-Type: application/json; charset=utf-8 Date: Thu, 01 Jun 2017 00:43:49 GMT Expires: Thu, 01 Jun 2017 01:43:49 GMT Server: nginx/1.11.5 X-Chocon-Req: bSCzJrCMZ9wbRN8TYhZ3wV Body stored in: /tmp/httpstat-body.390174181496278775 DNS Lookup TCP Connection Server Processing Content Transfer [ 1ms | 1ms | 19ms | 0ms ] | | | | namelookup:1ms | | | connect:2ms | | starttransfer:21ms | total:21ms

Slide 57

Slide 57 text

Why chocon? • ࣅͨmiddleware͸ݟ͔ͭΒͳ͍ • ୯७ͳforward proxyͰ͸HTTPS௨৴ͷू໿͸Ͱ͖ͳ͍ • HTTPS͸end to endͰ҉߸ԽɻMITM Proxy͕ඞཁʹͳΔ • Goݴޠඪ४ͷHTTP/2ʹΑΓޮ཰ͷྑ͍ू໿ɺߴ଎ͳΞΫηε͕ظ଴

Slide 58

Slide 58 text

chocon in JP App App App App App App App App chocon DC(Cloud) Cloud(DC) Microservices SaaS Cloud API endpoint 90msec ͕19msec ͱੴङ౦ژؒͷRTT࣮ଌ஋·Ͱվળ AWS SDK΋endpointΛ੾Γସ͑Δ͜ͱͰར༻Մೳ http or https keepAlive

Slide 59

Slide 59 text

chocon & Pacific Ocean App App App App chocon US Cloud HTTPS, HTTP/2 Keepalive 100msecఔ౓·Ͱ஗Ԇ͕཈͑ΒΕɺଞRegionͱͷ࿈ܞͷ࣮ݱɻ USͷઌਐతͳΫϥ΢υαʔϏεʹΞΫηε͠΍͘͢ͳΔ Cloudfront/CDN ւఈέʔϒϧ

Slide 60

Slide 60 text

·ͱΊ

Slide 61

Slide 61 text

·ͱΊ • ϝϧΧϦ͸ JP/US/UK ͷ3ڌ఺ͰαʔϏεల։ɺ։ൃ΋ߦ͏ • ֤Region͸αʔόΛத৺ͱͨ͠ڞ௨ͨ͠ΞʔΩςΫνϟ • άϩʔόϧͰ͸Amazon Route53, Amazon S3ͷߴ͍৴པੑʹࢧ͑ΒΕ͍ͯΔ • ੈքΛ݁ͿͨΊʹΫϥ΢υαʔϏε΍ಠࣗ։ൃͷιϑτ΢ΣΞΛར༻

Slide 62

Slide 62 text

We’re Hiring! ੈքʹ௅ΉɺϝϧΧϦ ݴ͍༁φγͷύϑΥʔϚϯεͱ৴པੑͰࢧ͑ΔSRE www.mercari.com/jp/jobs/