[NTLUG:Discuss] why swap?

Robert Citek rwcitek at alum.calberkeley.org
Fri Sep 10 07:51:49 CDT 2004


Why is swap being used?

I'm running rsync to take a snapshot of one machine to another.  It's 
been proceeding extremely slowly (< 5 MB/s over GigE).  So I had a look 
at the processes and memory usage with top, ps, and vmstat (see below). 
  Both top and vmstat indicate that swap is being used.  Yet, the top 5 
programs use up a total of less than 20% of memory according to top and 
ps.  With 4 GB of RAM you'd think there would be no need to swap.

Any thoughts as to why swap is being used?  Any other diagnostics I 
should run?

Regards,
- Robert

-----

# uname -va
Linux subaru 2.4.20-31.9bigmem #1 SMP Tue Apr 13 17:11:51 EDT 2004 i686 
athlon i386 GNU/Linux

# top
  06:42:22  up 9 days, 12:18,  2 users,  load average: 3.61, 3.83, 3.84
99 processes: 97 sleeping, 2 running, 0 zombie, 0 stopped
CPU0 states:   4.1% user  16.0% system    0.0% nice   0.0% iowait  
79.2% idle
CPU1 states:   5.0% user  27.0% system    0.0% nice   0.0% iowait  
67.2% idle
Mem:  3643768k av, 3572204k used,   71564k free,       0k shrd,  
187396k buff
                    2261104k actv,  539744k in_d,   70352k in_c
Swap: 12590248k av,  115244k used, 12475004k free                 
2625336k cached

   PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU 
COMMAND
19575 root      15   0  348M 269M   140 S    32.3  7.5 108:04   0 rsync
   754 ntp       15   0  2404 2404  2160 S     0.0  0.0   0:20   0 ntpd
20290 rwcitek   15   0  1744 1400  1176 S     0.0  0.0   0:00   1 bash
20374 root      15   0  1284 1284   972 R     0.3  0.0   0:00   1 top
   ...

# ps uax --sort=-vsz
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root     19694 18.1  8.7 363312 320476 pts/1 S    Sep09 102:54 rsync 
-av --delete ...
root     19575  1.1  7.6 363308 277508 pts/1 S    Sep09   6:42 rsync 
-av --delete ...
root       601  0.0  0.0 20884  596 ?        S    Aug31   0:04 ypbind
root       713  1.0  0.0  7276  336 ?        S    Aug31 140:05 3dmd
rwcitek  17021  0.0  0.0  5600    4 pts/1    S    Sep08   0:00 /bin/bash
rwcitek  20290  0.0  0.0  5592  884 pts/0    S    06:21   0:00 -bash
   ...

# vmstat  1 20
    procs                      memory      swap          io     system   
    cpu
  r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs 
us sy id
   ...
  0  2  2 113608  17852 177092 2692320   20    0   104     0 1619  2766  
0  8 92
  2  0  1 113620  17956 177268 2692104   36   12   624  1748 2464  4901  
3 21 75
  0  0  1 113652  17820 176952 2692604    0   32    12    32 1971  4712  
2 16 82
  0  1  7 113652  17864 177172 2692380    0    0   136 36192 1611  2997  
2 11 87
  0  0  0 113664  22604 176772 2687988    4   12   232  1712 1779  3004  
2 12 86
  1  0  2 113664  19488 177204 2690728    0    0   100     0 2393  4313  
5 17 78
  2  0  1 113672  18040 177324 2692064    0    8   104     8 1824  3630  
2 17 81





Regards,
- Robert
http://www.cwelug.org




More information about the Discuss mailing list