Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Arm64 lambdas #884

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Move to Arm64 lambdas #884

merged 1 commit into from
Mar 28, 2024

Conversation

akash1810
Copy link
Member

@akash1810 akash1810 commented Mar 27, 2024

What does this change?

Change the architecture of each lambda to Arm64.

Why?

Arm based lambdas are cheaper and more performant. See https://aws.amazon.com/blogs/aws/aws-lambda-functions-powered-by-aws-graviton2-processor-run-your-functions-on-arm-and-get-up-to-34-better-price-performance/.

How has it been verified?

Statistics

Here are some statistics after invoking the x86_64 and arm64 versions of each lambda once with the same input.

Lambda Architecture Duration (ms) Init Duration (ms) Max Memory Used (MB)
data-audit arm64 43,625.24 544.92 226
data-audit x86_64 40,958.23 471.65 217
dependency-graph-integrator arm64 11.61 404.20 91
dependency-graph-integrator x86_64 15.16 386.19 87
github-actions-usage arm64 15,342.05 294.96 188
github-actions-usage x86_64 12,884.00 293.36 190
interactive-monitor arm64 2,022.39 56.95 201
interactive-monitor x86_64 1,970.55 833.22 191
repocop arm64 27,607.03 909.56 683
repocop x86_64 24,273.92 950.93 640
snyk-integrator arm64 16.76 397.81 91
snyk-integrator x86_64 14.90 359.59 87

As mentioned in the linked post:

For functions using the Arm/Graviton2 architecture, duration charges are 20 percent lower than the current pricing for x86.

In this estimate1 of 100,000 requests per month, of 50,000ms duration, and 1,024MB memory, Arm64 costs $61.33 and x86_64 $76.67.

That is, whilst the statistics do not suggest a dramatic change in performance, we will see a reduction in the bill.

Footnotes

  1. URL will expire in 1 year.

@akash1810 akash1810 force-pushed the aa/arm64 branch 6 times, most recently from 0d5688d to 9fb74b2 Compare March 27, 2024 22:35
@@ -1,7 +1,7 @@
generator client {
provider = "prisma-client-js"
previewFeatures = ["views"]
binaryTargets = ["native", "rhel-openssl-3.0.x"]
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -12,4 +13,26 @@ describe('The ServiceCatalogue stack', () => {
const template = Template.fromStack(stack);
expect(template.toJSON()).toMatchSnapshot();
});

it('only uses arm64 lambdas', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test should help enforce usage of arm64 based lambdas.

@akash1810 akash1810 changed the title wip: ARM64 Move to Arm64 lambdas Mar 27, 2024
@akash1810 akash1810 marked this pull request as ready for review March 28, 2024 07:59
@akash1810 akash1810 requested review from a team as code owners March 28, 2024 07:59
Copy link
Contributor

@NovemberTang NovemberTang left a comment

Choose a reason for hiding this comment

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

Having reviewed the table, it looks like our arm-based lambdas generally take longer to run, and have a higher memory usage. How does this balance out with a cheaper unit price?

@akash1810
Copy link
Member Author

Having reviewed the table, it looks like our arm-based lambdas generally take longer to run, and have a higher memory usage. How does this balance out with a cheaper unit price?

With the same duration, and memory usage Arm64 is 20% cheaper than x86_64.

The "worst" change is to the github-actions-usage lambda, which sees a 19.08% duration increase. Given these lambdas don't have need to complete in a given timeframe, I think this change is acceptable. Whilst it'll take longer, the Arm64 version will cost ~16% less1.

Footnotes

  1. ~80% of 20%.

@akash1810 akash1810 enabled auto-merge March 28, 2024 10:44
@akash1810 akash1810 merged commit cdc1925 into main Mar 28, 2024
2 checks passed
@akash1810 akash1810 deleted the aa/arm64 branch March 28, 2024 10:45
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