Lambda update function memory
Lambda update function memory causes the memory of a Lambda function to update to a specific value for a certain duration. This fault:
- Determines a safe overall memory limit value for the function. Smaller the memory limit, higher will be the time taken by the Lambda function under load.
Lambda update function memory:
- Helps build resilience to unexpected scenarios such as hitting a memory limit with the Lambda function, that slows down the service and impacts its delivery. Running out of memory due to smaller limits interrupts the flow of the given function.
- Checks the performance of the application (or service) running with a new memory limit.
- Kubernetes version 1.17 or later is required to execute this fault.
- Access to operate AWS Lambda functions.
- Lambda function must be up and running.
- Kubernetes secret must have the AWS access configuration(key) in the
CHAOS_NAMESPACE. A secret file looks like this:
# Add the cloud AWS credentials respectively
aws_access_key_id = XXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXX
- Harness recommends using the same secret name, that is,
cloud-secret. Otherwise, you must update the
AWS_SHARED_CREDENTIALS_FILEenvironment variable in the fault template and you won't be able to use the default health check probes.
- Go to AWS named profile for chaos to use a different profile for AWS faults.
- Go to superset permission/policy to execute all AWS faults.
- Go to common tunables and AWS-specific tunables to tune the common tunables for all faults and AWS-specific tunables.
Below is an example AWS policy to execute the fault.
|FUNCTION_NAME||Function name of the target Lambda function. It supports single function name.|| For example, |
|MEMORY_IN_MEGABYTES||Provide the value of the memory limit of a function in megabytes.||Minimum memory limit on a Lambda function is 128Mb and the maximum is 10240 Mb.|
|REGION||Region name of the target Lambda function|| For example, |
|TOTAL_CHAOS_DURATION||Duration that you specify, through which chaos is injected into the target resource (in seconds).||Default: 30 s.|
|CHAOS_INTERVAL||The interval (in seconds) between successive instance termination.||Default: 30 s.|
|SEQUENCE||It defines sequence of chaos execution for multiple instance||Default value: parallel. Supported: serial, parallel|
|RAMP_TIME||Period to wait before and after injection of chaos in seconds||For example, 30 s.|
Updates the Lambda function memory limit to a different value. Tune it by using
MEMORY_IN_MEGABYTES environment variable.
The following YAML snippet illustrates the use of this environment variable:
# contains the memory limit value for the lambda function
- name: lambda-update-function-memory
# provide the function memory limit
- name: MEMORY_IN_MEGABYTES
# provide the function name for memory limit chaos
- name: FUNCTION_NAME