This paper is available on arxiv under CC BY-SA 4.0 DEED license.
Authors:
(1) Juan Mera Men´endez;
(2) Martin Bartlett.
Performance is an aspect that should always be taken into account when creating Lambda functions, especially if you plan to combine them with Java. Once the performance improvements offered by these approaches for using Java with AWS Lambda have been quantified. It is evident that Java can be used competitively with AWS Lambda without the need to resort to runtimes like Node.js or Python (which usually report better performance).
Having tested various combinations of proposed strategies and demonstrated that the performance is similar to what can be achieved with the use of GraalVM, we recommend avoiding its usage. We consider it essential to profile the Java functions to select the optimal memory configuration and using AWS SDK v2. From there, optionally, the next step is to the rest of the techniques to achieve one of the proposed combinations. Additionally, following the general best practices such as initializing connections outside the handler or reduce the bundle size, among others, also contribute to optimizing Java functions.
The optimization strategies we propose are not the only ones available, there are many other techniques that can similarly yield excellent results.
It is important to highlight that the process of optimizing a function is linear in terms of difficulty. In other words, it’s relatively easy to obtain a significant improvement, but if you want to squeeze out the maximum performance, the process requires trial and error and greater effort. It’s also important to highlight that the percentage of improvement offered by each approach depends on the specific use case in which they are applied. This percentage can vary, either increasing or decreasing.
[1] H. Puripunpinyo and M. Samadzadeh, “Effect of optimizing java deployment artifacts on aws lambda,” in 2017 IEEE Conference on Computer Communications Workshops (INFOCOMWKSHPS), 2017, pp. 438–443. DOI: 10.1109/INFCOMW.2017.8116416.
[2] D. Bardsley, L. Ryan, and J. Howard, “Serverless performance and optimization strategies,” in 2018 IEEE International Conference on Smart Cloud (SmartCloud), 2018, pp. 19–26. DOI: 10.1109/SmartCloud.2018.00012.
[3] D. Jackson and G. Clynch, “An investigation of the impact of language runtime on the
performance and cost of serverless functions,” in 2018 IEEE/ACM International Conference
on Utility and Cloud Computing Companion (UCC Companion), 2018, pp. 154–160. DOI: 10.1109/UCC-Companion.2018.00050.
[4] O. Hosseini Mehrshad Sahragard, “Aws lambda language performance,” 2019. [Online]. Available: https://gupea.ub.gu.se/handle/2077/62454.
[5] A. L. Dowd, “Performance of java in function-as-a-service computing,” University of Texas Libraries, 2020. [Online]. Available: https://repositories.lib.utexas.edu/handle/2152/84357.
[6] S. O’Toole, “Aws lambda java tutorial: Reducing cold starts,” 2020. [Online]. Available: https://www.capitalone.com/tech/cloud/aws-lambda-java-tutorial-reduce-cold-starts/v=1694091771423.
[7] D. Quaresma, D. Fireman, and T. E. Pereira, “Controlling garbage collection and request admission to improve performance of faas applications,” in 2020 IEEE 32nd International Symposium on Computer Architecture and High Performance Computing (SBAC-PAD), 2020, pp. 175–182. DOI: 10.1109/SBAC-PAD49847.2020.00033.
[8] M. Sipek, D. Muharemagi´c, B. Mihaljevi´c, and ˇ A. Radovan, “Enhancing performance of cloudbased software applications with graalvm and quarkus,” in 2020 43rd International Convention on Information, Communication and Electronic Technology (MIPRO), 2020, pp. 1746–1751. DOI: 10.23919/MIPRO48935.2020.9245290.
[9] Q. I. S. Hassan B. Hassan Saman A. Barakat, “Survey on serverless computing,” Journal of Cloud Computing, 2021.
[10] C. D. Ron Mosquera Bryan Alexander y Villegas Armijos, “Mejora del rendimiento de aplicaciones serverless basadas en la nube con graalvm y quarkus,” 2022.
[11] StackOverflow, “Developer survey 2022,” 2022. [Online]. Available: https://survey.stackoverflow.co/2022/.
[12] Q. Wu and L. K. John, “Performance of java in function-as-a-service computing,” in 2022 IEEE/ACM 15th International Conference on Utility and Cloud Computing (UCC), 2022, pp. 261– 266. DOI: 10.1109/UCC56403.2022.00047.
[13] Datdog, “The state of serverless,” datadog, 2023. [Online]. Available: https://www.datadoghq.com/state-of-serverless/.
[14] AWS, “Best practices to work with aws lambda functions,” [Online]. Available: https://docs.aws.amazon.com/es es/lambda/latest/dg/best-practices.html.
[15] AWS, “Developer guide - aws sdk for java 2.x,” [Online]. Available: https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/home.html.
[16] AWS, “Improving startup performance with lambda snapstart,” [Online]. Available: https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html.
[17] AWS, “Java lambda functions customization settings,” [Online]. Available: https://docs.aws.amazon.com/lambda/latest/dg/java-customization.html.
[18] AWS, “Lambda instruction set architectures (arm/x86),” [Online]. Available: https://docs.aws.amazon.com/es es/lambda/latest/dg/foundation-arch.html.
[19] AWS, “Profiling functions with aws lambda power tuning,” [Online]. Available: https://docs.aws.amazon.com/lambda/latest/operatorguide/p
[20] G. org, “Graalvm overview,” [Online]. Available: https://www.graalvm.org/latest/docs/introduction/.
[21] A. Stefano Buliani, “Best practices for aws lambda and java,” [Online]. Available: https://d1.awsstatic.com/events/reinvent/2019/REPEAT 1 B