Huge resident size despite small heap
Thomas Stüfe
thomas.stuefe at gmail.com
Mon Mar 28 09:03:30 UTC 2022
Hi Stefan,
as Per wrote, try NMT first. NMT got improved a lot in the last JDK
versions. JDK18 would actually be the best.
More random thoughts:
One thing to try is to use `jcmd <pid> System.trim_native_heap`. That will
trim the glibc C-Heap from internally accumulated overhead. It needs
JDK17 though.
Another thing to try is to reduce the number of malloc arenas,
MALLOC_ARENA_MAX. To reduce malloc contention, glibc works with arenas, and
MALLOC_ARENA_MAX depends on the number of processors.
These ideas are not necessarily solutions, but steps to exclude that
the RSS increase is caused by the glibc.
Cheers, Thomas
On Sun, Mar 27, 2022 at 11:15 PM Stefan Reich <
stefan.reich.maker.of.eye at googlemail.com> wrote:
> Hi, I am currently running OpenJDK 16 on my server (will upgrade to 17
> when I'm sure none of my code is dependent on illegal accesses). OS is
> Ubuntu 18.
>
> I am noticing that a long running server process eventually (after a few
> days) grows enormously in its resident size. Right now it is at 7 GB.
> Performing a GC doesn't get it any lower.
>
> The weird part is that the process is run with -Xmx2g, and currently used
> heap according to java.lang.Runtime is only 400 MB after GC, going up to at
> most 1 GB in operation.
>
> How do these numbers fit together?
>
> I've seen the resident size even higher (13+ GB), and at that point I
> noticed the process getting significantly slower too (web pages taking 1-2
> seconds to load instead of near instant).
>
> At a typical moment in time, no Java threads are running (I monitor this
> every second).
>
> An obvious suspect is of course any native library loaded. The only native
> library in use is, I think, the OSHI library.
>
> Any ideas why this might be happening?
>
> Many greetings,
> Stefan
>
> --
> == Gaz.AI ==
> _______________________________________________
> hotspot-gc-use mailing list
> hotspot-gc-use at openjdk.java.net
> https://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20220328/001b85d6/attachment-0001.htm>
More information about the hotspot-gc-use
mailing list