Slide 1

Slide 1 text

࣮ફARMΞʔΩςΫνϟҠߦ ʙCIɺCDɺίετʹϝϯϚΛఴ͑ͯʙ

Slide 2

Slide 2 text

ࢁԼ࿨඙!QZBNB (.0ϖύϘٕज़ج൫νʔϜ γχΞɾϓϦϯγύϧ ɹΩϟϯϓɺώϧτϯ८Γɺো֐ରԠ 1SPYZαʔό։ൃɺػցֶश

Slide 3

Slide 3 text

๺ւಓେ޷͖!!1

Slide 4

Slide 4 text

ϗεςΟϯάࣄۀ &$ࢧԉࣄۀ ϋϯυϝΠυɾͦͷଞࣄۀ

Slide 5

Slide 5 text

΋ͬͱ͓΋͠Ζ͘Ͱ͖Δ

Slide 6

Slide 6 text

ʮϖύϘ প௡ ։ൃ߹॓ʯ

Slide 7

Slide 7 text

"3.ΞʔΩςΫνϟ ΁ͷҠߦ

Slide 8

Slide 8 text

ಛ௃ ARM x86 ໋ྩηοτ RISC CISC ΤωϧΪʔޮ཰ লΤωϧΪʔͰ௿ిྗফඅ Ұൠతʹߴ͍ফඅిྗ ίετ Ұൠతʹ͸੡଄ίετ͕௿͘ɺ
 େن໛ಋೖʹద͍ͯ͠Δ ߴՁͰ͋Δ͜ͱ͕ଟ͍ ύϑΥʔϚϯε Ұൠతʹੑೳ͕௿͍৔߹͕͋Δ ͕ɺ࠷ۙͷGravitonͳͲߴੑೳԽ ߴੑೳͰɺ
 ಛʹߴෛՙλεΫʹڧ͍ ιϑτ΢ΣΞޓ׵ੑ Ұ෦ͷݹ͍x86ΞϓϦέʔγϣϯ ͱͷޓ׵ੑ͕௿͍ ෯޿͍ιϑτ΢ΣΞޓ׵ੑ͕͋Γɺ ݹ͍ΞϓϦέʔγϣϯ΋αϙʔτ ΤίγεςϜ ϞόΠϧσόΠεͰ޿͘࢖༻͞ Εɺٕज़తʹ੒ख़͍ͯ͠Δ σεΫτοϓ΍αʔόʔͰ޿͘࢖ ༻͞Εɺ੒ख़ͨ͠ΤίγεςϜ ARM vs x86

Slide 9

Slide 9 text

ۚ is Money ͓Θ͔ΓͩΖ͏͔ʁ

Slide 10

Slide 10 text

ͳʹΛARMΞʔΩςΫνϟ΁ҠߦɾରԠ͔ͨ͠ 1. ϋϯυϝΠυ࡞ՈࢧԉαʔϏεͷminneͷRailsΞϓϦέʔγϣϯ 2. CI/CDͷ࣮ߦ؀ڥ 3. ࣾ಺Ͱར༻͍ͯ͠ΔOSS

Slide 11

Slide 11 text

ARMΞʔΩςΫνϟͰࠔͬͨ͜ͱ 1. LinuxͷChromeΛར༻͍ͯ͠ΔՕॴ͕͋ΓɺARMͷύοέʔδ͕
 ఏڙ͞Εͯͳ͍ͷͰ chromium࢖͏͔x86Ͱར༻͢ΔΑ͏ͳબ୒͕͋ͬͨ 2. CݴޠͷΫϩείϯύΠϧɺDockerͷΫϩεϓϥοτϑΥʔϜϏϧυ͕
 ஗͍ 3. deb΍rpmύοέʔδΛARM༻ʹ࡞Γ௚͢ඞཁ͕͋ΓɺզʑͷΑ͏ʹ
 ࣗ෼ͨͪͰ࡞ͬͨϛυϧ΢ΣΞΛຊ൪Ͱ࢖͍·͍ͬͯ͘ΔͱҰ෦ͷ
 ϝϯςφ͕ؤுΔඞཁ͕͋Δ ΍Ε͹ऴΘΔ͠ɺͦΜͳʹ೉͘͠ͳ͍

Slide 12

Slide 12 text

ARMΞʔΩςΫνϟҠߦͰ΍ͬͨ͜ͱ 1. DockerίϯςφΠϝʔδͷϚϧνΞʔΩςΫνϟɾϏϧυ 2. CI/CD؀ڥͷ੔උ 3. ϛυϧ΢ΣΞྨͷύοέʔδ࡞੒ 4. AWS LambdaͷҠߦ 5. ͳʹΛARMͰ࣮ߦ͢΂͖͔ʁ

Slide 13

Slide 13 text

%PDLFSίϯςφΠϝʔδͷ ϚϧνΞʔΩςΫνϟɾϏϧυ

Slide 14

Slide 14 text

ϚϧνΞʔΩςΫνϟΠϝʔδ ARM/x86ͳͲɺෳ਺ͷ࣮ߦ؀ڥΛ
 αϙʔτ͢ΔΠϝʔδϑΥʔϚοτ

Slide 15

Slide 15 text

ϚϧνΫϥελʔߏ੒ x86ͱARM͕ࠞࡏ͢ΔͨΊɺ
 ϚϧνΞʔΩςΫνϟΠϝʔδ͕ඞཁ NKE App App App App x86ߏ੒ EKS App App App x86/ARMࠞࡏߏ੒ App ΦϯϓϨϛεDC AWS ͍͕҆ɺ୹࣌ؒͰ͸༗ݶεέʔϧ ΦϯϓϨϛεͷϦιʔε͕଍Γͳ͍৔߹΍ ো֐࣌ʹ׆༻ɻฏ࣌͸লྗঢ়ଶ

Slide 16

Slide 16 text

Docker͸ϓϥοτϑΥʔϜͷࢦఆ͕Ͱ͖Δ $ docker build —platform linux/arm64 . x86 architecture node emurator(qemu) Docker ΤϛϡϨʔλʔʹΑΓɺҟͳΔϓϥοτϑΥʔϜͷΠϝʔδ΋࡞੒Մೳ

Slide 17

Slide 17 text

޻෉͕ඞཁͳՕॴ ARG TARGETARCH RUN curl -sL "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/ $TARGETARCH/kubectl" \ -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl Dockerͷఏڙ͢ΔϏϧυҾ਺Λར༻ͯ͠ɺΞʔΩςΫνϟ͝ͱͷ
 ॲཧΛ࣮૷ͨ͠Γ͢Δඞཁ͕͋Δ

Slide 18

Slide 18 text

޻෉͕ඞཁͳՕॴ ARG TARGETARCH RUN if [ "${TARGETARCH}" = "amd64" ]; then \ ARCH='x86-64'; \ ARCH_SAM='x86_64'; \ elif [ "${TARGETARCH}" = "arm64" ]; then \ ARCH='aarch64'; \ ARCH_SAM='arm64'; \ else \ echo "Unsupported arch: ${TARGETARCH}"; exit 1; \ f ྺ࢙΍࣮૷ࠩҟ͸༷ʑ͋Δɾɾɾ͋Δͷͩ

Slide 19

Slide 19 text

ϚϧνΞʔΩςΫνϟΠϝʔδͷ࡞੒ $ docker buildx imagetools create -t example:latest example:amd64 example:arm64 example:amd64 example:arm64 example:latest ΠϝʔδΛϨδετϦʹϓογϡ͓͍ͯͯ͠ɺ1ίϚϯυͰOK

Slide 20

Slide 20 text

CI/CD؀ڥͷ ੔උ

Slide 21

Slide 21 text

GitHub Actions - SelfHosted Runner GitHub ActionͰ೚ҙͷ؀ڥͰ
 δϣϒΛ࣮ߦ͢Δ࢓૊Έ ೚ҙͷ؀ڥ Runner repo 1.push 2.polling & exec

Slide 22

Slide 22 text

GitHub Actions - SelfHosted Runner x86͸ΦϯϓϨϛεɺARM͸AWSͰ࣮ߦ NKE Runner x86ΞʔΩςΫνϟ Runner EKS Runner ARMΞʔΩςΫνϟ ΦϯϓϨϛεDC AWS Runner

Slide 23

Slide 23 text

[࠶ܝ]Docker͸ϓϥοτϑΥʔϜͷࢦఆ͕Ͱ͖Δ $ docker build —platform linux/arm64 . x86 architecture node emurator(qemu) Docker ҟͳΔϓϥοτϑΥʔϜΛѻ͏৔߹ɺΤϛϡϨʔλʔͷΦʔόʔϔου͕͋ΔͨΊɺ
 ࣮ߦ͕஗͘ͳΔͷͰx86ɺARMͦΕͧΕͷ؀ڥΛ੔උ

Slide 24

Slide 24 text

ެࣜͷεέδϡʔϥʔ is Good GitHub͕KubernetesͰಈ࡞Մೳͳ RunnerεέδϡʔϥʔΛHelmͰ
 ఏڙ͍ͯ͠ΔͷͰɺεέʔϧՄೳͳ CI/CDͷ࣮ߦ؀ڥΛ؆୯ʹ࡞੒Ͱ͖Δ https://docs.github.com/ja/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/about- actions-runner-controller ΑΓҾ༻

Slide 25

Slide 25 text

Helmͱ͸ KubernetesͷmanifestΛςϯϓϨʔτԽ͠
 valuesϑΝΠϧʹΑͬͯΧελϚΠζͯ͠
 Πϯετʔϧ͢Δ͜ͱ͕Ͱ͖Διϑτ΢ΣΞ https://kruschecompany.com/helm-kubernetes/ ΑΓҾ༻

Slide 26

Slide 26 text

Actions Tips jobs: build_images: strategy: matrix: runner: [x86-builder, arm-builder] runs-on: ${{ matrix.runner }} buildλεΫͳͲ͸matrixΛ࢖͏ͱDRYʹॻ͚Δ build_images arm build_images x86 build_images

Slide 27

Slide 27 text

ϛυϧ΢ΣΞྨͷ ύοέʔδ࡞੒

Slide 28

Slide 28 text

We Love OSS k1LoW/tcpdp STNS/STNS STNS/libnss ੈքతͳϓϩάϥϚͷখࢁ͞Μ͕ϝϯςφϯε͍ͯ͠ΔσʔλϕʔεͷΫΤϦΩϟϓνϟΛߦ͏ιϑτ΢ΣΞɻ ΫΤϦϩάऔಘͷΦʔόʔϔουΛճආͭͭ͠ɺ͢΂ͯͷΫΤϦΛऔಘՄೳɻCʹґଘͨ͠Go࣮૷ɻ LinuxͷϢʔβʔ໊ɺάϧʔϓ໊ɺSSHϩάΠϯ࣌ͷެ։伴Λఏڙ͢ΔGo࣮૷ͷHTTPαʔόɻ STNSͷΫϥΠΞϯτͱͳΔιϑτ΢ΣΞɻC࣮૷ɻ

Slide 29

Slide 29 text

GoReleaser is Awesome GoͷύοέʔδΛ͍ΖΜͳϑΥʔϚοτͰϦ ϦʔεͰ͖Διϑτ΢ΣΞɻόΠφϦɺ Dockerɺrpm,debͳͲ͕Ұͭͷઃఆ
 ϑΝΠϧͰ·ͱΊͯϦϦʔεͰ͖Δɻ project_name: stns-v2 builds: - id: "stns" goos: - linux goarch: - amd64 - arm64 ... nfpms: - id: stns-nfpms ... formats: - deb - rpm

Slide 30

Slide 30 text

Deb and RPM packages are dif fi cult for me. • CͷΫϩείϯύΠϧ͸ґଘ΋ؚΊͯ΍Ζ͏ͱࢥ͏ͱ݁ߏ͠ΜͲ͍ • Deb/RPMύοέʔδͦΕͧΕه๏΍࣮ߦํ๏͕ҟͳΔͨΊɺ৭ʑͱ
 ௐ΂Δ͜ͱ͕ଟ͍ • ݱ୅ͳΒDockerͰx86/ARMΛΤϛϡϨʔγϣϯͯ͠ɺϗετίϯύΠϧ
 ͢Δͷ͕͓͢͢Ί(ͨͩ͠ɺΊͪΌͪ͘Ό஗͍)

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Lambda͸ARMʹରԠ ར༻͍ͯ͠ΔC֦ுͳͲͷ໰୊͕ͳ͍
 ৔߹͸΄ͱΜͲԿ΋ؾʹͤͣʹҠߦ
 ͢Δ͜ͱ͕Մೳ https://docs.aws.amazon.com/ja_jp/lambda/latest/dg/lambda-runtimes.htmlΑΓҾ༻

Slide 33

Slide 33 text

ը૾ม׵ͷLambdaΛARM΁มߋ 1. Ϣʔβʔ͔ΒϦΫΤετ 2. Cloud Front->API Gateway※
 Λհͯ͠ɺLambdaΛίʔϧ 3. Lambda͔ΒS3ʹอଘ͞Ε͍ͯΔ
 ը૾ϑΝΠϧΛऔಘͯ͠ɺ
 ը૾αΠζΛม׵ ※ݱࡏ͸Function URL͔Βݺͼग़͠

Slide 34

Slide 34 text

ύϑΥʔϚϯεൺֱ x86ΞʔΩςΫνϟ ARM+๻ͷਆ͕͔ͬͨύϑΥʔϚϯενϡʔχϯά ๻ͷਆ͕͔ͬͨύϑΥʔϚϯενϡʔχϯά͕ όάͬͯͯɺ੾Γ໭ͨ͠ARM x86͔ΒARM΁ͷมߋͰ33%ͷߴ଎Խ

Slide 35

Slide 35 text

ίετൺֱ ૣ͍͸ਖ਼ٛ

Slide 36

Slide 36 text

ԿΛARMͰ ࣮ߦ͢΂͖͔ʁ

Slide 37

Slide 37 text

ԿΛARMͰ࣮ߦ͢΂͖͔ Apache httpdʹabͰ
 ϕϯνϚʔΫςετΛ͔͚Δͱ
 ίΞ਺͕૿͑Δ΄Ͳx86͕༏Ґ https://techblog.nexxwave.eu/benchmark-between-x86-and-arm-cloud-servers/ΑΓҾ༻

Slide 38

Slide 38 text

ԿΛARMͰ࣮ߦ͢΂͖͔ HINT(Hierarchical INTegration)Ͱ
 γϯάϧίΞͷϕϯνϚʔΫΛऔ ΔͱARM͕༏Ґ https://techblog.nexxwave.eu/benchmark-between-x86-and-arm-cloud-servers/ΑΓҾ༻

Slide 39

Slide 39 text

ͳʹΛARMʹ͢΂͖͔ 1. WEBۀքͰӡ༻͞Ε͍ͯΔLaravel΍RailsΛARMΞʔΩςΫνϟʹ
 ஔ͖׵͑Δͱࢥ͍΋ΑΒͳ͍ύϑΥʔϚϯεྼԽ͕ੜ·ΕΔՄೳੑ͕͋Δ 2. ࠓճ঺հͨ͠Α͏ͳը૾ม׵ͳͲͷγϯϓϧͳॲཧͰ͋Ε͹ARM͕༏Ґ 3. ӡ༻͍ͯ͠ΔݶΓͰ͸DockerΠϝʔδͷϏϧυͳͲ΋ଟ͘ͷ৔߹Ͱ
 ARM͕଎͍

Slide 40

Slide 40 text

࣍ճ༧ࠂ

Slide 41

Slide 41 text

΋͸΍ARM͢Β΄ͱΜͲ࢖ͬͯͳ͍ EKS͸΋͏όονॲཧ͘Β͍ʹ͔͠΄ͱΜͲ࢖ͬͯͳ͍

Slide 42

Slide 42 text

ࢀߟʹͨ͠WEBαΠτ • Opt Technologies Magazine - Πϯϑϥʹ͓͚ΔCPUΞʔΩςΫνϟʹର ͢Δߟ࡯(https://tech-magazine.opt.ne.jp/entry/2022/06/03/190016) • NEXXWAVE - Benchmark between x86 and ARM cloud servers(https:// techblog.nexxwave.eu/benchmark-between-x86-and-arm-cloud-servers/)

Slide 43

Slide 43 text

·ͩࠓ೥ͷ࠾༻࿮͋Γ·͢ʂʂ ਓྨͷΞ΢τϓοτΛ૿΍͠·͠ΐ͏ˠ !QC@SFDSVJU