https://github.com/alexcasalboni/aws-lambda-power-tuning Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} alexcasalboni / aws-lambda-power-tuning Public * Notifications * Fork 236 * Star 3.3k AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced. Apache-2.0 License 3.3k stars 236 forks Star Notifications * Code * Issues 5 * Pull requests 1 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 8 branches 0 tags Code Latest commit @alexcasalboni alexcasalboni Merge pull request #162 from alexcasalboni/dependabot/ npm_and_yarn/mi... ... 779354c Mar 29, 2022 Merge pull request #162 from alexcasalboni/dependabot/npm_and_yarn/ mi... ...nimist-1.2.6 Bump minimist from 1.2.5 to 1.2.6 779354c Git stats * 521 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time imgs update images Jul 17, 2020 lambda Minor refactor to handle weighted payloads, add more tests Jan 3, 2022 layer-sdk Update SDK version to 2.1004.0 Oct 11, 2021 scripts bumped to version 4.2.0 Jan 3, 2022 terraform Minor docs update for Terraform Feb 14, 2022 test update tests for coverage and linting Feb 15, 2022 .eslintrc.json ignore max-len linting Jul 28, 2019 .gitignore refactor Deploy instructions to use native SAM build/deploy, reformat... Nov 24, 2021 .mocharc.js introduce test-suite sinon May 3, 2020 .nycrc.json introduce test-suite sinon May 3, 2020 .travis.yml Add NodeJS 15 and 16 to Travis Nov 18, 2021 LICENSE.txt renamed license May 13, 2019 README-ADVANCED.md refactor README Jul 17, 2020 README-DEPLOY.md Update README-DEPLOY.md Mar 21, 2022 README-EXECUTE.md Update README-EXECUTE.md Sep 14, 2020 README-INPUT-OUTPUT.md updated documentation Jan 3, 2022 README-SAR.md bumped to version 4.2.0 Jan 3, 2022 README.md bumped to version 4.2.0 Jan 3, 2022 package-lock.json Bump minimist from 1.2.5 to 1.2.6 Mar 26, 2022 package.json update dev dependencies Feb 15, 2022 template.yml bumped to version 4.2.0 Jan 3, 2022 View code [ ] AWS Lambda Power Tuning What does the state machine look like? What results can I expect from Lambda Power Tuning? How to deploy the state machine How to execute the state machine State Machine Input and Output Data visualization Power Tuner UI Additional features, considerations, and internals CHANGELOG (SAR versioning) Contributing How to get started with local development? README.md AWS Lambda Power Tuning Build Status Coverage Status GitHub license Maintenance GitHub issues Open Source Love svg2 GitHub stars AWS Lambda Power Tuning is a state machine powered by AWS Step Functions that helps you optimize your Lambda functions for cost and/ or performance in a data-driven way. The state machine is designed to be easy to deploy and fast to execute. Also, it's language agnostic so you can optimize any Lambda functions in your account. Basically, you can provide a Lambda function ARN as input and the state machine will invoke that function with multiple power configurations (from 128MB to 10GB, you decide which values). Then it will analyze all the execution logs and suggest you the best power configuration to minimize cost and/or maximize performance. Please note that the input function will be executed in your AWS account - performing real HTTP requests, SDK calls, cold starts, etc. The state machine also supports cross-region invocations and you can enable parallel execution to generate results in just a few seconds. What does the state machine look like? It's pretty simple and you can visually inspect each step in the AWS management console. state-machine What results can I expect from Lambda Power Tuning? The state machine will generate a visualization of average cost and speed for each power configuration. For example, this is what the results look like for two CPU-intensive functions, which become cheaper AND faster with more power: visualization1 How to interpret the chart above: execution time goes from 35s with 128MB to less than 3s with 1.5GB, while being 14% cheaper to run. visualization2 How to interpret the chart above: execution time goes from 2.4s with 128MB to 300ms with 1GB, for the very same average cost. How to deploy the state machine There are a few options documented here. How to execute the state machine You can execute the state machine manually or programmatically, see the documentation here. State Machine Input and Output Here's a typical execution input with basic parameters: { "lambdaARN": "your-lambda-function-arn", "powerValues": [128, 256, 512, 1024], "num": 50, "payload": {} } Full input documentation here. The state machine output will look like this: { "results": { "power": "128", "cost": 0.0000002083, "duration": 2.906, "stateMachine": { "executionCost": 0.00045, "lambdaCost": 0.0005252, "visualization": "https://lambda-power-tuning.show/#" } } } Full output documentation here. Data visualization You can visually inspect the tuning results to identify the optimal tradeoff between cost and performance. visualization The data visualization tool has been built by the community: it's a static website deployed via AWS Amplify Console and it's free to use. If you don't want to use the visualization tool, you can simply ignore the visualization URL provided in the execution output. No data is ever shared or stored by this tool. Website repository: matteo-ronchetti/aws-lambda-power-tuning-ui Optionally, you could deploy your own custom visualization tool and configure the CloudFormation Parameter named visualizationURL with your own URL. Power Tuner UI Lambda Power Tuner UI is a web interface to simplify the deployment and execution of Lambda Power Tuning. It's built and maintained by Matthew Dorrian and it aims at providing a consistent interface and a uniform developer experience across teams and projects. Power Tuner UI Power Tuner UI repository: mattymoomoo/aws-power-tuner-ui Additional features, considerations, and internals Here you can find out more about some advanced features of this project, its internals, and some considerations about security and execution cost. CHANGELOG (SAR versioning) From most recent to oldest, with major releases in bold: * 4.2.0 (2022-01-03): support S3 payloads * 4.1.4 (2022-01-03): sorting bugfix and updated dependencies * 4.1.3 (2021-12-16): support simple strings as event payload * 4.1.2 (2021-10-12): add x86_64 fallback when Graviton is not supported yet * 4.1.1 (2021-10-12): fixed connection timeout for long-running functions * 4.1.0 (2021-10-11): support Lambda functions powered by Graviton2 * 4.0.0 (2021-08-16): support AWS Lambda states expansion to all functions * 3.4.2 (2020-12-03): permissions boundary bugfix (Step Functions role) * 3.4.1 (2020-12-02): permissions boundary support * 3.4.0 (2020-12-01): 1ms billing * 3.3.3 (2020-07-17): payload logging bugfix for pre-processors * 3.3.2 (2020-06-17): weighted payloads bugfix (for real) * 3.3.1 (2020-06-16): weighted payloads bugfix * 3.3.0 (2020-06-10): Pre/Post-processing functions, correct regional pricing, customizable execution timeouts, and other internal improvements * 3.2.5 (2020-05-19): improved logging for weighted payloads and in case of invocation errors * 3.2.4 (2020-03-11): dryRun bugfix * 3.2.3 (2020-02-25): new dryRun input parameter * 3.2.2 (2020-01-30): upgraded runtime to Node.js 12.x * 3.2.1 (2020-01-27): improved scripts and SAR template reference * 3.2.0 (2020-01-17): support for weighted payloads * 3.1.2 (2020-01-17): improved optimal selection when same speed/ cost * 3.1.1 (2019-10-24): customizable least-privilege (lambdaResource CFN param) * 3.1.0 (2019-10-24): $LATEST power reset and optional auto-tuning (new Optimizer step) * 3.0.0 (2019-10-22): dynamic parallelism (powerValues as execution parameter) * 2.1.3 (2019-10-22): upgraded runtime to Node.js 10.x * 2.1.2 (2019-10-17): new balanced optimization strategy * 2.1.1 (2019-10-10): custom domain for visualization URL * 2.1.0 (2019-10-10): average statistics visualization (URL in state machine output) * 2.0.0 (2019-07-28): multiple optimization strategies (cost and speed), new output format with AWS Step Functions and AWS Lambda cost * 1.3.1 (2019-07-23): retry policies and failed invocations management * 1.3.0 (2019-07-22): implemented error handling * 1.2.1 (2019-07-22): Node.js refactor and updated IAM permissions (added lambda:UpdateAlias) * 1.2.0 (2019-05-24): updated IAM permissions (least privilege for actions) * 1.1.1 (2019-05-15): updated docs * 1.1.0 (2019-05-15): cross-region invocation support * 1.0.1 (2019-05-13): new README for SAR * 1.0.0 (2019-05-13): AWS SAM refactor (published on SAR) * 0.0.1 (2017-03-27): previous project (serverless framework) Contributing Feature requests and pull requests are more than welcome! How to get started with local development? For this repository, install dev dependencies with npm install. You can run tests with npm test, linting with npm run lint, and coverage with npm run coverage. Travis will automatically run the test suite on every commit and PR. About AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced. Topics aws lambda performance cloud aws-lambda serverless cost stepfunctions Resources Readme License Apache-2.0 License Stars 3.3k stars Watchers 67 watching Forks 236 forks Releases No releases published Packages 0 No packages published Contributors 15 * @alexcasalboni * @gino247 * @matteo-ronchetti * @dependabot[bot] * @Clete2 * @gliptak * @claudiopastorini * @andybkay * @teknogeek0 * @syeutyu * @smosek + 4 contributors Languages * JavaScript 90.1% * HCL 8.4% * Shell 1.5% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.