Linux memory issue and let me know how can i fix this?

I can see all processes in my box using memory total as 25GB but the actual memory used is 62GB, I am really confused that what happened for remaining memory....don't know whether i need to clear memory cache or not?

test@test[~] $  ps aux  | awk '{print $6/1024/1024 " GB\t\t" $11}'  | sort -nr | awk '{print $1}' | awk '{total = total + $1}END{print total " GB"}'
24.4622 GB
test@test[~] $ free -g
                            total       used       free     shared    buffers     cached
Mem:                      62         62          0          0               2             32
-/+ buffers/cache:              27         35
Swap:                        7          0          7
test@test[~] $

Open in new window

memory issue
BharathKumarRaju DasaraRajuDevops EngineerAsked:
Who is Participating?
nociConnect With a Mentor Software EngineerCommented:
Why clean caches...., in caches the data is left in IO buffers, just in case it could be reread later on.
Buffers should get flushed if more processes are started, ie. memory for processes is needed.
The OS should do that for you.

Are you running into trouble?...
Effectively this means ALL of your memory is used, either by processes or by IO caches.
So you didn't buy too much of the memory.

Clearing caches just means that all cache information is dumped, and the counter should show that,
all IO will fill the cache again..., at the expense of Physical IO to storage.
This might actualy slow down your systems as they incur more delays to get the same job done.
It might also be a sign that this environment may need MORE memory to function optimal. (that would happen if processes get swapped).
Syed Abdul QadeerSenior Linux AdministratorCommented:
try clearing cache memory
BharathKumarRaju DasaraRajuDevops EngineerAuthor Commented:
Hi Guys,

Thanks for your reply. But now my application is down because any suggestion to reduce memory in this box please
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

not sure what, your system is swapping.
The scheduler designates which process runs while those that are not are stored on disk until their turn.

Top is the command to use, see utilization
Uptime is another to see load.
Vmstat 5 5
Iostat -xtc 5 5

What is your application?
You may have to make sure your applications are tuned.

If your memory demand is twice what you have it suggests the system was under speced for what it needs.

I.e. You rented a utility truck but what you need to move needs a moving truck.
Underestimated the load on the system.
Dr. KlahnConnect With a Mentor Principal Software EngineerCommented:
As arnold says.

But I would have said, "You have a half-ton pickup but you need a Missile Crawler Transporter Facility."  An application that requires 25 GB of physical memory and then uses another 30 GB of cache wants either (a) strong re-evaluation by an analyst in that area with an eye toward streamlining, or (b) splitting up across multiple systems.

Side issue:  Cache is great, but imo there can be too much of it.  When a system with a great big cache fails, there can be so much uncommitted data in the cache (and 30 GB is a lot of uncommitted data) that "things" wind up corrupt, particularly databases.  30 GB of cache is a lot of cache; imo, too much.  I'd set restrictions on the amount of cache the system can use.

"By default, Linux will use free RAM (almost all of it) to cache disk accesses, and will delay writes. The heuristics used by the kernel to decide the caching strategy are not perfect, but beating them in a specific situation is not easy."

On a non-journaling file system the result might be disaster.
Duncan RoeConnect With a Mentor Software DeveloperCommented:
Your posted output from free shows only 27G actually used (line 3). Line 4 shows no swapping. The 2 together show a system running well with no memory issues.
Don't worry about cache - its only purpose is to save physical accesses to file system devices.
nociSoftware EngineerCommented:
HM. Points should be split, as at least 3 answers say that memory is not the problem...
Duncan RoeSoftware DeveloperCommented:
@noci: I can't see any other answers saying that memory is not the problem. Can you identify those you have in mind please?
nociSoftware EngineerCommented:
Why clean caches....

#42493088  - on 2nd reading, less relevant....

Your posted output...

OK 2 not 3.
Duncan RoeSoftware DeveloperCommented:
OK I would include https:#a42492300 next time. But it did not ram home the point that memory is not a problem on this system and all memory in use is perfectly normal, so uneven points split.
BharathKumarRaju DasaraRajuDevops EngineerAuthor Commented:
Sorry guys .. yes it is solved...we have rebooted after stop starting the application ;)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.