Skip to content

Conversation

mohammedalics
Copy link
Contributor

@mohammedalics mohammedalics commented Nov 6, 2024

Requirements for Adding, Changing, or Removing a Feature

This change add ARM64 support to slo-exporter.

Enabling ARM64 support allows it to run on ARM-based architectures, such as Apple M1/M2 chips and many cloud servers, improving compatibility and performance on these platforms. Also, It makes the image usable on a wider range of devices and environments, especially those that prioritize energy efficiency and lower cost.

Description of the Change

Extend the goreleaser setup to consider the multi-platforms and docker manifests.

Verification Process

To verify this change:


Note: This PR branch was branched from/based on #113, as fixing the docker build was essential to validate the changes. Once merged, I can rebase this branch/PR.


Local goreleaser release command output:

goreleaser release
• loading environment variables
• using token from $GITHUB_TOKEN
• getting and validating git state
• git state commit=cfbe23540fdcb937d5eabb9403ca79e68131b63b branch=add-arm64-support-test-goreleaser current_tag=v6.7.1 previous_tag=v6.7.0 dirty=false
• parsing tag
• setting defaults
• running before hooks
• running hook=go mod download
• ensuring distribution directory
• setting up metadata
• writing release metadata
• loading go mod information
• build prerequisites
• building binaries
• building binary=dist/slo-exporter_darwin_arm64_v8.0/slo_exporter
• building binary=dist/slo-exporter_darwin_amd64_v1/slo_exporter
• building binary=dist/slo-exporter_linux_amd64_v1/slo_exporter
• building binary=dist/slo-exporter_linux_arm64_v8.0/slo_exporter
• building binary=dist/slo-exporter_windows_386_sse2/slo_exporter.exe
• building binary=dist/slo-exporter_linux_386_sse2/slo_exporter
• building binary=dist/slo-exporter_windows_arm64_v8.0/slo_exporter.exe
• building binary=dist/slo-exporter_windows_amd64_v1/slo_exporter.exe
• generating changelog
• archives
• creating archive=dist/slo-exporter_6.7.1_linux_amd64.tar.gz
• creating archive=dist/slo-exporter_6.7.1_linux_arm64.tar.gz
• creating archive=dist/slo-exporter_6.7.1_darwin_amd64.tar.gz
• creating archive=dist/slo-exporter_6.7.1_windows_386.tar.gz
• creating archive=dist/slo-exporter_6.7.1_windows_amd64.tar.gz
• creating archive=dist/slo-exporter_6.7.1_darwin_arm64.tar.gz
• creating archive=dist/slo-exporter_6.7.1_windows_arm64.tar.gz
• creating archive=dist/slo-exporter_6.7.1_linux_386.tar.gz
• creating source archive
• creating source archive file=dist/slo-exporter-6.7.1.tar.gz
• calculating checksums
• docker images
• building docker image image=mohammedalics/slo-exporter:v6.7.1-arm64
• building docker image image=mohammedalics/slo-exporter:v6.7.1-amd64
• publishing
• docker images
• pushing image=mohammedalics/slo-exporter:v6.7.1-amd64
• pushing image=mohammedalics/slo-exporter:v6.7-amd64
• pushing image=mohammedalics/slo-exporter:v6-amd64
• pushing image=mohammedalics/slo-exporter:latest-amd64
• pushing image=mohammedalics/slo-exporter:v6.7.1-arm64
• pushing image=mohammedalics/slo-exporter:v6.7-arm64
• pushing image=mohammedalics/slo-exporter:v6-arm64
• pushing image=mohammedalics/slo-exporter:latest-arm64
• took: 4m16s
• docker manifests
• creating manifest=mohammedalics/slo-exporter:v6.7.1 images=[mohammedalics/slo-exporter:v6.7.1-amd64@sha256:75ade02e855605e608191965eeff9c0b06fb45a397e685cf54b1cddf11208e3a mohammedalics/slo-exporter:v6.7.1-arm64@sha256:876d7bdfff5d1a4f9fb2c2552bef8cd0f2fba1fc8e3c9568f2df6c59c18349f4]
• pushing manifest=mohammedalics/slo-exporter:v6.7.1
• creating manifest=mohammedalics/slo-exporter:v6.7 images=[mohammedalics/slo-exporter:v6.7-amd64@sha256:75ade02e855605e608191965eeff9c0b06fb45a397e685cf54b1cddf11208e3a mohammedalics/slo-exporter:v6.7-arm64@sha256:876d7bdfff5d1a4f9fb2c2552bef8cd0f2fba1fc8e3c9568f2df6c59c18349f4]
• pushing manifest=mohammedalics/slo-exporter:v6.7
• creating manifest=mohammedalics/slo-exporter:v6 images=[mohammedalics/slo-exporter:v6-amd64@sha256:75ade02e855605e608191965eeff9c0b06fb45a397e685cf54b1cddf11208e3a mohammedalics/slo-exporter:v6-arm64@sha256:876d7bdfff5d1a4f9fb2c2552bef8cd0f2fba1fc8e3c9568f2df6c59c18349f4]
• pushing manifest=mohammedalics/slo-exporter:v6
• creating manifest=mohammedalics/slo-exporter:latest images=[mohammedalics/slo-exporter:latest-amd64@sha256:75ade02e855605e608191965eeff9c0b06fb45a397e685cf54b1cddf11208e3a mohammedalics/slo-exporter:latest-arm64@sha256:876d7bdfff5d1a4f9fb2c2552bef8cd0f2fba1fc8e3c9568f2df6c59c18349f4]
• pushing manifest=mohammedalics/slo-exporter:latest
• took: 26s
• scm releases
• releasing tag=v6.7.1 repo=mohammedalics/slo-exporter
• created url=https://github.com/mohammedalics/slo-exporter/releases/tag/untagged-5f71ee5746206e246c05
• uploading to release file=dist/slo-exporter_6.7.1_linux_386.tar.gz name=slo-exporter_6.7.1_linux_386.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_windows_arm64.tar.gz name=slo-exporter_6.7.1_windows_arm64.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_darwin_amd64.tar.gz name=slo-exporter_6.7.1_darwin_amd64.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_checksums.txt name=slo-exporter_6.7.1_checksums.txt
• uploading to release file=dist/slo-exporter_6.7.1_darwin_arm64.tar.gz name=slo-exporter_6.7.1_darwin_arm64.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_windows_386.tar.gz name=slo-exporter_6.7.1_windows_386.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_linux_arm64.tar.gz name=slo-exporter_6.7.1_linux_arm64.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_windows_amd64.tar.gz name=slo-exporter_6.7.1_windows_amd64.tar.gz
• uploading to release file=dist/slo-exporter-6.7.1.tar.gz name=slo-exporter-6.7.1.tar.gz
• uploading to release file=dist/slo-exporter_6.7.1_linux_amd64.tar.gz name=slo-exporter_6.7.1_linux_amd64.tar.gz
• published url=https://github.com/mohammedalics/slo-exporter/releases/tag/v6.7.1
• release published url=https://github.com/mohammedalics/slo-exporter/releases/tag/v6.7.1
• took: 2m4s
• took: 6m46s
• writing artifacts metadata
• announcing
• release succeeded after 6m54s
• thanks for using goreleaser!

@FUSAKLA
Copy link
Contributor

FUSAKLA commented Nov 6, 2024

Cool, the changes are looking good, and thanks for testing in on your fork!

The only thing I'm a bit concerned is that it is not tested in any way on arm architecture (we do not use any arm runners in CI).
But Go states that

Go is fully supported on Linux and Darwin. Any Go program that you can compile for x86/x86_64 should work on Arm. Besides Linux and Darwin, Go is also experimentally supported on FreeBSD, OpenBSD and NetBSD.

So hopefully should be fine

BTW #113 is now merged so you can rebase this

@FUSAKLA FUSAKLA self-requested a review November 6, 2024 15:25
@FUSAKLA
Copy link
Contributor

FUSAKLA commented Nov 6, 2024

I enabled running CI on PRs from forked projects but not sure how to trigger the CI now 🤔

Copy link
Contributor

@FUSAKLA FUSAKLA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@FUSAKLA FUSAKLA merged commit 2684212 into seznam:master Nov 6, 2024
@FUSAKLA FUSAKLA mentioned this pull request Nov 6, 2024
@mohammedalics
Copy link
Contributor Author

Once merged, I can give the new images a try in real use cases on ARM64 and share the results here.

The only thing I'm a bit concerned is that it is not tested in any way on arm architecture (we do not use any arm runners in CI).

@FUSAKLA
Copy link
Contributor

FUSAKLA commented Nov 6, 2024

hm, interesting that your docker build passed

I tried to release a new version and the docker build of the arm version fails with an error

#6 [2/5] RUN apt-get update && apt-get install ca-certificates -y && apt-get clean
#6 0.237 exec /bin/sh: exec format error
#6 ERROR: process "/bin/sh -c apt-get update && apt-get install ca-certificates -y && apt-get clean" did not complete successfully: exit code: 1
------
 > [2/5] RUN apt-get update && apt-get install ca-certificates -y && apt-get clean:
0.237 exec /bin/sh: exec format error
------
Dockerfile:3
--------------------
   1 |     FROM debian:stable-slim
   2 |     
   3 | >>> RUN apt-get update && apt-get install ca-certificates -y && apt-get clean
   4 |     
   5 |     COPY slo_exporter  /slo_exporter/
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get install ca-certificates -y && apt-get clean" did not complete successfully: exit code: 1

Learn more at https://goreleaser.com/errors/docker-build

make: *** [Makefile:75: release] Error 1

Exited with code exit status 2

@mohammedalics
Copy link
Contributor Author

The issue in the release not in the build. The build in your pipeline is also passing. The release i did passed because it was from my local machine.

Seems the issue is described here.

I would give a try to add the qemu, either as part of the circleci config.yml as

  ...
  steps:
      - checkout
      - run:
          name: Enable run containers with different architectures
          command: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
   ...

or in the .goreleaser.yml before hooks as:

before:
  hooks:
    - go mod download
    - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

what do you think?

Meantime, I am testing it in my forked branch but not yet finished.

@mohammedalics
Copy link
Contributor Author

It worked after i added the qemu.
Here the same error reproduced in my circleci for the forked repo
Here is the release run after the fix.

The later one failed because of the access deenied to push the image (which is make sense but should work from the main project repository).

I'll open a PR!

@FUSAKLA
Copy link
Contributor

FUSAKLA commented Nov 6, 2024

Hi, right, I already found out the docker run --rm --privileged multiarch/qemu-user-static --reset -p yes step to be missing

Using the goreleaser hook will make it work also in the local environment, so I'd rather go with that?

Also, we could add make test-release with goreleaser release --snapshot and run it in the CI at least on master so we know the release would fail before the actual release

@mohammedalics
Copy link
Contributor Author

Fixed in: #115

@mohammedalics
Copy link
Contributor Author

Agree, I used gorelaser hook. Also to avoid to repeat in in multiple circleci jobs.

Using the goreleaser hook will make it work also in the local environment, so I'd rather go with that?

Yes, good idea. I can add that to the PR.

Also, we could add make test-release with goreleaser release --snapshot and run it in the CI at least on master so we know the release would fail before the actual release

@FUSAKLA
Copy link
Contributor

FUSAKLA commented Nov 6, 2024

I just opened PR with the release test here #116 PTAL

@mohammedalics
Copy link
Contributor Author

mohammedalics commented Nov 8, 2024

I would like to give a feedback about SLO-Exporter performance on linux/arm64 (charts based on 18 running pods in k8s based seznam/slo-exporter:v6.15.1 - linux/arm64) so far.

There is a noticed improvement in CPU and memory. Below charts are based on 18 SLO exporter pods.

CPU

sum / rate
Screenshot 2024-11-08 at 18 22 47

Memory

avg / sum
Screenshot 2024-11-08 at 18 24 46

That is nice!! 🥳

cc: @FUSAKLA

@FUSAKLA
Copy link
Contributor

FUSAKLA commented Nov 8, 2024

That's great to hear!
Thanks for reporting back and all the effort :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants