[{"data":1,"prerenderedAt":401},["ShallowReactive",2],{"content-svc-lambda-guides-effectively-running-java-on-serverless-graviton":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":15,"menu":16,"menuType":392,"isCollapseableMenu":19,"nextDocItem":190,"previousDocItem":166,"contributorPaths":393,"contentName":400,"slug":186,"readingTime":33},"\u003Cp>Migrating to Graviton2 processors for AWS Lambda functions is easy as clicking a radio button in the AWS Management console.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Fgraviton_console.png\" alt=\"GravitonConsole\">\u003C\u002Fp>\n\u003Cp>You edit the underlying architecture from \u003Ccode>x86_64\u003C\u002Fcode> to \u003Ccode>arm64\u003C\u002Fcode> and save. That&#39;s it. Future invocations of the Lambda \nfunctions will use Graviton2 processors that allow you to get up to 34% better price performance. You can use Lambda SnapStart\nwith Graviton2 processors too.\u003C\u002Fp>\n\u003Ch4>AWS SAM\u003C\u002Fh4>\n\u003Cp>You can enable Graviton2 in SAM template as following:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-yaml\">MyArmFunction:\n  Type: AWS::Lambda::Function\n  Properties:\n    Runtime: nodejs18.x\n    Code: src\u002F\n    Architectures:\n  \t  - arm64\n    Handler: lambda.handler\n    MemorySize: 512\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch4>Visualize Graviton2 savings in AWS Lambda Power Tuning tool\u003C\u002Fh4>\n\u003Cp>The \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Falexcasalboni\u002Faws-lambda-power-tuning\">AWS Lambda Power Tuning\u003C\u002Fa> open-source project runs your functions \nusing different settings to suggest a configuration to minimize costs and maximize performance. \nThe tool allows you to compare two results on the same chart and incorporate arm64-based pricing. \nThis is useful to compare two versions of the same function, one using x86 and the other arm64.\u003C\u002Fp>\n\u003Cp>For example, you can compare the performance of the x86_64 and arm64 Lambda functions and see that the arm64 Lambda function is 12% cheaper to run:\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Fgraviton_power_tuning.png\" alt=\"GravitonSavings\">\u003C\u002Fp>\n\u003Ch4>Considerations\u003C\u002Fh4>\n\u003Cp>If your Java-based Lambda functions don’t use architecture-specific binaries, \nincluding in their dependencies, you can switch from one architecture to the other. \u003C\u002Fp>\n",{"title":6,"order":7,"authors":8,"resources":10},"Using Graviton2",6,[9],"Dhiraj Mahapatro",[11],{"link":12,"text":13,"type":14},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fmigrating-aws-lambda-functions-to-arm-based-aws-graviton2-processors\u002F","Using Arm-based Graviton2 processors","blog","Migrating to Graviton2 processors for AWS Lambda functions is easy as clicking a radio button in the AWS Management console.\n\n![GravitonConsole](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Fgraviton_console.png)\n\nYou edit the underlying architecture from `x86_64` to `arm64` and save. That's it. Future invocations of the Lambda \nfunctions will use Graviton2 processors that allow you to get up to 34% better price performance. You can use Lambda SnapStart\nwith Graviton2 processors too.\n\n#### AWS SAM\nYou can enable Graviton2 in SAM template as following:\n\n```yaml\nMyArmFunction:\n  Type: AWS::Lambda::Function\n  Properties:\n    Runtime: nodejs18.x\n    Code: src\u002F\n    Architectures:\n  \t  - arm64\n    Handler: lambda.handler\n    MemorySize: 512\n```\n\n#### Visualize Graviton2 savings in AWS Lambda Power Tuning tool\n\nThe [AWS Lambda Power Tuning](https:\u002F\u002Fgithub.com\u002Falexcasalboni\u002Faws-lambda-power-tuning) open-source project runs your functions \nusing different settings to suggest a configuration to minimize costs and maximize performance. \nThe tool allows you to compare two results on the same chart and incorporate arm64-based pricing. \nThis is useful to compare two versions of the same function, one using x86 and the other arm64.\n\nFor example, you can compare the performance of the x86_64 and arm64 Lambda functions and see that the arm64 Lambda function is 12% cheaper to run:\n\n![GravitonSavings](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Fgraviton_power_tuning.png)\n\n#### Considerations\nIf your Java-based Lambda functions don’t use architecture-specific binaries, \nincluding in their dependencies, you can switch from one architecture to the other. \n",[17,37,63,187,240,297,313,352,374],{"title":18,"collapsible":19,"isCollapsed":20,"content":21},"Introduction",false,true,[22],{"title":23,"order":24,"authors":25,"callout":26,"prerequisite":30,"time":33,"path":34,"id":35,"link":36},"Getting Started",1,[9],{"title":27,"description":28,"link":29},"Watch this video","This Devoxx Belgium 2023 presentation shows effectively running Java on Serverless","https:\u002F\u002Fyoutu.be\u002Fu3tgOE8qFjI?t=5549",[31,32],"Understanding of Java","Understanding of AWS Lambda","2 min","1-introduction","1-introduction.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002F1-introduction",{"title":38,"collapsible":19,"isCollapsed":20,"content":39},"History",[40,48,55],{"title":41,"order":42,"authors":43,"time":44,"path":45,"id":46,"link":47},"Evolution of Java",3,[9],"1 min","history","history.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fhistory",{"title":49,"order":50,"authors":51,"time":33,"path":52,"id":53,"link":54},"Evolution of Compute",4,[9],"compute","compute.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcompute",{"title":56,"order":57,"authors":58,"time":33,"path":60,"id":61,"link":62},"Challenges",5,[9,59],"Maximilian Schellhorn","challenge","challenge.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fchallenge",{"title":64,"collapsible":19,"isCollapsed":19,"content":65},"Best Practices",[66,83,93,99,116,132,150,166,180],{"title":67,"order":7,"youtubeVideoID":68,"authors":69,"callout":71,"resources":74,"time":79,"path":80,"id":81,"link":82},"Lambda Snapstart","ZbnAithBNYY",[70,9],"Vipan Kumar",{"title":27,"description":72,"link":73},"This serverless office hours session dives deeper into Lambda SnapStart.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=Y5b8_KToeDY",[75],{"link":76,"text":77,"type":78},"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=IIKe2dx9Ag0","Spring IO (Barcelona)","video","8 min","snapstart","snapstart.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fsnapstart",{"title":84,"order":7,"authors":85,"callout":86,"time":44,"path":90,"id":91,"link":92},"Tiered Compilation",[70],{"title":87,"description":88,"link":89},"Read this blog","This AWS blog explains Tiered compilation in details","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fincreasing-performance-of-java-aws-lambda-functions-using-tiered-compilation\u002F","tiered-compilation","tiered-compilation.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ftiered-compilation",{"title":94,"order":7,"authors":95,"time":44,"path":96,"id":97,"link":98},"Utilize initialization phase",[9],"init-heavy-lifting","init-heavy-lifting.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Finit-heavy-lifting",{"title":100,"order":7,"authors":101,"youtubeVideoID":103,"resources":104,"time":112,"path":113,"id":114,"link":115},"Using RDS Proxy",[102,9],"Sonali Jena","ZQOqmMn_8jw",[105,109],{"link":106,"text":107,"type":108},"https:\u002F\u002Faws.amazon.com\u002Fgetting-started\u002Fhands-on\u002Fset-up-shared-database-connection-amazon-rds-proxy\u002F","Shared DB connections with RDS Proxy","user guide",{"link":110,"type":108,"text":111},"https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonRDS\u002Flatest\u002FAuroraUserGuide\u002Frds-proxy.html","RDS Proxy","4 min","rds-proxy","rds-proxy.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Frds-proxy",{"title":117,"order":7,"authors":118,"callout":119,"prerequisite":123,"resources":125,"time":33,"path":129,"id":130,"link":131},"Choice of HTTP Clients",[70,9],{"title":120,"description":121,"link":122},"Read this Blog","This blog explains how AWS CRT HTTP Client offers faster startup time and small memory footprint","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fdeveloper\u002Fannouncing-availability-of-the-aws-crt-http-client-in-the-aws-sdk-for-java-2-x\u002F",[124],"Before moving on to HTTP clients, the first and foremost requirement to improve performance in Lambda functions is to upgrade from AWS SDK Java v1 to AWS SDK Java v2 as soon as possible. Version 2 of the AWS SDK was released in Nov 2018 with a lot of performance upgrades.",[126],{"link":127,"type":14,"text":128},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fdeveloper\u002Faws-sdk-for-java-2-x-released\u002F","AWS SDK for Java v2","http-clients","http-clients.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fhttp-clients",{"title":133,"order":7,"authors":134,"youtubeVideoID":135,"resources":136,"time":112,"path":147,"id":148,"link":149},"Hexagonal Architecture",[70],"kRFg6fkVChQ",[137,141,144],{"link":138,"text":139,"type":140},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fprescriptive-guidance\u002Flatest\u002Fhexagonal-architectures\u002Fwelcome.html","Hexagonal architecture","guidance",{"link":142,"text":143,"type":14},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fdeveloping-portable-aws-lambda-functions\u002F","Portable Lambda functions",{"link":145,"type":14,"text":146},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fdeveloping-evolutionary-architecture-with-aws-lambda\u002F","Building evolutionary architecture on AWS Lambda","hexagonal","hexagonal.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fhexagonal",{"title":151,"order":7,"authors":152,"youtubeVideoID":154,"resources":155,"time":33,"path":163,"id":164,"link":165},"Powertools for AWS Lambda",[153],"Lavanya Tangutur","dH2GP6Lydj8",[156,160],{"link":157,"text":158,"type":159},"https:\u002F\u002Fgithub.com\u002Faws-powertools\u002Fpowertools-lambda-java","Powertools for AWS Lambda (Java)","github",{"link":161,"type":14,"text":162},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fopensource\u002Fsimplifying-serverless-best-practices-with-aws-lambda-powertools-java\u002F","Best practices with Powertools","powertools","powertools.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fpowertools",{"title":167,"order":7,"authors":168,"youtubeVideoID":169,"callout":170,"resources":174,"time":44,"path":177,"id":178,"link":179},"Lambda Power tuning ",[153,9],"z8wGSykEauI",{"title":171,"description":172,"link":173},"Watch the video","This video covers a variety of AWS Lambda performance and cost optimization techniques including use of Power tuning.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=z8wGSykEauI",[175,176],{"link":106,"text":107,"type":108},{"link":110,"type":108,"text":111},"powertuning","powertuning.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fpowertuning",{"title":6,"order":7,"authors":181,"resources":182,"time":33,"path":184,"id":185,"link":186},[9],[183],{"link":12,"text":13,"type":14},"graviton","graviton.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fgraviton",{"title":188,"collapsible":19,"isCollapsed":20,"content":189},"Java frameworks",[190,205,214,230],{"title":191,"order":192,"authors":193,"resources":194,"time":33,"path":202,"id":203,"link":204},"Micronaut",7,[153,9],[195,199],{"link":196,"text":197,"type":198},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-java-frameworks-samples\u002Ftree\u002Fmain","Serverless Java Frameworks","GitHub",{"link":200,"text":201,"type":198},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-lambda-rds-snapstart","Micronaut with RDS","micronaut","micronaut.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fmicronaut",{"title":206,"order":192,"authors":207,"resources":208,"time":33,"path":211,"id":212,"link":213},"Quarkus",[153,9],[209],{"link":196,"text":210,"type":198},"Quarkus sample application","quarkus","quarkus.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fquarkus",{"title":215,"order":192,"authors":216,"resources":217,"time":112,"path":227,"id":228,"link":229},"Spring",[153,59],[218,219,223],{"link":196,"text":210,"type":198},{"link":220,"text":221,"type":222},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US","Java on AWS Lambda","workshop",{"link":224,"text":225,"type":226},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fdevops\u002Fdeveloping-with-java-and-spring-boot-using-amazon-codewhisperer\u002F","Build Spring Boot using Amazon CodeWhisperer","Blog","springboot","springboot.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fspringboot",{"title":231,"order":192,"authors":232,"resources":233,"time":33,"path":237,"id":238,"link":239},"GraalVM Native Image",[153,9],[234,236],{"link":196,"text":235,"type":198},"GraalVM sample application",{"link":220,"text":221,"type":222},"graalvm","graalvm.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fgraalvm",{"title":241,"collapsible":19,"isCollapsed":20,"content":242},"Testing a Java application",[243,260,269,279,288],{"title":244,"order":245,"authors":246,"callout":248,"resources":252,"time":256,"path":257,"id":258,"link":259},"Testing Serverless",8,[247],"Lorenzo Micheli",{"title":249,"description":250,"link":251},"Read the Serverless testing guide","This guide dives deeper into Serverless testing","https:\u002F\u002Fserverlessland.com\u002Ftesting",[253],{"link":254,"text":255,"type":198},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-test-samples\u002Ftree\u002Fmain\u002Fjava-test-samples","Serverless Java test samples","3 min","testing","testing.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ftesting",{"title":261,"order":245,"authors":262,"callout":263,"resources":264,"time":112,"path":266,"id":267,"link":268},"Unit Testing",[247],{"title":249,"description":250,"link":251},[265],{"link":254,"text":255,"type":198},"unit","unit.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Funit",{"title":270,"order":245,"authors":271,"callout":272,"resources":273,"time":275,"path":276,"id":277,"link":278},"Integration Testing",[247,9],{"title":249,"description":250,"link":251},[274],{"link":254,"text":255,"type":198},"5 min","integration","integration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintegration",{"title":280,"order":245,"authors":281,"callout":282,"resources":283,"time":256,"path":285,"id":286,"link":287},"Functional Testing",[247,9],{"title":249,"description":250,"link":251},[284],{"link":254,"text":255,"type":198},"functional","functional.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ffunctional",{"title":289,"order":245,"authors":290,"callout":291,"resources":292,"time":33,"path":294,"id":295,"link":296},"Load Testing",[9],{"title":249,"description":250,"link":251},[293],{"link":254,"text":255,"type":198},"load","load.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fload",{"title":298,"collapsible":19,"isCollapsed":20,"content":299},"Local Development",[300,307],{"title":301,"order":302,"authors":303,"time":44,"path":304,"id":305,"link":306},"IntelliJ",10,[9],"intellij","intellij.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintellij",{"title":308,"order":302,"authors":309,"time":44,"path":310,"id":311,"link":312},"Visual Studio Code",[9],"vscode","vscode.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fvscode",{"title":314,"collapsible":19,"isCollapsed":20,"content":315},"Infrastructure as Code",[316,323,329,339],{"title":317,"order":318,"authors":319,"time":33,"path":320,"id":321,"link":322},"CloudFormation",9,[102],"cloudformation","cloudformation.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcloudformation",{"title":324,"order":318,"authors":325,"time":275,"path":326,"id":327,"link":328},"AWS CDK",[102],"cdk","cdk.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcdk",{"title":330,"order":318,"authors":331,"resources":332,"time":33,"path":336,"id":337,"link":338},"AWS SAM",[102],[333],{"link":334,"text":335,"type":14},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fbuilding-serverless-java-applications-with-the-aws-sam-cli\u002F","Java Serverless AWS SAM CLI","sam","sam.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fsam",{"title":340,"order":318,"authors":341,"resources":342,"time":33,"path":349,"id":350,"link":351},"Terraform",[9],[343,346],{"link":344,"type":198,"text":345},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-lambda-snapstart-terraform","Java sample with Terraform",{"link":347,"text":348,"type":108},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fserverless-application-model\u002Flatest\u002Fdeveloperguide\u002Fwhat-is-terraform-support.html","AWS SAM CLI Terraform support","terraform","terraform.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fterraform",{"title":353,"collapsible":19,"isCollapsed":20,"content":354},"Benchmarking",[355],{"title":356,"order":357,"youtubeVideoID":358,"authors":359,"resources":360,"time":44,"path":371,"id":372,"link":373},"Performance Benchmarking",11,"wmEIMWigXGc",[9],[361,363,365,368],{"link":362,"text":221,"type":222},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration\u002F02-optimizations\u002Fbenchmark",{"link":196,"text":364,"type":198},"Benchmark: Micronaut, Quarkus, and SpringBoot",{"link":366,"text":367,"type":198},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-graalvm-demo","GraalVM native image on AWS Lambda Benchmarking",{"link":369,"text":370,"type":198},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-kotlin-demo","Benchmark Kotlin on Serverless","benchmark","benchmark.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fbenchmark",{"title":375,"collapsible":19,"isCollapsed":20,"content":376},"Migration",[377],{"title":378,"order":379,"authors":380,"youtubeVideoID":381,"resources":382,"time":44,"path":389,"id":390,"link":391},"Migration Guide",12,[9],"u3tgOE8qFjI",[383,387],{"link":384,"text":385,"type":386},"https:\u002F\u002Fserverlessland.com\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fintroduction","Java re-platforming guide","Guide",{"link":220,"text":221,"type":388},"Workshop","migration","migration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fmigration","LIST",[394,395,396,397,398,399],"content\u002Fcontributors\u002Fdhiraj-mahapatro.json","content\u002Fcontributors\u002Fsonali-jena.json","content\u002Fcontributors\u002Flavanya-tangutur.json","content\u002Fcontributors\u002Fvipan-kumar.json","content\u002Fcontributors\u002Florenzo-micheli.json","content\u002Fcontributors\u002Fmaximilian-schellhorn.json","Effectively running Java on Serverless",1792665272554]