Managing Memory

One of the most important tasks to get an indication of the current health of your server is to monitor the usage of system memory. In Chapter 11, you learned how to interpret the statistics provided by the top command. One of the most important facts you have to remember about the usage of system memory is the difference between allocated memory and memory that is really in use. When a process loads, it will always claim more memory than the amount of memory that is really needed. This is called memory overallocation. Overallocation is good, because it allows the process to access more memory instantaneously when more memory is required. As a system administrator, you should monitor the relationship between memory that is allocated by a process and memory that is really used by that process. You can do this with top (see Figure 28-1).

In top, you will see two columns that are important with regard to memory management. First, the column SIZE shows the amount of memory that is claimed by the process. The size in the column RES shows what is actually used by the process in the last polling interval.

Fie -At View li'in ■ .il I. 1 ■ Help top - 18:03:16 up 1:46, 2 users, load average: 0.01, 0.04, 0.03

Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.7Sus, O.Oitsy, O.OSni, 99.3Kid, O.Oitwa, O.OKhi, O.O^si, O.OXst

Mem: 516400k total, 497132k used, 19266k free, 172486k buffers

Swap: 779112k total, 40k used, 779072k free, 216492k cached

PID

USER

PR

NI

VIRT

RES

SHR

S

&CPU

%MEM

TIME+

COMMAND

3137

root

15

0

39856

16m

7580

S

0.

.7

3.

.2

1

18.

,47

X

6214

root

16

0

2188

1028

764

R

0,

.3

0,

.2

0

00.

,03

top

1

root

16

0

720

280

244

S

0,

.0

0,

.1

0

01.

,42

init

2

root

34

19

0

0

0

S

0,

.0

0.

.0

0

00.

,01

ksoftirqd/O

3

root

10

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,11

events/0

4

root

10

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,01

khelper

5

root

10

-5

0

0

0

s

0.

.0

0,

.0

0

00.

,00

kthread

7

root

10

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,61

kblockd/0

8

root

20

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,00

kacpid

96

root

15

0

0

0

0

s

0,

.0

0,

.0

0

00.

.15

pdflush

97

root

15

0

0

0

0

s

0.

.0

0,

.0

0

03.

,81

pdflush

99

root

11

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,00

aio/0

98

root

15

0

0

0

0

s

0,

.0

0.

.0

0

00.

,38

kswapdO

305

root

11

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,00

cqueue/Q

306

root

11

-5

0

0

0

s

0.

.0

0,

.0

0

00.

,01

kseriod

346

root

11

-5

0

0

0

s

0,

.0

0,

.0

0

00.

,00

kpsmoused

720

root

11

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,00

scsi eh 0

825

root

10

-5

0

0

0

s

0,

.0

0,

.0

0

00.

,08

reiserfs/O

893

root

11

-4

1840

656

348

s

0.

.0

0,

.1

0

01.

,50

udevd

1302

root

11

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,00

kgameportd

1392

root

20

0

0

0

0

s

0,

.0

0.

.0

0

00.

,00

shpchpd event

1452

root

10

-5

0

0

0

s

0,

.0

0.

.0

0

00.

,00

khubd

1997

messageb

16

0

3416

1016

728

s

0.

.0

0,

.2

0

04.

,64

dbus-daemon

2014

root

16

0

1516

512

428

s

0,

.0

0,

.1

0

00.

,01

acpld

2028

root

15

0

1892

816

576

s

0.

.0

0.

.2

0

18.

,30

syslog-ng

2031

root

16

0

1656

524

324

s

0,

.0

0,

.1

0

00.

,04

klogd

2094

root

17

0

2224

680

548

s

0.

.0

0,

.1

0

00.

,03

resmgrd

2350

root

16

0

4272

2876

1448

s

0,

.0

0.

.6

0

06.

,04

hald

2372

root

18

0

1820

600

524

s

0,

.0

0.

.1

0

00.

,02

hald-addon-acpi

2413

root

15

0

1644

568

476

s

0,

.0

0.

.1

0

01.

,52

vmware-guestd

2630

root

16

0

1816

728

640

s

0.

.0

0,

.1

0

04.

,25

hald-addon-stor

Fie -At View li'in ■ .il I. 1 ■ Help top - 18:03:16 up 1:46, 2 users, load average: 0.01, 0.04, 0.03

Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.7Sus, O.Oitsy, O.OSni, 99.3Kid, O.Oitwa, O.OKhi, O.O^si, O.OXst

Mem: 516400k total, 497132k used, 19266k free, 172486k buffers

Swap: 779112k total, 40k used, 779072k free, 216492k cached

Figure 28-1. Use top to monitor the difference between claimed memory and memory that is actually used.

Was this article helpful?

0 0

Post a comment