[{"data":1,"prerenderedAt":400},["ShallowReactive",2],{"content-svc-lambda-guides-effectively-running-java-on-serverless-tiered-compilation":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":14,"menu":15,"menuType":391,"isCollapseableMenu":18,"nextDocItem":88,"previousDocItem":66,"contributorPaths":392,"contentName":399,"slug":87,"readingTime":44},"\u003Cblockquote>\n\u003Cp>With the Java 17 runtime, this feature is enabled by default.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Cp>Java uses Just In Time (JIT) compilers to compile bytecode to native code for frequently executed sections to boost performance. \nThere are two types of JIT compilers; C1 is optimized for faster start-up times, and C2 is optimized for better overall performance. \nWith the option of these two JIT compilers, Java supports five levels of compilations allowing us to optimize for faster \nstartup at one end and faster performance at the other end. For lower method complexity typical for Lambda functions, \nit is recommended that we explicitly set the compilation level to 1, where the compiler quickly produces optimized \nnative code but does not generate any profiling data. This reduces cold start times.\u003C\u002Fp>\n\u003Cp>Compilation level is set by adding the \u003Ccode>JAVA_TOOL_OPTIONS\u003C\u002Fcode>  environment variable to value \u003Ccode>-XX:+TieredCompilation -XX:TieredStopAtLevel=1\u003C\u002Fcode>\u003C\u002Fp>\n\u003Cp>Here is a code snippet for CDK:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-javascript\">Function.Builder.create(this, &quot;MyLambdaFunction&quot;)\n  \u002F\u002F ... Other parameters are omitted for brevity\n  .environment(Map.of(\n    &quot;JAVA_TOOL_OPTIONS&quot;, &quot;-XX:+TieredCompilation -XX:TieredStopAtLevel=1&quot;\n  ))\n  .build();\n\u003C\u002Fcode>\u003C\u002Fpre>\n",{"title":6,"order":7,"authors":8,"callout":10},"Tiered Compilation",6,[9],"Vipan Kumar",{"title":11,"description":12,"link":13},"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","> With the Java 17 runtime, this feature is enabled by default.\n\nJava uses Just In Time (JIT) compilers to compile bytecode to native code for frequently executed sections to boost performance. \nThere are two types of JIT compilers; C1 is optimized for faster start-up times, and C2 is optimized for better overall performance. \nWith the option of these two JIT compilers, Java supports five levels of compilations allowing us to optimize for faster \nstartup at one end and faster performance at the other end. For lower method complexity typical for Lambda functions, \nit is recommended that we explicitly set the compilation level to 1, where the compiler quickly produces optimized \nnative code but does not generate any profiling data. This reduces cold start times.\n\nCompilation level is set by adding the `JAVA_TOOL_OPTIONS`  environment variable to value `-XX:+TieredCompilation -XX:TieredStopAtLevel=1`\n\nHere is a code snippet for CDK:\n\n```javascript\nFunction.Builder.create(this, \"MyLambdaFunction\")\n  \u002F\u002F ... Other parameters are omitted for brevity\n  .environment(Map.of(\n    \"JAVA_TOOL_OPTIONS\", \"-XX:+TieredCompilation -XX:TieredStopAtLevel=1\"\n  ))\n  .build();\n```\n",[16,37,63,186,239,296,312,351,373],{"title":17,"collapsible":18,"isCollapsed":19,"content":20},"Introduction",false,true,[21],{"title":22,"order":23,"authors":24,"callout":26,"prerequisite":30,"time":33,"path":34,"id":35,"link":36},"Getting Started",1,[25],"Dhiraj Mahapatro",{"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":18,"isCollapsed":19,"content":39},"History",[40,48,55],{"title":41,"order":42,"authors":43,"time":44,"path":45,"id":46,"link":47},"Evolution of Java",3,[25],"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,[25],"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,[25,59],"Maximilian Schellhorn","challenge","challenge.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fchallenge",{"title":64,"collapsible":18,"isCollapsed":18,"content":65},"Best Practices",[66,82,88,94,111,128,146,162,176],{"title":67,"order":7,"youtubeVideoID":68,"authors":69,"callout":70,"resources":73,"time":78,"path":79,"id":80,"link":81},"Lambda Snapstart","ZbnAithBNYY",[9,25],{"title":27,"description":71,"link":72},"This serverless office hours session dives deeper into Lambda SnapStart.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=Y5b8_KToeDY",[74],{"link":75,"text":76,"type":77},"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":6,"order":7,"authors":83,"callout":84,"time":44,"path":85,"id":86,"link":87},[9],{"title":11,"description":12,"link":13},"tiered-compilation","tiered-compilation.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ftiered-compilation",{"title":89,"order":7,"authors":90,"time":44,"path":91,"id":92,"link":93},"Utilize initialization phase",[25],"init-heavy-lifting","init-heavy-lifting.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Finit-heavy-lifting",{"title":95,"order":7,"authors":96,"youtubeVideoID":98,"resources":99,"time":107,"path":108,"id":109,"link":110},"Using RDS Proxy",[97,25],"Sonali Jena","ZQOqmMn_8jw",[100,104],{"link":101,"text":102,"type":103},"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":105,"type":103,"text":106},"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":112,"order":7,"authors":113,"callout":114,"prerequisite":118,"resources":120,"time":33,"path":125,"id":126,"link":127},"Choice of HTTP Clients",[9,25],{"title":115,"description":116,"link":117},"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",[119],"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.",[121],{"link":122,"type":123,"text":124},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fdeveloper\u002Faws-sdk-for-java-2-x-released\u002F","blog","AWS SDK for Java v2","http-clients","http-clients.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fhttp-clients",{"title":129,"order":7,"authors":130,"youtubeVideoID":131,"resources":132,"time":107,"path":143,"id":144,"link":145},"Hexagonal Architecture",[9],"kRFg6fkVChQ",[133,137,140],{"link":134,"text":135,"type":136},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fprescriptive-guidance\u002Flatest\u002Fhexagonal-architectures\u002Fwelcome.html","Hexagonal architecture","guidance",{"link":138,"text":139,"type":123},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fdeveloping-portable-aws-lambda-functions\u002F","Portable Lambda functions",{"link":141,"type":123,"text":142},"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":147,"order":7,"authors":148,"youtubeVideoID":150,"resources":151,"time":33,"path":159,"id":160,"link":161},"Powertools for AWS Lambda",[149],"Lavanya Tangutur","dH2GP6Lydj8",[152,156],{"link":153,"text":154,"type":155},"https:\u002F\u002Fgithub.com\u002Faws-powertools\u002Fpowertools-lambda-java","Powertools for AWS Lambda (Java)","github",{"link":157,"type":123,"text":158},"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":163,"order":7,"authors":164,"youtubeVideoID":165,"callout":166,"resources":170,"time":44,"path":173,"id":174,"link":175},"Lambda Power tuning ",[149,25],"z8wGSykEauI",{"title":167,"description":168,"link":169},"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",[171,172],{"link":101,"text":102,"type":103},{"link":105,"type":103,"text":106},"powertuning","powertuning.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fpowertuning",{"title":177,"order":7,"authors":178,"resources":179,"time":33,"path":183,"id":184,"link":185},"Using Graviton2",[25],[180],{"link":181,"text":182,"type":123},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fmigrating-aws-lambda-functions-to-arm-based-aws-graviton2-processors\u002F","Using Arm-based Graviton2 processors","graviton","graviton.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fgraviton",{"title":187,"collapsible":18,"isCollapsed":19,"content":188},"Java frameworks",[189,204,213,229],{"title":190,"order":191,"authors":192,"resources":193,"time":33,"path":201,"id":202,"link":203},"Micronaut",7,[149,25],[194,198],{"link":195,"text":196,"type":197},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-java-frameworks-samples\u002Ftree\u002Fmain","Serverless Java Frameworks","GitHub",{"link":199,"text":200,"type":197},"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":205,"order":191,"authors":206,"resources":207,"time":33,"path":210,"id":211,"link":212},"Quarkus",[149,25],[208],{"link":195,"text":209,"type":197},"Quarkus sample application","quarkus","quarkus.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fquarkus",{"title":214,"order":191,"authors":215,"resources":216,"time":107,"path":226,"id":227,"link":228},"Spring",[149,59],[217,218,222],{"link":195,"text":209,"type":197},{"link":219,"text":220,"type":221},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US","Java on AWS Lambda","workshop",{"link":223,"text":224,"type":225},"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":230,"order":191,"authors":231,"resources":232,"time":33,"path":236,"id":237,"link":238},"GraalVM Native Image",[149,25],[233,235],{"link":195,"text":234,"type":197},"GraalVM sample application",{"link":219,"text":220,"type":221},"graalvm","graalvm.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fgraalvm",{"title":240,"collapsible":18,"isCollapsed":19,"content":241},"Testing a Java application",[242,259,268,278,287],{"title":243,"order":244,"authors":245,"callout":247,"resources":251,"time":255,"path":256,"id":257,"link":258},"Testing Serverless",8,[246],"Lorenzo Micheli",{"title":248,"description":249,"link":250},"Read the Serverless testing guide","This guide dives deeper into Serverless testing","https:\u002F\u002Fserverlessland.com\u002Ftesting",[252],{"link":253,"text":254,"type":197},"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":260,"order":244,"authors":261,"callout":262,"resources":263,"time":107,"path":265,"id":266,"link":267},"Unit Testing",[246],{"title":248,"description":249,"link":250},[264],{"link":253,"text":254,"type":197},"unit","unit.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Funit",{"title":269,"order":244,"authors":270,"callout":271,"resources":272,"time":274,"path":275,"id":276,"link":277},"Integration Testing",[246,25],{"title":248,"description":249,"link":250},[273],{"link":253,"text":254,"type":197},"5 min","integration","integration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintegration",{"title":279,"order":244,"authors":280,"callout":281,"resources":282,"time":255,"path":284,"id":285,"link":286},"Functional Testing",[246,25],{"title":248,"description":249,"link":250},[283],{"link":253,"text":254,"type":197},"functional","functional.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ffunctional",{"title":288,"order":244,"authors":289,"callout":290,"resources":291,"time":33,"path":293,"id":294,"link":295},"Load Testing",[25],{"title":248,"description":249,"link":250},[292],{"link":253,"text":254,"type":197},"load","load.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fload",{"title":297,"collapsible":18,"isCollapsed":19,"content":298},"Local Development",[299,306],{"title":300,"order":301,"authors":302,"time":44,"path":303,"id":304,"link":305},"IntelliJ",10,[25],"intellij","intellij.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintellij",{"title":307,"order":301,"authors":308,"time":44,"path":309,"id":310,"link":311},"Visual Studio Code",[25],"vscode","vscode.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fvscode",{"title":313,"collapsible":18,"isCollapsed":19,"content":314},"Infrastructure as Code",[315,322,328,338],{"title":316,"order":317,"authors":318,"time":33,"path":319,"id":320,"link":321},"CloudFormation",9,[97],"cloudformation","cloudformation.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcloudformation",{"title":323,"order":317,"authors":324,"time":274,"path":325,"id":326,"link":327},"AWS CDK",[97],"cdk","cdk.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcdk",{"title":329,"order":317,"authors":330,"resources":331,"time":33,"path":335,"id":336,"link":337},"AWS SAM",[97],[332],{"link":333,"text":334,"type":123},"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":339,"order":317,"authors":340,"resources":341,"time":33,"path":348,"id":349,"link":350},"Terraform",[25],[342,345],{"link":343,"type":197,"text":344},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-lambda-snapstart-terraform","Java sample with Terraform",{"link":346,"text":347,"type":103},"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":352,"collapsible":18,"isCollapsed":19,"content":353},"Benchmarking",[354],{"title":355,"order":356,"youtubeVideoID":357,"authors":358,"resources":359,"time":44,"path":370,"id":371,"link":372},"Performance Benchmarking",11,"wmEIMWigXGc",[25],[360,362,364,367],{"link":361,"text":220,"type":221},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration\u002F02-optimizations\u002Fbenchmark",{"link":195,"text":363,"type":197},"Benchmark: Micronaut, Quarkus, and SpringBoot",{"link":365,"text":366,"type":197},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-graalvm-demo","GraalVM native image on AWS Lambda Benchmarking",{"link":368,"text":369,"type":197},"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":374,"collapsible":18,"isCollapsed":19,"content":375},"Migration",[376],{"title":377,"order":378,"authors":379,"youtubeVideoID":380,"resources":381,"time":44,"path":388,"id":389,"link":390},"Migration Guide",12,[25],"u3tgOE8qFjI",[382,386],{"link":383,"text":384,"type":385},"https:\u002F\u002Fserverlessland.com\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fintroduction","Java re-platforming guide","Guide",{"link":219,"text":220,"type":387},"Workshop","migration","migration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fmigration","LIST",[393,394,395,396,397,398],"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",1792578874137]