Profile Image
Surendra Balu

Java process is consuming 90% of memory

Hello,

 

We have 32GB server and I allocated java process 12GB (xmx) but to my surprise java is consuming 90% of the server memory i..e, around 29GB, leaving unix to kill this session because it doesn't have memory to perform kernal operations. Is there a fix for this?

 

Thanks

Surendra

  • javaprocess

  • xmx

  • unix

  • kernaloperations

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Surendra!

 

 Greetings.

 

 a. Can you share your JVM arguments? You can do ps -ef | grep {YOUR_PROCESS} and pass the output. We first need to confirm whether your -Xmx is set to 12gb

 

 b. From where you observing your Java process to takeup to 29G memory? Are you using system monitoring tool like top?

 

 c. Also be advised that -Xmx set a limit on Java Heap Size. After that there also other regions, they occupy memory. Refer to this video clip: https://www.youtube.com/watch?v=uJLOlCuOR4k&t=196s - If your application is having thread leak then your overall applications memory consumption will go beyond 12G.

 

 d. Did you run yCrash before restarting the application? It might share some insights.

Profile Image

Surendra Balu

Hello Ram, 

 

Again we are running into the issue, java process using 26GB, but we allocated only 12GB heap space. Below is the output of ps -ef | grep {process id}.

 

Unfortunately, I cannot copy and paste the entire content of output here. So I am just sending what do you want to see. 

 

-Xss1024k -Xms12288m -Xmx12288m

 

We are using cloudwatch to monitor the memory consumed/available on the box. 

 

I did ran the ycrash agent on that, it doesn't show any issues apart from indicating process 2020 is using more than 80% of available memory. 

 

Looking forward to know the root cause of the issue.

 

Thanks

Surendra

Profile Image

Ram Lakshmanan

Hello Surrendra!

 

 Greetings. Good to hear from you.

 

 I am suspecting memory consumption is happening from the off-heap memory. i.e. "Others" region, as explained in this video. Typically following are stored in your "off-heap" region: Socket Buffers, GC related information, Threads, JNI, File Descriptors.

 

Threads

 

 I could see you to be configured -Xss1024k i.e. for each thread you have 1MB as the stack size. How many threads does your application have? You can find that count in the 'Thread" section of the yCrash report. Assume you have 1000 threads, then these threads alone occupy 1GB of additional space (i.e. 1000 threads x 1MB/thread = 1000MB = 1GB).

 

JNI

 Does your application using JNI (Java Native Interface) to talk with any native C, C++ applications? If so those processes memory will also be accounted here

 

Metaspace

 What is your metaspace size? They are allocated outside -Xmx limit

 

Network Connections/File Descriptors

 How many network connections are open? You can found the cumulative count in the 'network' section of the yCrash report. Network connections can also occupy additional memory.

 

 Also curious to know whether 26GB memory consumption happens right away or after a period of time? If so how long? Some times if network connections/File descriptors aren't closed memory consumption can start to increase over a period of time.

 

 

  

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • javaprocess

  • xmx

  • unix

  • kernaloperations