Learn how Sedai uniquely optimizes AWS serverless functions to achieve your performance and cost goals.
Sedai optimizes two key aspects of AWS Lambdas:
Memory Allocation
Autonomous Concurrency
Memory Allocation
Sedai only supports Autopilot mode for optimizing Lambda memory. The system is confident it can safely make gradual changes without disrupting the function's performance.
We recommend creating a group of Lambdas to try out Autopilot and explore the feature.
Sedai profiles serverless functions and determines optimal memory configurations based on reinforcement learning. Optimizations typically yield faster and cheaper results.
You can define specific goals to guide how the system optimizes functions.
Autonomous Concurrency
In order to use this feature, additional setup is required.
This feature helps eliminate cold starts with marginal impact on cloud spend. Using a combination of the following, Sedai informs its central control and learning unit to manage Lambda cold starts:
Sedai AV Lambda Extension (external extension written in Go): Analyzes Lambda behavior such as runtime events, cold start duration, and concurrency patterns (this allows close Lambda monitoring without any overhead)
Traffic Seasonality: Monitors and builds a seasonality model in order to understand local and global trends and anticipate traffic fluctuations
Provisioned Concurrency: Monitors concurrency events as well as concurrency scaling based on seasonality
Supported Runtimes
NodeJS 12 and above on x86_64
Python 3.7 and above on x86_64
Java 8 and above on x86_64
The static and runtime characteristics of the extension are limited to:
Additional 12 MB size in deployed Lambda layer
0.1 ms latency overhead per 1,000 invocations
0.11 ms execution time overhead per 1,000 invocations
Setup
The AV Lambda extension acts as Sedai's control center for your Lambdas. It is responsible for collecting metrics from Sedai's autonomous concurrency extensions and communicating with Sedai core components.
Deploy the AV Lambda extension manually or via your preferred IaC tool:
AWS Cloud Development Kit (CDK)
1. Set up app directory:
git clone git@github.com:SedaiEngineering/sedai-extensions.git
cd sedai-extensions/sedai-avlambda-cdk/
This will take a few minutes. CDK and CloudFormation Stack will provision the IAM Roles, DynamoDB and the Lambda Function on your AWS Account. You can view the progress in CloudFormation > Stacks > sedai-avlambda-stack.
This will take a few minutes. CloudFormation will provision the IAM Roles, DynamoDB and the Lambda Function on your AWS Account. You can view the progress in CloudFormation > Stacks > sedai-avlambda-stack.
Serverless Framework
Before you get started, please make sure you install Serverless Framework 3 and configure AWS Credentials as recommended.
6. Run sls deploy to deploy the AV Lambda function on your AWS account:
sls deploy --region <AWS-REGION> --stage production
This will take a few minutes. Serverless Framework will provision the IAM Roles, DynamoDB and the Lambda Function on your AWS Account.
Manual Setup
In this method, you will log into your AWS account in order to manually provision AWS Lambda and associated resources.
β οΈ In order to complete setup, you must have permission within your AWS account to provision Lambda functions, DynamoDB Tables, and IAM Roles.
1. Set up DynamoDB Table
Navigate to your DynamoDB Console and select Create Table; enter the following details to provision a new DynamoDB table for the AV Lambda backend:
Table Name: SedaiResourceConcurrencyStats
Partition Key:resourceId, String
Settings: Custom Settings
Read/write Capacity Settings: Provisioned
Autoscaling:ON for Read and Write (use default values)
Encryption at Rest: Use default KMS-based encryption
Tags: Optional (add per your organization's policy for creating new tables)
2. Set up IAM Role for Lambda Functions
In this step you will grant access for the DynamoDB table to invoke Lambda functions:
Navigate to IAM Console > Roles and select Create Role. Select AWS Service as your trusted entity and choose Lambda as the use case.
Select Next to Add permissions, and click the Create Policy button. In the new window, toggle to the JSON editor tab.
Download a sample template from Sedai's repository and update the <AWS-REGION> and <AWS-ACCOUNT-ID> placeholders in it, then paste the policy into the JSON editor. Select Next to optionally add tags, then Next to review the policy. Enter a unique name for the policy (such as iam-policy-sedai-avlambda-control-center) and select Create Policy to complete.
From the Add permissions page, refresh the list and select the newly created IAM policy. Click Next and enter a unique name for the role (such as iam-role-sedai-avlambda-control-center) and click on Create Role to finish setup.