Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory usages high - Slow application response : Used memory value not decreasing + Free memory value not increasing

When application is in use for few minutes then it slowly increases the Used memory value and decreases Free memory value. Application get very slow after few minutes. Why isn't it releasing the memory.

System configuration :

  • CPU : Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz (No. of processors : 4 / No. of cpu cores : 8)
  • RAM : 30 GB
  • OS : CentOS-7

Application configuration :

  • java version "1.8.0_171" -- build 1.8.0_171-b11
  • apache-tomcat-7.0.55

Tomcat setting

enter image description here

Free -h command

enter image description here

Top command

enter image description here

. .

Used memory value showing 12 GB occupied and Free memory value showing 600 MB free. I have performed multiple concurrent user searches and run jcmd command to generate heapdump.hprof to analyze the memory usage and observed that heapdump file size is not more than 600 MB.

Used memory is 12 GB and heapdump is of 600 MB - I don't know why memory is not releasing or getting free.

Could any one please advise any read-up on how to setup/configure to improve memory usage for a particular h/w config.

like image 438
Santosh Avatar asked Dec 10 '19 08:12

Santosh


People also ask

What is high memory usage?

High Memory Usage is a state that Windows computers' RAM, ROM, or Cache usage grows to an extremely high level. Windows 10 high memory usage error is related to RAM and virtual memory.

What is memory usage?

Analytica User GuideReference sectionsMemory usage. The Memory Usage window displays the amount of memory available on your system, as well as the memory currently in use by all applications, including Windows itself.

What causes high memory usage on server?

High application server CPU or memory utilization is typically caused by a running batch job that is resource intensive, excessive garbage collection, or a looping thread.

Which is better in terms of memory utilization in Java?

One of G1's main advantages is the ability to compact free memory space without lengthy pause times and uncommit unused heaps. We found this GC to be the best option for vertical scaling of Java applications running on OpenJDK or HotSpot JDK .


2 Answers

The issue that you are facing is Memory leak

What is it?

In computer science, a memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in such a way that memory which is no longer needed is not released.

as above explained : memory which is no longer needed is not released

When it happens?

when before de-allocation of allocated heap , ref to allocated heap is disposed.while ref to heap is disposed then garbage collection won't be able address to allocated heap.on the other word , it won't be able to find orphaned allocated heap.

What does it cause in long running programs while Memory leak happens?

The program will eat RAM , CPU resources

How does it eat ?

The program constantly allocates RAM.But, does not de-allocate it.therefore, Used memory goes high and cause slow & laggy running.

How does it fixed ?

if you are using Android Studio , The intellisense feature of it, will sign Memory leak possible part of code by Yellow Color highlighting.if you hover on highlight, it will pop-out and shows you warning that why does it might cause problem.

like image 73
A Farmanbar Avatar answered Nov 14 '22 23:11

A Farmanbar


As far as i can see you are only setting the permSize. Set the -Xms and -Xmx as well, so that the garbage collector kicks in when those are reached and cleans up the heap memory.

like image 27
Claude Sylvanshine Avatar answered Nov 14 '22 23:11

Claude Sylvanshine