LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-11-2009, 02:42 PM   #1
sang_froid
Member
 
Registered: Oct 2006
Posts: 179

Rep: Reputation: 15
high memory usage


Hi,

I have a server running samba process and there are about 70 samba users connected at a time. The system has 4Gb of memory and it seems each samba process is utilizing only 3352Kb of memory.

When I run the command

pmap -d (pid of samba)

It gives as:

b7ffa000 4 rw-s- 0000000000000000 0fd:00003 messages.tdb
bfe46000 1768 rw--- 00000000bfe46000 000:00000 [ stack ]
ffffe000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 33384K writeable/private: 3352K shared: 20504K



But when I run the top command, it results as below:

Tasks: 163 total, 1 running, 162 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.9% us, 4.9% sy, 0.0% ni, 93.3% id, 0.8% wa, 0.2% hi, 0.0% si
Mem: 3895444k total, 3163192k used, 732252k free, 352344k buffers
Swap: 2097144k total, 208k used, 2096936k free, 2487636k cached


Why could the system be utilizing such high memory ? Any ideas ??

By the way, the server is not running other processes..

The samba version running in it is 3.0.33-0.17


I am confused...
 
Old 11-11-2009, 03:39 PM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by sang_froid View Post
Hi,

I have a server running samba process and there are about 70 samba users connected at a time. The system has 4Gb of memory and it seems each samba process is utilizing only 3352Kb of memory.

When I run the command

pmap -d (pid of samba)

It gives as:

b7ffa000 4 rw-s- 0000000000000000 0fd:00003 messages.tdb
bfe46000 1768 rw--- 00000000bfe46000 000:00000 [ stack ]
ffffe000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 33384K writeable/private: 3352K shared: 20504K



But when I run the top command, it results as below:

Tasks: 163 total, 1 running, 162 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.9% us, 4.9% sy, 0.0% ni, 93.3% id, 0.8% wa, 0.2% hi, 0.0% si
Mem: 3895444k total, 3163192k used, 732252k free, 352344k buffers
Swap: 2097144k total, 208k used, 2096936k free, 2487636k cached


Why could the system be utilizing such high memory ? Any ideas ??

By the way, the server is not running other processes..

The samba version running in it is 3.0.33-0.17


I am confused...


It seems the majority of your RAM is being used for caching.
This allows for extra fast memory access for running programs/processes and is short term memory for running apps.
 
Old 11-11-2009, 03:52 PM   #3
sang_froid
Member
 
Registered: Oct 2006
Posts: 179

Original Poster
Rep: Reputation: 15
ok...when I run free -m command, it outputs as:

PHP Code:
free -m
             total       used       free     shared    buffers     cached
Mem
:          3804       2879        924          0        358       2211
-/+ buffers/cache:        309       3494
Swap
:         2047          0       2047 
However my question is why the system needed so much of caching ? Each samba process is only utilizing about 3Mb of memory and even if there are 100 samba connections, then it will be 300Mb at most...

why the OS is seeking such high amount of caching ?



Quote:
Originally Posted by centosboy View Post
It seems the majority of your RAM is being used for caching.
This allows for extra fast memory access for running programs/processes and is short term memory for running apps.
 
Old 11-11-2009, 04:15 PM   #4
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 420Reputation: 420Reputation: 420Reputation: 420Reputation: 420
Why shouldn't it cache? If the RAM isn't needed for other things, it may as well. In general, Linux uses as much RAM as is available, since that is what it is there for. If you're having performance problems because of this then there may be a problem, but if things are running fine, then don't worry about it.
 
Old 11-11-2009, 05:27 PM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194Reputation: 1194
Quote:
Originally Posted by sang_froid View Post
why the system needed so much of caching ?
"needed" is the wrong word.

The system used that much caching. The nature of caching is that once memory is used for caching it remains used for caching until either the system wants to use that memory for something else or the files that were cached are deleted from disk.

Clearly your system has no "memory pressure" so the system doesn't want to use that memory for anything else. At least 2211MB of cached data is from files that haven't been deleted.

If some process happens to want that data again before the system wants the memory then the cache will be far faster than reading the data again from disk.

Quote:
Each samba process is only utilizing about 3Mb of memory
You are forgetting the shareable memory. The individual Samba you showed was using about 3MB non shareable memory and 20MB of shareable memory so if it were the only Samba instance it would be using 23MB.

The fact that memory is shareable does not prove it is shared. But in this case probably that 20MB is heavily shared.

Quote:
even if there are 100 samba connections, then it will be 300Mb at most...
In fact 309MB is in use. You have claimed almost all of that was by Samba. At least 20MB of it was shareable and you are estimating about 3MB per instance was not shareable. Allowing for maybe less than a 100 instances and some variation in memory use per instance, a total of 309MB seems perfectly reasonable.

I assume one of the things done by your Samba instances is reading files on behalf of clients. The most recently read files are probably most of the 2211MB of cache, so if the clients tend to reread files that were recently read that cache is providing a big benefit.

If they don't reread files then you have much more memory than you need and Linux is letting file data sit in the excess memory at no benefit and no cost and that data will be replaced by newer file reads as they occur.

Last edited by johnsfine; 11-11-2009 at 05:30 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
High Memory Usage jbum Slackware 6 04-26-2008 02:46 PM
High memory usage Kapriel Debian 6 07-29-2005 11:01 AM
High memory usage? Davus Linux - General 6 11-28-2004 02:33 AM
high memory usage. nexx_au Fedora 2 12-08-2003 03:41 AM
Memory usage too high glock19 Linux - General 7 06-05-2003 07:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration