2

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

This is the output of free -m on a production database (MySQL with machine. 83MB looks pretty bad, but I assume the buffer/cache will be used instead of Swap?

[admin@db1 www]$ free -m
             total       used       free     shared    buffers     cached
Mem:         16053      15970         83          0        122       5343
-/+ buffers/cache:      10504       5549
Swap:         2047          0       2047

top ouptut sorted by memory:

top - 10:51:35 up 140 days,  7:58,  1 user,  load average: 2.01, 1.47, 1.23
Tasks: 129 total,   1 running, 128 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.5%us,  1.2%sy,  0.0%ni, 60.2%id, 31.5%wa,  0.2%hi,  0.5%si,  0.0%st
Mem:  16439060k total, 16353940k used,    85120k free,   122056k buffers
Swap:  2096472k total,      104k used,  2096368k free,  5461160k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                     
20757 mysql     15   0 10.2g 9.7g 5440 S 29.0 61.6  28588:24 mysqld                                                                                                                                       
16610 root      15   0  184m  18m 4340 S  0.0  0.1   0:32.89 sysshepd                                                                                                                                     
 9394 root      15   0  154m 8336 4244 S  0.0  0.1   0:12.20 snmpd                                                                                                                                        
17481 ntp       15   0 23416 5044 3916 S  0.0  0.0   0:02.32 ntpd                                                                                                                                         
 2000 root       5 -10 12652 4464 3184 S  0.0  0.0   0:00.00 iscsid                                                                                                                                       
 8768 root      15   0 90164 3376 2644 S  0.0  0.0   0:00.01 sshd       
Michael
  • 21
  • 1

3 Answers3

3

The line you should be looking at is:

-/+ buffers/cache:      10504       5549

which suggests you have more than 5GB that can be freed on a 16GB machine. Alternatively, you can do math and add up the free + buffers + cache from the first line and get approximately the same number, but math is hard, so why bother if it's right there on the next line.

cjc
  • 24,533
  • 2
  • 49
  • 69
2

Yes the buffers are used by the system to speed up I/O operations (e.g., by caching file reads). If needed this memory will be automatically freed.

Your swap memory is not used which is a good sign (the system never needed more than the available physical memory).

Matteo
  • 457
  • 3
  • 14
0

Linux has managed to take advantage of almost all of your memory, letting very little go to waste. It's not like if you use 2GB less today, you can use an extra 2GB tomorrow.

David Schwartz
  • 31,215
  • 2
  • 53
  • 82