OOM in Docker with Spring Boot + H2 + JPA and Batch Processing OOM in Docker with Spring Boot + H2 + JPA and Batch Processing docker docker

OOM in Docker with Spring Boot + H2 + JPA and Batch Processing


The most likely cause is that you are not calling commit(), which means that old versions of the data never get flushed


Update: Cause was not in H2 or JPA but in a bad docker-compose configuration. We did allocate same amount of memory for JVM running inside container (-Xmx$MEMORY_MAX) as well as for docker itself (mem_limit).

After setting MEMORY_MAX for JVM to a maximum of 80% of mem_limit everything worked fine.