[{"data":1,"prerenderedAt":402},["ShallowReactive",2],{"content-svc-lambda-guides-effectively-running-java-on-serverless-powertools":3},{"markdown":4,"frontMatterAttributes":5,"bodyRaw":20,"menu":21,"menuType":393,"isCollapseableMenu":24,"nextDocItem":164,"previousDocItem":138,"contributorPaths":394,"contentName":401,"slug":163,"readingTime":39},"\u003Cp>\u003Ca href=\"https:\u002F\u002Fdocs.powertools.aws.dev\u002Flambda\u002Fjava\u002F\">AWS Lambda Powertools for Java\u003C\u002Fa> is an open-source library to help discover \nand incorporate serverless best practices early and quickly.\nIt is a suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging, \nand creating custom metrics asynchronously easier.\u003C\u002Fp>\n\u003Ch4>Logging\u003C\u002Fh4>\n\u003Cul>\n\u003Cli>Captures key fields from Lambda context, cold start, and structures logging output as JSON.\u003C\u002Fli>\n\u003Cli>Log Lambda event when instructed, disabled by default, can be enabled explicitly via annotation param.\u003C\u002Fli>\n\u003Cli>Appends additional keys to structured log at any point in time.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch4>Tracing\u003C\u002Fh4>\n\u003Cul>\n\u003Cli>Powertools tracing is an opinionated thin wrapper for AWS X-Ray Java SDK and provides functionality to reduce the \noverhead of performing common tracing tasks.\u003C\u002Fli>\n\u003Cli>Captures cold start as annotation, and responses as well as full exceptions as metadata.\u003C\u002Fli>\n\u003Cli>Helper methods to improve the developer experience of creating new X-Ray subsegments.\u003C\u002Fli>\n\u003Cli>Better developer experience when developing with multiple threads.\u003C\u002Fli>\n\u003Cli>Auto patch supported modules by AWS X-Ray.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch4>Metrics\u003C\u002Fh4>\n\u003Cul>\n\u003Cli>Aggregates up to 100 metrics using a single CloudWatch EMF object (large JSON blob).\u003C\u002Fli>\n\u003Cli>Validates against common metric definitions mistakes (metric unit, values, max dimensions, max metrics, etc).\u003C\u002Fli>\n\u003Cli>Metrics are created asynchronously by the CloudWatch service, no custom stacks needed.\u003C\u002Fli>\n\u003Cli>Context manager to create a one-off metric with a different dimension.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch4>Extra utilities\u003C\u002Fh4>\n\u003Cul>\n\u003Cli>Idempotency – allows safe retries for your function\u003C\u002Fli>\n\u003Cli>Parameters – retrieves values from Parameter Store or Secrets Manager\u003C\u002Fli>\n\u003Cli>SQS large message handling – handles SQS messages with payloads in S3\u003C\u002Fli>\n\u003Cli>SQS batch processing – handles partial failures when processing SQS batches\u003C\u002Fli>\n\u003Cli>Validation – JSON schema validation for payloads\u003C\u002Fli>\n\u003Cli>Serialization utilities – manipulates JSON data in your functions\u003C\u002Fli>\n\u003C\u002Ful>\n",{"title":6,"order":7,"authors":8,"youtubeVideoID":10,"resources":11},"Powertools for AWS Lambda",6,[9],"Lavanya Tangutur","dH2GP6Lydj8",[12,16],{"link":13,"text":14,"type":15},"https:\u002F\u002Fgithub.com\u002Faws-powertools\u002Fpowertools-lambda-java","Powertools for AWS Lambda (Java)","github",{"link":17,"type":18,"text":19},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fopensource\u002Fsimplifying-serverless-best-practices-with-aws-lambda-powertools-java\u002F","blog","Best practices with Powertools","[AWS Lambda Powertools for Java](https:\u002F\u002Fdocs.powertools.aws.dev\u002Flambda\u002Fjava\u002F) is an open-source library to help discover \nand incorporate serverless best practices early and quickly.\nIt is a suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging, \nand creating custom metrics asynchronously easier.\n\n#### Logging\n\n- Captures key fields from Lambda context, cold start, and structures logging output as JSON.\n- Log Lambda event when instructed, disabled by default, can be enabled explicitly via annotation param.\n- Appends additional keys to structured log at any point in time.\n\n#### Tracing\n- Powertools tracing is an opinionated thin wrapper for AWS X-Ray Java SDK and provides functionality to reduce the \n  overhead of performing common tracing tasks.\n- Captures cold start as annotation, and responses as well as full exceptions as metadata.\n- Helper methods to improve the developer experience of creating new X-Ray subsegments.\n- Better developer experience when developing with multiple threads.\n- Auto patch supported modules by AWS X-Ray.\n\n#### Metrics\n- Aggregates up to 100 metrics using a single CloudWatch EMF object (large JSON blob).\n- Validates against common metric definitions mistakes (metric unit, values, max dimensions, max metrics, etc).\n- Metrics are created asynchronously by the CloudWatch service, no custom stacks needed.\n- Context manager to create a one-off metric with a different dimension.\n\n#### Extra utilities\n- Idempotency – allows safe retries for your function\n- Parameters – retrieves values from Parameter Store or Secrets Manager\n- SQS large message handling – handles SQS messages with payloads in S3\n- SQS batch processing – handles partial failures when processing SQS batches\n- Validation – JSON schema validation for payloads\n- Serialization utilities – manipulates JSON data in your functions\n",[22,43,69,188,241,298,314,353,375],{"title":23,"collapsible":24,"isCollapsed":25,"content":26},"Introduction",false,true,[27],{"title":28,"order":29,"authors":30,"callout":32,"prerequisite":36,"time":39,"path":40,"id":41,"link":42},"Getting Started",1,[31],"Dhiraj Mahapatro",{"title":33,"description":34,"link":35},"Watch this video","This Devoxx Belgium 2023 presentation shows effectively running Java on Serverless","https:\u002F\u002Fyoutu.be\u002Fu3tgOE8qFjI?t=5549",[37,38],"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":44,"collapsible":24,"isCollapsed":25,"content":45},"History",[46,54,61],{"title":47,"order":48,"authors":49,"time":50,"path":51,"id":52,"link":53},"Evolution of Java",3,[31],"1 min","history","history.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fhistory",{"title":55,"order":56,"authors":57,"time":39,"path":58,"id":59,"link":60},"Evolution of Compute",4,[31],"compute","compute.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcompute",{"title":62,"order":63,"authors":64,"time":39,"path":66,"id":67,"link":68},"Challenges",5,[31,65],"Maximilian Schellhorn","challenge","challenge.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fchallenge",{"title":70,"collapsible":24,"isCollapsed":24,"content":71},"Best Practices",[72,89,99,105,122,138,156,164,178],{"title":73,"order":7,"youtubeVideoID":74,"authors":75,"callout":77,"resources":80,"time":85,"path":86,"id":87,"link":88},"Lambda Snapstart","ZbnAithBNYY",[76,31],"Vipan Kumar",{"title":33,"description":78,"link":79},"This serverless office hours session dives deeper into Lambda SnapStart.","https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=Y5b8_KToeDY",[81],{"link":82,"text":83,"type":84},"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":90,"order":7,"authors":91,"callout":92,"time":50,"path":96,"id":97,"link":98},"Tiered Compilation",[76],{"title":93,"description":94,"link":95},"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":100,"order":7,"authors":101,"time":50,"path":102,"id":103,"link":104},"Utilize initialization phase",[31],"init-heavy-lifting","init-heavy-lifting.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Finit-heavy-lifting",{"title":106,"order":7,"authors":107,"youtubeVideoID":109,"resources":110,"time":118,"path":119,"id":120,"link":121},"Using RDS Proxy",[108,31],"Sonali Jena","ZQOqmMn_8jw",[111,115],{"link":112,"text":113,"type":114},"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":116,"type":114,"text":117},"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":123,"order":7,"authors":124,"callout":125,"prerequisite":129,"resources":131,"time":39,"path":135,"id":136,"link":137},"Choice of HTTP Clients",[76,31],{"title":126,"description":127,"link":128},"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",[130],"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.",[132],{"link":133,"type":18,"text":134},"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":139,"order":7,"authors":140,"youtubeVideoID":141,"resources":142,"time":118,"path":153,"id":154,"link":155},"Hexagonal Architecture",[76],"kRFg6fkVChQ",[143,147,150],{"link":144,"text":145,"type":146},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fprescriptive-guidance\u002Flatest\u002Fhexagonal-architectures\u002Fwelcome.html","Hexagonal architecture","guidance",{"link":148,"text":149,"type":18},"https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fcompute\u002Fdeveloping-portable-aws-lambda-functions\u002F","Portable Lambda functions",{"link":151,"type":18,"text":152},"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":6,"order":7,"authors":157,"youtubeVideoID":10,"resources":158,"time":39,"path":161,"id":162,"link":163},[9],[159,160],{"link":13,"text":14,"type":15},{"link":17,"type":18,"text":19},"powertools","powertools.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fpowertools",{"title":165,"order":7,"authors":166,"youtubeVideoID":167,"callout":168,"resources":172,"time":50,"path":175,"id":176,"link":177},"Lambda Power tuning ",[9,31],"z8wGSykEauI",{"title":169,"description":170,"link":171},"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",[173,174],{"link":112,"text":113,"type":114},{"link":116,"type":114,"text":117},"powertuning","powertuning.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fpowertuning",{"title":179,"order":7,"authors":180,"resources":181,"time":39,"path":185,"id":186,"link":187},"Using Graviton2",[31],[182],{"link":183,"text":184,"type":18},"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":189,"collapsible":24,"isCollapsed":25,"content":190},"Java frameworks",[191,206,215,231],{"title":192,"order":193,"authors":194,"resources":195,"time":39,"path":203,"id":204,"link":205},"Micronaut",7,[9,31],[196,200],{"link":197,"text":198,"type":199},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-java-frameworks-samples\u002Ftree\u002Fmain","Serverless Java Frameworks","GitHub",{"link":201,"text":202,"type":199},"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":207,"order":193,"authors":208,"resources":209,"time":39,"path":212,"id":213,"link":214},"Quarkus",[9,31],[210],{"link":197,"text":211,"type":199},"Quarkus sample application","quarkus","quarkus.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fquarkus",{"title":216,"order":193,"authors":217,"resources":218,"time":118,"path":228,"id":229,"link":230},"Spring",[9,65],[219,220,224],{"link":197,"text":211,"type":199},{"link":221,"text":222,"type":223},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US","Java on AWS Lambda","workshop",{"link":225,"text":226,"type":227},"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":232,"order":193,"authors":233,"resources":234,"time":39,"path":238,"id":239,"link":240},"GraalVM Native Image",[9,31],[235,237],{"link":197,"text":236,"type":199},"GraalVM sample application",{"link":221,"text":222,"type":223},"graalvm","graalvm.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fgraalvm",{"title":242,"collapsible":24,"isCollapsed":25,"content":243},"Testing a Java application",[244,261,270,280,289],{"title":245,"order":246,"authors":247,"callout":249,"resources":253,"time":257,"path":258,"id":259,"link":260},"Testing Serverless",8,[248],"Lorenzo Micheli",{"title":250,"description":251,"link":252},"Read the Serverless testing guide","This guide dives deeper into Serverless testing","https:\u002F\u002Fserverlessland.com\u002Ftesting",[254],{"link":255,"text":256,"type":199},"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":262,"order":246,"authors":263,"callout":264,"resources":265,"time":118,"path":267,"id":268,"link":269},"Unit Testing",[248],{"title":250,"description":251,"link":252},[266],{"link":255,"text":256,"type":199},"unit","unit.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Funit",{"title":271,"order":246,"authors":272,"callout":273,"resources":274,"time":276,"path":277,"id":278,"link":279},"Integration Testing",[248,31],{"title":250,"description":251,"link":252},[275],{"link":255,"text":256,"type":199},"5 min","integration","integration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintegration",{"title":281,"order":246,"authors":282,"callout":283,"resources":284,"time":257,"path":286,"id":287,"link":288},"Functional Testing",[248,31],{"title":250,"description":251,"link":252},[285],{"link":255,"text":256,"type":199},"functional","functional.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Ffunctional",{"title":290,"order":246,"authors":291,"callout":292,"resources":293,"time":39,"path":295,"id":296,"link":297},"Load Testing",[31],{"title":250,"description":251,"link":252},[294],{"link":255,"text":256,"type":199},"load","load.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fload",{"title":299,"collapsible":24,"isCollapsed":25,"content":300},"Local Development",[301,308],{"title":302,"order":303,"authors":304,"time":50,"path":305,"id":306,"link":307},"IntelliJ",10,[31],"intellij","intellij.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fintellij",{"title":309,"order":303,"authors":310,"time":50,"path":311,"id":312,"link":313},"Visual Studio Code",[31],"vscode","vscode.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fvscode",{"title":315,"collapsible":24,"isCollapsed":25,"content":316},"Infrastructure as Code",[317,324,330,340],{"title":318,"order":319,"authors":320,"time":39,"path":321,"id":322,"link":323},"CloudFormation",9,[108],"cloudformation","cloudformation.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcloudformation",{"title":325,"order":319,"authors":326,"time":276,"path":327,"id":328,"link":329},"AWS CDK",[108],"cdk","cdk.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fcdk",{"title":331,"order":319,"authors":332,"resources":333,"time":39,"path":337,"id":338,"link":339},"AWS SAM",[108],[334],{"link":335,"text":336,"type":18},"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":341,"order":319,"authors":342,"resources":343,"time":39,"path":350,"id":351,"link":352},"Terraform",[31],[344,347],{"link":345,"type":199,"text":346},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-patterns\u002Ftree\u002Fmain\u002Fapigw-lambda-snapstart-terraform","Java sample with Terraform",{"link":348,"text":349,"type":114},"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":354,"collapsible":24,"isCollapsed":25,"content":355},"Benchmarking",[356],{"title":357,"order":358,"youtubeVideoID":359,"authors":360,"resources":361,"time":50,"path":372,"id":373,"link":374},"Performance Benchmarking",11,"wmEIMWigXGc",[31],[362,364,366,369],{"link":363,"text":222,"type":223},"https:\u002F\u002Fcatalog.workshops.aws\u002Fjava-on-aws-lambda\u002Fen-US\u002F01-migration\u002F02-optimizations\u002Fbenchmark",{"link":197,"text":365,"type":199},"Benchmark: Micronaut, Quarkus, and SpringBoot",{"link":367,"text":368,"type":199},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-graalvm-demo","GraalVM native image on AWS Lambda Benchmarking",{"link":370,"text":371,"type":199},"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":376,"collapsible":24,"isCollapsed":25,"content":377},"Migration",[378],{"title":379,"order":380,"authors":381,"youtubeVideoID":382,"resources":383,"time":50,"path":390,"id":391,"link":392},"Migration Guide",12,[31],"u3tgOE8qFjI",[384,388],{"link":385,"text":386,"type":387},"https:\u002F\u002Fserverlessland.com\u002Fcontent\u002Fservice\u002Flambda\u002Fpaved-path\u002Fjava-replatforming\u002Fintroduction","Java re-platforming guide","Guide",{"link":221,"text":222,"type":389},"Workshop","migration","migration.md","\u002Fcontent\u002Fservice\u002Flambda\u002Fguides\u002Feffectively-running-java-on-serverless\u002Fmigration","LIST",[395,396,397,398,399,400],"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",1792578873829]