Memory measurement & reporting

46 views
Skip to first unread message

Brand Bintley

unread,
May 19, 2021, 7:16:12 AM5/19/21
to Quarkus Development mailing list
I am on Mac, running the getting started generated using maven command suggested here: https://quarkus.io/guides/getting-started

I build the app with: mvn clean package -Dquarkus.package.type=uber-jar

Next, I run the app with: java -jar target/getting-started-1.0.0-SNAPSHOT-runner.jar

To check memory usage, I do: ps x -o pid,rss,command -p $(pgrep -f runner)

The result: 

PID    RSS COMMAND

44256 379176 java -jar target/getting-started-1.0.0-SNAPSHOT-runner.jar


Is this RSS of 389MB expected? Or am I doing something wrong?


The RSS of the native is 20MB, which is what one would expect.


Loïc MATHIEU

unread,
May 19, 2021, 8:28:39 AM5/19/21
to brand....@gmail.com, Quarkus Development mailing list
Hi,

If you run your application on a laptop with plenty of memory and don't specify any memory settings, depending on your JVM and OS version, it can take a lot of memory by default.

To use the right amount of memory you should run it inside a container with memory settings or use java command options to limit the memory available to the JVM process.

The minimum is to limit the size of the heap using: -Xmx32m for example for a 32m heap (enough for the getting started example).

If running on 11, the default GC is G1 that uses more memory than the default on from 8, when running on small containers (under 1GB of memory), the JVM will switch to Parallel GC so you can also do it on your laptop to have a more "production" settings using -XX:-UseParallelGC

You can also limit the size of the metaspace as Quarkus will not use a lot of it:
-XX:MetaspaceSize=32M
-XX:MaxMetaspaceSize=256M

Regards,

Loïc

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CABEjM6QyLkq33KQyTzUehgG51LrH30tsUd3ToPaUN7joMvqjag%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages