From 86272ee3589aa9ce255c0375004d7a19abd827c5 Mon Sep 17 00:00:00 2001 From: Igor Anic Date: Mon, 6 Dec 2021 16:41:53 +0100 Subject: [PATCH] set node lambda functions limit to 1769MB Ref: https://www.sentiatechblog.com/aws-re-invent-2020-day-3-optimizing-lambda-cost-with-multi-threading?utm_source=reddit&utm_medium=social&utm_campaign=day3_lambda And my metrics from deploy optimizations test. Each test runs 3 times new (deploy) and destroy project stage. Testing with different memory size of lambda functions. Showing aggregate time of all 3 cycles. 442 4m36.496s 885 3m25.648s 1769 2m35.374s 3009 2m27.723s 442 4m41.64s 885 2m57.535s 1769 2m51.921s 1769 2m34.116s 3009 2m21.645s 5308 2m24.637s 1769 2m34.116s 3009 2m21.645s 512 3m44.464s 1024 3m1.944s 2048 2m32.52s 4096 2m11.988s 3009 3m27.002s 5308 3m37.171s 7077 3m14.86s 8846 3m2.501s --- cli/controller/setup_stack_template.yml | 2 +- node/terraform/modules/functions-node/main.tf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/controller/setup_stack_template.yml b/cli/controller/setup_stack_template.yml index f7a08d4f..a42a35ed 100644 --- a/cli/controller/setup_stack_template.yml +++ b/cli/controller/setup_stack_template.yml @@ -112,7 +112,7 @@ Resources: Handler: bootstrap Runtime: provided.al2 Timeout: 900 - MemorySize: 512 + MemorySize: 1769 Architectures: ['arm64'] Layers: - arn:aws:lambda:{{.Region}}:477361877445:layer:terraform-layer:1 diff --git a/node/terraform/modules/functions-node/main.tf b/node/terraform/modules/functions-node/main.tf index 1d011da3..13a5c8de 100644 --- a/node/terraform/modules/functions-node/main.tf +++ b/node/terraform/modules/functions-node/main.tf @@ -3,7 +3,7 @@ locals { "deploy" = { method = "POST" s3_key = "${var.functions_path}/deploy.zip" - memory_size = 512 + memory_size = 1769 timeout = 900 architecture = "arm64" layers = ["arn:aws:lambda:${var.region}:477361877445:layer:terraform-layer:1"] @@ -12,7 +12,7 @@ locals { "security" = { method = "GET" s3_key = "${var.functions_path}/security.zip" - memory_size = 128 + memory_size = 1769 timeout = 900 architecture = "arm64" policy = data.aws_iam_policy_document.security.json @@ -20,7 +20,7 @@ locals { "destroy" = { method = "POST" s3_key = "${var.functions_path}/destroy.zip" - memory_size = 512 + memory_size = 1769 timeout = 900 architecture = "arm64" layers = ["arn:aws:lambda:${var.region}:477361877445:layer:terraform-layer:1"]