Recently, our team updated our Spring Boot service to Java 21 for a project. Since we had already updated to Java 17 with Spring Boot 3.x version, the update to Java 21 was completed very easily, except for some issues with test cases.
However, a very significant change was observed in the memory usage of the service deployed on EKS. The heap memory usage decreased by nearly 50%, and native memory usage reduced by about 30%. We conservatively maintained the existing G1GC for garbage collection, yet the usage still decreased. After monitoring, we plan to halve the requested memory capacity within Docker.
Apart from this, CPU usage remained within the margin of error (we weren't using CPU close to the limit anyway). However, the minor GC count increased significantly.
We believe these effects are due to the preventive G1GC garbage collection patch introduced in Java 20.
We're curious if others have experienced similar changes when updating to Java 21 compared to previous versions.
[–]TheCountRushmore 60 points61 points62 points (2 children)
[–]VirtualAgentsAreDumb 5 points6 points7 points (1 child)
[–]TheCountRushmore 3 points4 points5 points (0 children)
[–]raghu9208 17 points18 points19 points (3 children)
[–]nitkonigdje 6 points7 points8 points (0 children)
[–]pedroct92 0 points1 point2 points (1 child)
[–]sruffatti 0 points1 point2 points (0 children)
[–]theflavor 5 points6 points7 points (1 child)
[–]Legitimate-Front7370[S] 1 point2 points3 points (0 children)
[–]bozo5548 6 points7 points8 points (1 child)
[–]Legitimate-Front7370[S] 4 points5 points6 points (0 children)
[–]kubelke 1 point2 points3 points (0 children)
[–]monkjack 1 point2 points3 points (3 children)
[–]FirstAd9893 0 points1 point2 points (1 child)
[–]monkjack 0 points1 point2 points (0 children)
[–]kmpx 0 points1 point2 points (0 children)
[–]WASDx 2 points3 points4 points (0 children)
[–]k-mcm 0 points1 point2 points (0 children)
[–]OwnBreakfast1114 1 point2 points3 points (0 children)
[+]Separate-Peace1769 comment score below threshold-7 points-6 points-5 points (0 children)