[{"data":1,"prerenderedAt":399},["ShallowReactive",2],{"content-svc-lambda-guides-effectively-running-java-on-serverless-init-heavy-lifting":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":10,"menu":11,"menuType":390,"isCollapseableMenu":14,"nextDocItem":93,"previousDocItem":78,"contributorPaths":391,"contentName":398,"slug":92,"readingTime":39},"\u003Cp>On-demand Lambda functions use a full vCPU (non-throttled) but is limited to 10 seconds during its initialization phase. \nTherefore, objects that are expected \nto be reused across multiple invocations should move their respective initialization code to either a static initializer \nor constructor instead of creating them inside the Lambda handler method. Initializing them inside the Lambda handler \nmethod will create those resources on every Lambda invocation that unnecessarily adds up to the Lambda duration.\u003C\u002Fp>\n\u003Cp>For provisioned concurrency,\nthere is no cpu burst and goes directly to using proportional vCPU based on the memory allocation.\u003C\u002Fp>\n\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Finit_heavy_lifting.png\" alt=\"Init\">\u003C\u002Fp>\n\u003Cp>Also, when using the AWS SDK, pre-configure specific items during client initialization. \nFor example, region, the credential provider, and endpoint, if you know these values. Providing these values during \nclient creation saves time for the SDK to run additional code to figure out which region it is running currently, etc.\u003C\u002Fp>\n",{"title":6,"order":7,"authors":8},"Utilize initialization phase",6,[9],"Dhiraj Mahapatro","On-demand Lambda functions use a full vCPU (non-throttled) but is limited to 10 seconds during its initialization phase. \nTherefore, objects that are expected \nto be reused across multiple invocations should move their respective initialization code to either a static initializer \nor constructor instead of creating them inside the Lambda handler method. Initializing them inside the Lambda handler \nmethod will create those resources on every Lambda invocation that unnecessarily adds up to the Lambda duration.\n\nFor provisioned concurrency,\nthere is no cpu burst and goes directly to using proportional vCPU based on the memory allocation.\n\n![Init](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Finit_heavy_lifting.png)\n\nAlso, when using the AWS SDK, pre-configure specific items during client initialization. \nFor example, region, the credential provider, and endpoint, if you know these values. Providing these values during \nclient creation saves time for the SDK to run additional code to figure out which region it is running currently, etc.\n",[12,32,58,185,238,295,311,350,372],{"title":13,"collapsible":14,"isCollapsed":15,"content":16},"Introduction",false,true,[17],{"title":18,"order":19,"authors":20,"callout":21,"prerequisite":25,"time":28,"path":29,"id":30,"link":31},"Getting Started",1,[9],{"title":22,"description":23,"link":24},"Watch this video","This Devoxx Belgium 2023 presentation shows effectively running Java on Serverless","https:\u002F\u002Fyoutu.be\u002Fu3tgOE8qFjI?t=5549",[26,27],"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":33,"collapsible":14,"isCollapsed":15,"content":34},"History",[35,43,50],{"title":36,"order":37,"authors":38,"time":39,"path":40,"id":41,"link":42},"Evolution of Java",3,[9],"1 min","history","history.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fhistory",{"title":44,"order":45,"authors":46,"time":28,"path":47,"id":48,"link":49},"Evolution of Compute",4,[9],"compute","compute.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcompute",{"title":51,"order":52,"authors":53,"time":28,"path":55,"id":56,"link":57},"Challenges",5,[9,54],"Maximilian Schellhorn","challenge","challenge.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fchallenge",{"title":59,"collapsible":14,"isCollapsed":14,"content":60},"Best Practices",[61,78,88,93,110,127,145,161,175],{"title":62,"order":7,"youtubeVideoID":63,"authors":64,"callout":66,"resources":69,"time":74,"path":75,"id":76,"link":77},"Lambda Snapstart","ZbnAithBNYY",[65,9],"Vipan Kumar",{"title":22,"description":67,"link":68},"This serverless office hours session dives deeper into Lambda SnapStart.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=Y5b8_KToeDY",[70],{"link":71,"text":72,"type":73},"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":79,"order":7,"authors":80,"callout":81,"time":39,"path":85,"id":86,"link":87},"Tiered Compilation",[65],{"title":82,"description":83,"link":84},"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":6,"order":7,"authors":89,"time":39,"path":90,"id":91,"link":92},[9],"init-heavy-lifting","init-heavy-lifting.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Finit-heavy-lifting",{"title":94,"order":7,"authors":95,"youtubeVideoID":97,"resources":98,"time":106,"path":107,"id":108,"link":109},"Using RDS Proxy",[96,9],"Sonali Jena","ZQOqmMn_8jw",[99,103],{"link":100,"text":101,"type":102},"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":104,"type":102,"text":105},"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":111,"order":7,"authors":112,"callout":113,"prerequisite":117,"resources":119,"time":28,"path":124,"id":125,"link":126},"Choice of HTTP Clients",[65,9],{"title":114,"description":115,"link":116},"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",[118],"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.",[120],{"link":121,"type":122,"text":123},"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":128,"order":7,"authors":129,"youtubeVideoID":130,"resources":131,"time":106,"path":142,"id":143,"link":144},"Hexagonal Architecture",[65],"kRFg6fkVChQ",[132,136,139],{"link":133,"text":134,"type":135},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fprescriptive-guidance\u002Flatest\u002Fhexagonal-architectures\u002Fwelcome.html","Hexagonal architecture","guidance",{"link":137,"text":138,"type":122},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fdeveloping-portable-aws-lambda-functions\u002F","Portable Lambda functions",{"link":140,"type":122,"text":141},"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":146,"order":7,"authors":147,"youtubeVideoID":149,"resources":150,"time":28,"path":158,"id":159,"link":160},"Powertools for AWS Lambda",[148],"Lavanya Tangutur","dH2GP6Lydj8",[151,155],{"link":152,"text":153,"type":154},"https:\u002F\u002Fgithub.com\u002Faws-powertools\u002Fpowertools-lambda-java","Powertools for AWS Lambda (Java)","github",{"link":156,"type":122,"text":157},"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":162,"order":7,"authors":163,"youtubeVideoID":164,"callout":165,"resources":169,"time":39,"path":172,"id":173,"link":174},"Lambda Power tuning ",[148,9],"z8wGSykEauI",{"title":166,"description":167,"link":168},"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",[170,171],{"link":100,"text":101,"type":102},{"link":104,"type":102,"text":105},"powertuning","powertuning.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fpowertuning",{"title":176,"order":7,"authors":177,"resources":178,"time":28,"path":182,"id":183,"link":184},"Using Graviton2",[9],[179],{"link":180,"text":181,"type":122},"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":186,"collapsible":14,"isCollapsed":15,"content":187},"Java frameworks",[188,203,212,228],{"title":189,"order":190,"authors":191,"resources":192,"time":28,"path":200,"id":201,"link":202},"Micronaut",7,[148,9],[193,197],{"link":194,"text":195,"type":196},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-java-frameworks-samples\u002Ftree\u002Fmain","Serverless Java Frameworks","GitHub",{"link":198,"text":199,"type":196},"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":204,"order":190,"authors":205,"resources":206,"time":28,"path":209,"id":210,"link":211},"Quarkus",[148,9],[207],{"link":194,"text":208,"type":196},"Quarkus sample application","quarkus","quarkus.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fquarkus",{"title":213,"order":190,"authors":214,"resources":215,"time":106,"path":225,"id":226,"link":227},"Spring",[148,54],[216,217,221],{"link":194,"text":208,"type":196},{"link":218,"text":219,"type":220},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US","Java on AWS Lambda","workshop",{"link":222,"text":223,"type":224},"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":229,"order":190,"authors":230,"resources":231,"time":28,"path":235,"id":236,"link":237},"GraalVM Native Image",[148,9],[232,234],{"link":194,"text":233,"type":196},"GraalVM sample application",{"link":218,"text":219,"type":220},"graalvm","graalvm.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fgraalvm",{"title":239,"collapsible":14,"isCollapsed":15,"content":240},"Testing a Java application",[241,258,267,277,286],{"title":242,"order":243,"authors":244,"callout":246,"resources":250,"time":254,"path":255,"id":256,"link":257},"Testing Serverless",8,[245],"Lorenzo Micheli",{"title":247,"description":248,"link":249},"Read the Serverless testing guide","This guide dives deeper into Serverless testing","https:\u002F\u002Fserverlessland.com\u002Ftesting",[251],{"link":252,"text":253,"type":196},"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":259,"order":243,"authors":260,"callout":261,"resources":262,"time":106,"path":264,"id":265,"link":266},"Unit Testing",[245],{"title":247,"description":248,"link":249},[263],{"link":252,"text":253,"type":196},"unit","unit.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Funit",{"title":268,"order":243,"authors":269,"callout":270,"resources":271,"time":273,"path":274,"id":275,"link":276},"Integration Testing",[245,9],{"title":247,"description":248,"link":249},[272],{"link":252,"text":253,"type":196},"5 min","integration","integration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintegration",{"title":278,"order":243,"authors":279,"callout":280,"resources":281,"time":254,"path":283,"id":284,"link":285},"Functional Testing",[245,9],{"title":247,"description":248,"link":249},[282],{"link":252,"text":253,"type":196},"functional","functional.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ffunctional",{"title":287,"order":243,"authors":288,"callout":289,"resources":290,"time":28,"path":292,"id":293,"link":294},"Load Testing",[9],{"title":247,"description":248,"link":249},[291],{"link":252,"text":253,"type":196},"load","load.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fload",{"title":296,"collapsible":14,"isCollapsed":15,"content":297},"Local Development",[298,305],{"title":299,"order":300,"authors":301,"time":39,"path":302,"id":303,"link":304},"IntelliJ",10,[9],"intellij","intellij.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintellij",{"title":306,"order":300,"authors":307,"time":39,"path":308,"id":309,"link":310},"Visual Studio Code",[9],"vscode","vscode.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fvscode",{"title":312,"collapsible":14,"isCollapsed":15,"content":313},"Infrastructure as Code",[314,321,327,337],{"title":315,"order":316,"authors":317,"time":28,"path":318,"id":319,"link":320},"CloudFormation",9,[96],"cloudformation","cloudformation.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcloudformation",{"title":322,"order":316,"authors":323,"time":273,"path":324,"id":325,"link":326},"AWS CDK",[96],"cdk","cdk.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcdk",{"title":328,"order":316,"authors":329,"resources":330,"time":28,"path":334,"id":335,"link":336},"AWS SAM",[96],[331],{"link":332,"text":333,"type":122},"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":338,"order":316,"authors":339,"resources":340,"time":28,"path":347,"id":348,"link":349},"Terraform",[9],[341,344],{"link":342,"type":196,"text":343},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-lambda-snapstart-terraform","Java sample with Terraform",{"link":345,"text":346,"type":102},"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":351,"collapsible":14,"isCollapsed":15,"content":352},"Benchmarking",[353],{"title":354,"order":355,"youtubeVideoID":356,"authors":357,"resources":358,"time":39,"path":369,"id":370,"link":371},"Performance Benchmarking",11,"wmEIMWigXGc",[9],[359,361,363,366],{"link":360,"text":219,"type":220},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration\u002F02-optimizations\u002Fbenchmark",{"link":194,"text":362,"type":196},"Benchmark: Micronaut, Quarkus, and SpringBoot",{"link":364,"text":365,"type":196},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-graalvm-demo","GraalVM native image on AWS Lambda Benchmarking",{"link":367,"text":368,"type":196},"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":373,"collapsible":14,"isCollapsed":15,"content":374},"Migration",[375],{"title":376,"order":377,"authors":378,"youtubeVideoID":379,"resources":380,"time":39,"path":387,"id":388,"link":389},"Migration Guide",12,[9],"u3tgOE8qFjI",[381,385],{"link":382,"text":383,"type":384},"https:\u002F\u002Fserverlessland.com\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fintroduction","Java re-platforming guide","Guide",{"link":218,"text":219,"type":386},"Workshop","migration","migration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fmigration","LIST",[392,393,394,395,396,397],"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",1788863716941]