I run an app in a 7.5GB RAM server (no swap) with args:
-Xmx3g -Xms3g -Xlog:gc -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:MaxDirectMemorySize=500m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -Dio.netty.maxDirectMemory=0 -Djdk.nio.maxCachedBufferSize=104857
The RSS of the process keeps increasing while the heap is 90% empty until the linux memory killer takes action.
Took a heap dump:
SELECT db, db.capacity, classof(inbounds(db).get(0)).getName() FROM java.nio.DirectByteBuffer db WHERE classof(inbounds(db).get(0)).getName().startsWith("io.netty")
And it results on 320 instances of DirectByteBuffer with capacity==16MB from io.netty.buffer.PoolThreadCache$MemoryRegionCache$Entry
(I guess not all the "capacity" is physically allocated because it would exceed 5GB)
The app is not using Netty directly but some dependencies are: S3, Redisson, version -> 4.1.58. Google cloud monitoring with a grpc-netty-shaded (1.34.1)
How I can control the amount of memory used?