0

Possible Duplicate:
How to understand the memory usage and load average in linux server

Tasks:  39 total,   1 running,  37 sleeping,   0 stopped,   1 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,  1104824k used,   992328k free,        0k buffers
Swap:        0k total,        0k used,        0k free,  1026992k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
13617 mysql     20   0  170m  28m 6892 S    0  1.4   0:00.31 mysqld
24471 root      20   0  324m  21m 3584 S    0  1.1  18:04.37 MCMA2_Linux_x86
13432 root      20   0  208m  10m 5304 S    0  0.5   0:00.01 apache2
13441 www-data  20   0  208m 5844  660 S    0  0.3   0:00.00 apache2
13732 root      20   0 79008 3564 2816 S    0  0.2   0:00.02 sshd
13210 root      20   0 79008 3532 2792 S    0  0.2   0:00.01 sshd
13729 root      20   0 79008 3528 2792 S    0  0.2   0:00.01 sshd
13734 root      20   0 17768 1960 1432 S    0  0.1   0:00.00 bash
13508 root      20   0 17572 1560 1248 S    0  0.1   0:00.00 mysqld_safe
13738 root      20   0 18944 1288 1020 R    0  0.1   0:00.01 top
13212 root      20   0 12324  904  732 S    0  0.0   0:00.00 sftp-server
13731 root      20   0 12324  904  732 S    0  0.0   0:00.00 sftp-server
13618 root      20   0  3860  664  568 S    0  0.0   0:00.00 logger
  659 root      20   0 58128  468  272 S    0  0.0   0:28.29 sendmail-mta
  465 root      20   0  5988  456  332 S    0  0.0   0:05.33 syslogd
24468 root      20   0 23808  448  112 S    0  0.0   0:00.40 screen
  567 root      20   0 49180  324  208 S    0  0.0   0:05.82 sshd
  543 root      20   0 20912  236  152 S    0  0.0   0:01.27 cron
    1 root      20   0  8360   92   56 S    0  0.0   0:08.20 init
  573 root      20   0 19340    8    4 S    0  0.0   0:00.00 xinetd
  858 root      20   0 23940    8    4 S    0  0.0   0:00.17 screen
  859 root      20   0 17760    8    4 S    0  0.0   0:00.04 bash
 4084 root      20   0 23676    8    4 S    0  0.0   0:00.01 screen
 4085 root      20   0 17756    8    4 S    0  0.0   0:00.00 bash
 4255 root      20   0 23676    8    4 S    0  0.0   0:00.03 screen
 4256 root      20   0 17756    8    4 S    0  0.0   0:00.00 bash
 4505 root      20   0 24080    8    4 S    0  0.0   0:00.03 screen
 4506 root      20   0 17756    8    4 S    0  0.0   0:00.00 bash
 4713 root      20   0 17760    8    4 S    0  0.0   0:00.00 bash
 5149 root      20   0 23972    8    4 S    0  0.0   0:00.45 screen
 5150 root      20   0 17760    8    4 S    0  0.0   0:00.00 bash
 5358 root      20   0 17756    8    4 S    0  0.0   0:00.00 bash
 8527 root      20   0  3908    8    4 S    0  0.0   0:00.00 tail
24469 root      20   0 17764    8    4 S    0  0.0   0:00.00 bash
  476 root      20   0 54568    4    0 S    0  0.0   0:00.00 saslauthd
  477 root      20   0 54568    4    0 S    0  0.0   0:00.00 saslauthd
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd/484

It's my understanding that the RES column is how much actual RAM is being used. Going by what top is telling me, I should be using less than 100 MB of RAM and yet top and free shows I am using 1100 MB. What is top summing to get 1100 MB?

Is it because there is no swap, VIRT then takes out of mem?

I am using a VPS, so I think it has something to do with that?

ParoX
  • 302
  • 1
  • 6
  • 21
  • http://www.linuxatemyram.com/ – user9517 Jan 13 '13 at 18:00
  • Hm ok, I feel dumb. Are you saying all this time I've been buying 1-2 GB VPS, I only really need 128 or 256 MB ones? Can you post as an answer, even if its just copy n paste so I can mark you as accepted. – ParoX Jan 13 '13 at 18:02
  • 1
    You might want to avoid those OpenVZ-based VPSes, as they completely lie to you about your memory usage (and many other reasons). – Michael Hampton Jan 13 '13 at 18:17

1 Answers1

0

The top command is showing you using 1104824k, or 1,104,824k ~ 1100 Megabytes... Out of a total of 2097152k - 2GB RAM.

ewwhite
  • 194,921
  • 91
  • 434
  • 799
  • Yes, I know. My question was really what is `top` summing to get `1100 MB`. lain seems to find the answer, but I am a bit skepitcal – ParoX Jan 13 '13 at 18:08
  • Filesystem cache... – ewwhite Jan 13 '13 at 18:12
  • @BHare: If the system made more memory free, one of two things would happen: 1) That memory wouldn't get used, in which case making it free is a waste of effort. 2) That memory would get used, in which case it would just have to switch it back from free to used, in which case making it free would have been a waste of effort. So your question is really "Why is my computer being smart, and not wasting its time, instead of dumb and doing things that provide no benefit?". And the answer is obvious -- because people who design OS memory managers are smart. – David Schwartz Jan 14 '13 at 05:43