Upgrade to Pro — share decks privately, control downloads, hide ads and more …

J-Fall 2022: Ten performance improvements for y...

J-Fall 2022: Ten performance improvements for your Java based AWS Lambda functions

More and more enterprise organizations are moving toward the Cloud or want to adopt a more cloud-native operating model. Adopting serverless compute services like AWS Lambda is high on developers' wish lists.
Most of these organizations use Java for their existing applications, but Java is known for its high cold start times and high memory footprint in Serverless environments. Because of this, some developers switch to a different programming language when working with AWS Lambda, but you don't always have to do that. In this talk, I will share some of the lessons I learned that will help improve the performance of these Java-based Lambda functions.

After this talk, you should have some inspiration to squeeze even more performance out of your existing Java based serverless functions.

Jeroen Reijn

November 04, 2022
Tweet

More Decks by Jeroen Reijn

Other Decks in Technology

Transcript

  1. Foto: Annette Bernhardt (CC BY-SA 2.0) My name is Jeroen

    Reijn #Luminis #Java #AWS #Serverless | @jreijn
  2. Foto: Annette Bernhardt (CC BY-SA 2.0) Java = Slow? 🤔

    Photo by Razvan Cristea on Unsplash
  3. Foto: Annette Bernhardt (CC BY-SA 2.0) 1. More memory 


    = 
 More vCPUs Photo by Christian Wiediger on Unsplash
  4. Tiered compilation Interpreter C1: No pro fi ling C1: Limited

    Pro fi ling C1: Full Pro fi ling C2 0 1 2 3 4 Compilation level Slower Faster
  5. Tiered compilation Settings Type # of invocations p90 (ms) p95

    (ms) p99 (ms) Default settings Cold start 754 5,212 5,338 5,517 Default settings Warm start 35,247 58 93 255 Tiered compilation stopping at level 1 Cold start 383 2,071 2,086 2,221 Tiered compilation stopping at level 1 Warm start 35,618 23 32 86 Source: https://aws.amazon.com/blogs/compute/increasing-performance-of-java-aws-lambda-functions-using-tiered-compilation/
  6. Tiered compilation Settings Type # of invocations p90 (ms) p95

    (ms) p99 (ms) Default settings Cold start 754 5,212 5,338 5,517 Default settings Warm start 35,247 58 93 255 Tiered compilation stopping at level 1 Cold start 383 2,071 2,086 2,221 Tiered compilation stopping at level 1 Warm start 35,618 23 32 86 Source: https://aws.amazon.com/blogs/compute/increasing-performance-of-java-aws-lambda-functions-using-tiered-compilation/
  7. Tiered compilation Settings Type # of invocations p90 (ms) p95

    (ms) p99 (ms) Default settings Cold start 754 5,212 5,338 5,517 Default settings Warm start 35,247 58 93 255 Tiered compilation stopping at level 1 Cold start 383 2,071 2,086 2,221 Tiered compilation stopping at level 1 Warm start 35,618 23 32 86 Source: https://aws.amazon.com/blogs/compute/increasing-performance-of-java-aws-lambda-functions-using-tiered-compilation/
  8. Concurrency As demand increases, the Lambda service increases concurrent executions

    • One function instance handles one request • Concurrency is a measure of concurrent executions
  9. Foto: Annette Bernhardt (CC BY-SA 2.0) 10. GraalVM 
 AOT

    Native Image Photo by Patti Black on Unsplash
  10. Coordinated Restore at Checkpoint- CRAC • Creates a checkpoint (make

    an image of, snapshot) a Java instance while it is executing and then restores the state of the JVM from this snapshot • Part of OpenJDK • Experimental • Micronaut recently added support
  11. Foto: Annette Bernhardt (CC BY-SA 2.0) 13. Switch to ARM

    Photo by Christian Wiediger on Unsplash
  12. Foto: Annette Bernhardt (CC BY-SA 2.0) 14. Be careful with

    layers Photo by Clark Van Der Beken on Unsplash
  13. Thanks for your attention Please rate my session in the

    J-Fall app # jfall. Reach out at @jreijn