[{"data":1,"prerenderedAt":399},["ShallowReactive",2],{"content-svc-lambda-guides-effectively-running-java-on-serverless-compute":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":10,"menu":11,"menuType":390,"isCollapseableMenu":14,"nextDocItem":48,"previousDocItem":35,"contributorPaths":391,"contentName":398,"slug":47,"readingTime":28},"\u003Cp>\u003Cimg src=\"\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Fcompute.jpg\" alt=\"Compute\">\u003C\u002Fp>\n\u003Cp>While Java was evolving at its own pace, compute has also evolved dramatically.\nIn previous years, it took a long time to actually focus on the business logic that addresses the customer&#39;s \nrequirements.\nFor example, initially we had to procure bare metal servers, provision them, and ultimately\nstart prototyping and building applications.\nThe level of abstraction was very low; however, the focus on business logic\ncame way later in the magnitude of months, if not in years.\nThat changed when we moved to Virtual Machines (VM).\nVMs provided some level of abstraction while running in production.\nBut the development environment was still not in parity with VMs.\nThen came Containers which provided a great level of abstraction \nwhere developers can focus on building business logic sooner than with other compute abstractions.\u003C\u002Fp>\n\u003Cp>In 2016, AWS introduced Lambda functions as a Serverless option. There are still servers involved, but AWS owned the \nheavy lifting of maintaining those servers for you so that you focus on just writing business logic, thus the highest \nlevel of abstraction and developers focus on directly writing and deploying business logic as Lambda functions.\u003C\u002Fp>\n\u003Cp>Today AWS Lambda runs on \u003Ca href=\"https:\u002F\u002Ffirecracker-microvm.github.io\u002F\">Firecracker microVM\u003C\u002Fa> and provides:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>Continuous scaling\u003C\u002Fli>\n\u003Cli>Built-in fault tolerance\u003C\u002Fli>\n\u003Cli>Pay per use\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>However, for Java, \nthere are challenges that AWS Lambda had to deal with because of the way Java was built from the ground up\nand the way AWS Lambda works.\nLet&#39;s understand those challenges.\u003C\u002Fp>\n",{"title":6,"order":7,"authors":8},"Evolution of Compute",4,[9],"Dhiraj Mahapatro","![Compute](\u002Fassets\u002Fexternal\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fassets\u002Fcompute.jpg)\n\nWhile Java was evolving at its own pace, compute has also evolved dramatically.\nIn previous years, it took a long time to actually focus on the business logic that addresses the customer's \nrequirements.\nFor example, initially we had to procure bare metal servers, provision them, and ultimately\nstart prototyping and building applications.\nThe level of abstraction was very low; however, the focus on business logic\ncame way later in the magnitude of months, if not in years.\nThat changed when we moved to Virtual Machines (VM).\nVMs provided some level of abstraction while running in production.\nBut the development environment was still not in parity with VMs.\nThen came Containers which provided a great level of abstraction \nwhere developers can focus on building business logic sooner than with other compute abstractions.\n\nIn 2016, AWS introduced Lambda functions as a Serverless option. There are still servers involved, but AWS owned the \nheavy lifting of maintaining those servers for you so that you focus on just writing business logic, thus the highest \nlevel of abstraction and developers focus on directly writing and deploying business logic as Lambda functions.\n\nToday AWS Lambda runs on [Firecracker microVM](https:\u002F\u002Ffirecracker-microvm.github.io\u002F) and provides:\n\n- Continuous scaling\n- Built-in fault tolerance\n- Pay per use\n\nHowever, for Java, \nthere are challenges that AWS Lambda had to deal with because of the way Java was built from the ground up\nand the way AWS Lambda works.\nLet's understand those challenges.\n",[12,32,56,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":14,"content":34},"History",[35,43,48],{"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":6,"order":7,"authors":44,"time":28,"path":45,"id":46,"link":47},[9],"compute","compute.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcompute",{"title":49,"order":50,"authors":51,"time":28,"path":53,"id":54,"link":55},"Challenges",5,[9,52],"Maximilian Schellhorn","challenge","challenge.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fchallenge",{"title":57,"collapsible":14,"isCollapsed":15,"content":58},"Best Practices",[59,77,87,93,110,127,145,161,175],{"title":60,"order":61,"youtubeVideoID":62,"authors":63,"callout":65,"resources":68,"time":73,"path":74,"id":75,"link":76},"Lambda Snapstart",6,"ZbnAithBNYY",[64,9],"Vipan Kumar",{"title":22,"description":66,"link":67},"This serverless office hours session dives deeper into Lambda SnapStart.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=Y5b8_KToeDY",[69],{"link":70,"text":71,"type":72},"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":78,"order":61,"authors":79,"callout":80,"time":39,"path":84,"id":85,"link":86},"Tiered Compilation",[64],{"title":81,"description":82,"link":83},"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":88,"order":61,"authors":89,"time":39,"path":90,"id":91,"link":92},"Utilize initialization phase",[9],"init-heavy-lifting","init-heavy-lifting.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Finit-heavy-lifting",{"title":94,"order":61,"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":61,"authors":112,"callout":113,"prerequisite":117,"resources":119,"time":28,"path":124,"id":125,"link":126},"Choice of HTTP Clients",[64,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":61,"authors":129,"youtubeVideoID":130,"resources":131,"time":106,"path":142,"id":143,"link":144},"Hexagonal Architecture",[64],"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":61,"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":61,"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":61,"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,52],[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",1792578873397]