Yordan Borisov
Yordan Borisov

Reputation: 1652

Improve Spring-Boot startup in Docker

Approximately for standalone start as java process :

java -jar myspring_boot.jar

it takes around 20 seconds. But if I run it in a docker container which contain more micro services it takes around 3 minutes. Is there a way to speed up the spring-boot boot time as for an example if I enable debug longing I notice that there are a lot of unnecessary validations for different spring configurations. How I can speed up the spring-boot startup time only for dev purpose using Docker containers?

Upvotes: 2

Views: 4524

Answers (1)

Natalia C
Natalia C

Reputation: 354

I installed haveged daemon as it says in many answers out there, for example:

https://stackoverflow.com/a/39461346/2748325

And also added -XX:MaxMetaspaceSize=128m to my java CMD in the Dockerfile and the times went down in about 2 minutes.

Upvotes: 4

Related Questions