Code Monkey home page Code Monkey logo

kotlin-lambda-example-snapstart's Introduction

kotlin-lambda-example-snapstart

Kotlin Lambda SnapStart example contains multiple setups of the same Lambda implementation in order to compare performance effect SnapStart has on Kotlin/JVM AWS Lambda. The results are published in the following blog: SnapStart your Kotlin AWS Lambda with CRaC.

Infrastructure

Kotlin Lambda SnapStart Example contains 7 CDK stacks: stack for DynamoDB table resource, and 6 stacks containing AWS Lambda resource variants -

  • JVM ARM64
  • JVM ARM64 with C1 compiler optimisation
  • JVM SnapStart Only
  • JVM SnapStart with C1 compiler optimisation
  • JVM SnapStart with priming using CRaC hooks
  • JVM SnapStart with C1 compiler optimisation and priming using CRaC hooks.

Build & Deployment from local machine

Build kotlin app

Unit tests are using Testcontainers to run DynamoDB locally. Ensure docker is running locally, then execute:

./gradlew clean build

Set up CDK deployment

Install CDK (if you have not already):

npm install -g aws-cdk

If you have not set up CDK in you AWS account yet, please run (replace variables in brackets with actual values):

cdk bootstrap aws://[aws_account_id]/[aws_region]

Now deploy all stacks:

cdk deploy -vv --require-approval never --all

Build & Deployment to AWS account from GitHub

Set up the following secrets in your GitHub project:

AWS_ACCOUNT_ID
AWS_ACCESS_KEY
AWS_SECRET_KEY

Update AWS region in workflow-build-deploy.yml in .github folder of the project

Test the application

  1. create an item in Dynamo DB table Products-SnapStart-Example :
{
 "id": "1",
 "name": "Product1",
 "price": 5.99
}

Go to Lambda in console, find lambda variant to be tested and test that lambda with input:

{
  "id": "1"
}

kotlin-lambda-example-snapstart's People

Contributors

elenavanengelenmaslova avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.