Reputation: 701
I have been testing Quarkus, to check if it's worth the replacing cost, when running an empty Quarkus project with only resteasy
and jsonb
, the RAM usage is of just 5MB. But after adding only some entities from a big project, the project has grown to 100MB, which I find as an abusive usage, as in the Spring one, the full project is using 180MB.
Reproduction repository: https://github.com/KevinGuancheDarias/quarkus-owge-poo
running natively steps (requires docker
)
$ mvn package -Pnative -Dquarkus.native.container-build=true -DskipTests
$ docker build --no-cache -f src/main/docker/Dockerfile.native -t quarkus/test .
$ docker run -i --rm -p 8080:8080 quarkus/test
Command used to test the sizes
docker stats 2985d8366e51 32db5040f6e7
Sample output where owge_all_dockerized.... is the full project running in Docker and suspicious_borg is the quarkus test
Quarkus extensions: agroal, cdi, hibernate-orm, hibernate-orm-panache, jdbc-mysql, mutiny, narayana-jta, resteasy, resteasy-jsonb, smallrye-context-propagation
Is this the expected RAM usage?
Update: Removing only hibernate ORM
, but preserving agroal
and jdbc-mysql
, makes the memory go down to 6MB
Update: Please note, that both the quarkus test and the full project running in Spring boot are immediately started, and stopped, no time for GC to fill up the memory
Thanks in advance!.
Upvotes: 1
Views: 2874
Reputation: 3890
Native graalvm execution has a different kind of memory management than when running traditional Java/jar.
Details are to be found in the official docs but basically it will grow in memory more aggressively but you can limit it by adding -mx 10m
for example. Then it will not grow beyond 10 mb - which if is enough for your app will be fine.
Of course if your app actually needs more then increase it.
Upvotes: 1