Are here any Gradle recommendations on Gradle settings that should be used during containerized builds to avoid frequent OutOfMemoryError: Container killed due to memory usage
problems?
We run our builds inside AWS ECS and set up hard (7500 Mb) and soft (5200 Mb) memory limits for the container openjdk:11.0.3-jdk
. Often the result of the build is the container killed by the AWS runtime because of violating the hard memory limit. As far as I know, JDK11 has -XX:+UseContainerSupport
flag enabled by default and should respect the container resource restrictions. Is it true for Gradle daemon and workers as well? Should I use any specific Gralde settings to hint the memory restrictions to the daemon and workers? Should I avoid using --parallel
in containerized environments? Should I give all the available underlying EC2 instance’s memory to the build container?
Overall, it would be very helpful to have an official guide on that matter. Thank you!