Performance Impact and Failover Handling
Performance Impact on your AWS Lambda function
AWS Lambda Extensions can impact the performance and execution time of your AWS Lambda functions since they share the CPU, memory, network resources with your AWS Lambda functions.
Execution time
The Sumo Logic AWS Lambda extension is built on a producer-consumer design approach. The logs are sent to Sumo Logic as and when they are received from the AWS Lambda Logs API.
The execution time of the Sumo Logic AWS Lambda extension is dependent on the execution time of the AWS Lambda execution time. The extension will be frozen when the AWS Lambda function completes its execution.
The logs which are not sent to Sumo Logic during the execution phase of the AWS Lambda function, are either sent in the next execution phase or shutdown phase of the function. Function logs are enhanced with Sumo Logic specific metadata and then are sent to Sumo Logic in chunks.
If you are only using the Sumo Logic Lambda extension and no other extensions with your Lambda function, the PostRuntimeExtensionsDuration CloudWatch metric should always have a value of zero.
Memory Usage
The Sumo Logic AWS Lambda extension memory usage is dependent upon the amount of logs generated by your AWS Lambda function. To check the memory consumption impact of the Sumo Logic AWS Lambda extension, you will need to monitor the memory usage of your AWS Lambda function.
Lifecycle Events
With the introduction of AWS Lambda extensions, the lifecycle of your AWS Lambda environment has some additional steps during Init, Invoke and Shutdown phase. For details, please see the AWS Lambda Extension Lifecycle.
Additional details on how the Extension works:
- In the Init phase, the extension:
- Registers itself with the Extensions API by calling the register endpoint:
http://${AWS_LAMBDA_RUNTIME_API}/2020-01-01/extension/register
- Subscribes to AWS Logs API by calling the logs endpoint:
http://${AWS_LAMBDA_RUNTIME_API}/2020-08-15/logs
- Starts an HTTP server to receive logs.
- Registers itself with the Extensions API by calling the register endpoint:
- In the Invoke phase, the Extension:
- Receives an INVOKE event from the Extensions API, in parallel. This activates the Extension to start sending logs generated from the AWS Lambda function to Sumo Logic.
- Is frozened when the AWS Lambda function stops executing.
- In the Shutdown phase, the Extension:
- Sends all the remaining logs to Sumo Logic within a 2 second time interval.
Failover Handling
In case of Failure due to throttling or network issue, a failover mechanism to send logs to S3 bucket is also provided with Sumo Logic AWS Lambda extension. To see all the available parameters, visit Sumo logic AWS Lambda Extension.
The Logs that are sent to S3, then can be sent to Sumo Logic using the Sumo Logic AWS S3 source.