Performance Optimization for Spring Boot Microservices: Adaptive Memory, Concurrency, and Resource Management

Main Article Content

Tathagata Roy

Abstract

Containerized Spring Boot microservices frequently encounter performance limitations arising from inefficient JVM memory allocation, blocking concurrency models, and suboptimal resource configuration. This paper presents a comprehensive analysis of optimization strategies for Java‑based microservices running on Spring Boot and Java 17, emphasizing adaptive memory management, thread‑pool tuning, and reactive resource handling. The study examines dynamic heap‑sizing techniques that align JVM memory parameters with container constraints to reduce garbage‑collection frequency and prevent allocation failures. Off‑heap memory approaches, including Netty and native allocation, are evaluated for their ability to lower heap pressure in high‑throughput I/O workloads. Concurrency optimization is addressed through queuing‑theory‑based sizing of fixed and cached thread pools to minimize contention and improve throughput in traditional blocking execution models. The analysis extends to data‑access layers, where reactive database connectivity (R2DBC) and dynamic connection‑pool tuning algorithms are applied to reduce thread waiting time and tail latency. Additional improvements include JPA query and pooling optimizations, Tomcat connector configuration, Spring Boot tuning practices, and Docker image refinements that reduce startup time and memory footprint. The combined evaluation provides a unified framework for enhancing responsiveness, scalability, and resource efficiency in cloud‑native Spring Boot microservices.

Article Details

How to Cite
Roy, T. (2023). Performance Optimization for Spring Boot Microservices: Adaptive Memory, Concurrency, and Resource Management. The Eastasouth Journal of Information System and Computer Science, 1(01), 231–240. https://doi.org/10.58812/esiscs.v1i01.1286
Section
Articles

References

[1] Oracle Corporation, “JDK 17 release notes,” Oracle Corporation. [Online]. Available: https://www.oracle.com/java/technologies/javase/17-relnotes.html

[2] S. Gehwolf, “Java 17: What’s new in OpenJDK’s container awareness,” Red Hat Developer. [Online]. Available: https://developers.redhat.com/articles/2022/04/19/java-17-whats-new-openjdks-container-awareness

[3] D. Detlefs, C. Flood, S. Heller, and T. Printezis, “Garbage-first garbage collection,” in Proceedings of the 4th International Symposium on Memory Management, in ISMM ’04. New York, NY, USA: Association for Computing Machinery, 2004, pp. 37–48. doi: 10.1145/1029873.1029879.

[4] Oracle Corporation, “Java HotSpot virtual machine garbage collection tuning guide, Java SE 17,” Oracle Corporation. [Online]. Available: https://docs.oracle.com/en/java/javase/17/gctuning/

[5] S. Gehwolf, “Understanding how the JVM uses Linux memory with container limits,” Red Hat Developer. [Online]. Available: https://developers.redhat.com/articles/2020/11/16/java-containers-memory-and-cpu-limits

[6] L. Kleinrock, Theory, volume 1, queueing systems. Wiley-interscience, 1975.

[7] VMware Inc, “Spring Boot reference documentation (Version 2.6.x),” VMware, Inc. [Online]. Available: https://docs.spring.io/spring-boot/docs/2.6.x/reference/html/

[8] B. Goetz, Java Concurrency in Practice. Addison-Wesley, 2006.

[9] J. D. C. Little and S. C. Graves, “Little’s Law,” in Building Intuition: Insights From Basic Operations Management Models and Principles, D. Chhajed and T. J. Lowe, Eds., Boston, MA: Springer US, 2008, pp. 81–100. doi: 10.1007/978-0-387-73699-0_5.

[10] J. F. C. Kingman, “The single server queue in heavy traffic,” Math. Proc. Cambridge Philos. Soc., vol. 57, no. 4, pp. 902–904, 1961, doi: 10.1017/S0305004100036094.

[11] Reactive Streams Initiative, “Reactive streams specification (Version 1.0.3),” Reactive Streams Initiative. [Online]. Available: https://www.reactive-streams.org/

[12] VMware Inc, “Spring Framework reference documentation: Web on reactive stack (Version 5.3.x),” VMware, Inc. [Online]. Available: https://docs.spring.io/spring-framework/docs/5.3.x/reference/html/web-reactive.html

[13] R2DBC Project Team, “Reactive relational database connectivity specification (Version 0.9.0),” R2DBC Project Team. [Online]. Available: https://r2dbc.io/spec/0.9.0.RELEASE/spec/html/

[14] The Kubernetes Authors, “Managing resources for containers,” Cloud Native Computing Foundation (CNCF). [Online]. Available: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/

[15] B. Haseman, “HikariCP: High-performance JDBC connection pool,” GitHub Repository. [Online]. Available: https://github.com/brettwooldridge/HikariCP

[16] OpenJDK Project, “Project Loom: Fibers and continuations for the Java platform,” Oracle Corporation. [Online]. Available: https://openjdk.org/projects/loom/

[17] Docker Inc, “Best practices for writing Dockerfiles,” Docker Inc. [Online]. Available: https://docs.docker.com/develop/dev-best-practices/

[18] Oracle Labs, “GraalVM Native Image reference documentation (Version 22.0),” Oracle Corporation. [Online]. Available: https://www.graalvm.org/22.0/reference-manual/native-image/

[19] OpenJDK Project, “Project Panama: Interconnecting JVM and native code,” Oracle Corporation. [Online]. Available: https://openjdk.org/projects/panama/

[20] OpenJDK Project, “JEP 377: ZGC: A scalable low-latency garbage collector (production),” Oracle Corporation. [Online]. Available: https://openjdk.org/jeps/377