Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

As a relative newbie to systems, I inherited a Debian server and I've noticed that virtual memory is very high (around 95%!). The server has been running slow for around 6 months, and I was wondering if any of you had any tips on things I could try, particularly on freeing up memory. The server hosts various websites and also a Postit email server.

Here are the details:

Operating system    Debian Linux 5.0
Webmin version  1.580
Time on system  Thu Apr 12 11:12:21 2012
Kernel and CPU  Linux 2.6.18-6-amd64 on x86_64
Processor information   Intel(R) Core(TM)2 Duo CPU E7400 @ 2.80GHz, 2 cores
System uptime   229 days, 12 hours, 50 minutes
Running processes   138
CPU load averages   0.10 (1 min) 0.28 (5 mins) 0.36 (15 mins)
CPU usage   14% user, 1% kernel, 0% IO, 85% idle
Real memory     2.94 GB total, 1.69 GB used

Virtual memory  3.93 GB total, 3.84 GB used

Local disk space    142.84 GB total, 116.13 GB used

Free m output:

free -m
             total       used       free     shared    buffers     cached
Mem:          3010       2517        492          0        107        996
-/+ buffers/cache:       1413       1596
Swap:         4024       3930         93

Top output:

top - 11:59:57 up 229 days, 13:38,  1 user,  load average: 0.26, 0.24, 0.26
Tasks: 136 total,   2 running, 134 sleeping,   0 stopped,   0 zombie
Cpu(s):  3.8%us,  0.5%sy,  0.0%ni, 95.0%id,  0.7%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3082544k total,  2773160k used,   309384k free,   111496k buffers
Swap:  4120632k total,  4024712k used,    95920k free,  1036136k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                              
28796 www-data  16   0  304m  68m 6188 S    8  2.3   0:03.13 apache2                               
    1 root      15   0 10304  592  564 S    0  0.0   0:00.76 init                                  
    2 root      RT   0     0    0    0 S    0  0.0   0:04.06 migration/0                           
    3 root      34  19     0    0    0 S    0  0.0   0:05.67 ksoftirqd/0                           
    4 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0                            
    5 root      RT   0     0    0    0 S    0  0.0   0:00.06 migration/1                           
    6 root      34  19     0    0    0 S    0  0.0   0:01.26 ksoftirqd/1                           
    7 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1                            
    8 root      10  -5     0    0    0 S    0  0.0   0:00.12 events/0                              
    9 root      10  -5     0    0    0 S    0  0.0   0:00.00 events/1                              
   10 root      10  -5     0    0    0 S    0  0.0   0:00.00 khelper                               
   11 root      10  -5     0    0    0 S    0  0.0   0:00.02 kthread                               
   16 root      10  -5     0    0    0 S    0  0.0   0:15.51 kblockd/0                             
   17 root      10  -5     0    0    0 S    0  0.0   0:01.32 kblockd/1                             
   18 root      15  -5     0    0    0 S    0  0.0   0:00.00 kacpid                                
  127 root      10  -5     0    0    0 S    0  0.0   0:00.00 khubd                                 
  129 root      10  -5     0    0    0 S    0  0.0   0:00.00 kseriod                               
  180 root      10  -5     0    0    0 S    0  0.0  70:09.05 kswapd0                               
  181 root      17  -5     0    0    0 S    0  0.0   0:00.00 aio/0                                 
  182 root      17  -5     0    0    0 S    0  0.0   0:00.00 aio/1                                 
  780 root      16  -5     0    0    0 S    0  0.0   0:00.00 ata/0                                 
  782 root      16  -5     0    0    0 S    0  0.0   0:00.00 ata/1                                 
  783 root      16  -5     0    0    0 S    0  0.0   0:00.00 ata_aux                               
  802 root      10  -5     0    0    0 S    0  0.0   0:00.00 scsi_eh_0                             
  803 root      10  -5     0    0    0 S    0  0.0   0:00.00 scsi_eh_1                             
  804 root      10  -5     0    0    0 S    0  0.0   0:00.00 scsi_eh_2                             
  805 root      10  -5     0    0    0 S    0  0.0   0:00.00 scsi_eh_3                             
 1013 root      10  -5     0    0    0 S    0  0.0  49:27.78 kjournald                             
 1181 root      15  -4 16912  452  448 S    0  0.0   0:00.05 udevd                                 
 1544 root      14  -5     0    0    0 S    0  0.0   0:00.00 kpsmoused                             
 1706 root      13  -5     0    0    0 S    0  0.0   0:00.00 kmirrord                              
 1995 root      18   0  193m 3324 1688 S    0  0.1   8:52.77 rsyslogd                              
 2031 root      15   0 48856  732  608 S    0  0.0   0:01.86 sshd                                  
 2071 root      25   0 17316 1072 1068 S    0  0.0   0:00.00 mysqld_safe                           
 2108 mysql     15   0  320m  72m 4368 S    0  2.4   1923:25 mysqld                                
 2109 root      18   0  3776  500  496 S    0  0.0   0:00.00 logger                                
 2180 postgres  15   0 99504 3016 2880 S    0  0.1   1:24.15 postgres                              
 2184 postgres  15   0 99504 3596 3420 S    0  0.1   0:02.08 postgres                              
 2185 postgres  15   0 99504  696  628 S    0  0.0   0:00.65 postgres                              
 2186 postgres  15   0 99640  892  648 S    0  0.0   0:01.18 postgres                              
share|improve this question

migrated from stackoverflow.com Apr 12 '12 at 9:26

This question came from our site for professional and enthusiast programmers.

    
Also to note, the system hasn't been restarted in 229 days. I'm not sure this makes a big difference? –  Gregor Apr 12 '12 at 9:20
    
I'm guessing this is a stats from webmin. Try posting number you get from "free -m" and also use the "top" command to see which process eats memory –  LordDoskias Apr 12 '12 at 9:21
1  
See Linux Ate My Ram –  Gaius Apr 12 '12 at 9:22
    
Freeing up memory would make it slower. If it's running slow because it isn't using enough memory for its load, forcing it to operate with even less used memory would just make it slower! –  David Schwartz Apr 12 '12 at 9:29
    
It would help if you described the problem. What is slow exactly? Was it always slow? Did it suddenly get slow? Is it always slow? Your stats show an idle system, hard to imagine how that reflects a slow system. Can you post the output of standard tools like top or free. For example, I have no idea what this tool considers to be "used". I'm also pretty baffled what unused virtual memory would be. If it isn't used, then in what sense does it exist? –  David Schwartz Apr 12 '12 at 9:30
show 2 more comments

1 Answer

up vote 0 down vote accepted

I would hazard a guess that your system is using a lot of its swap space (what I think webmin is calling virtual memory) because of the databases you have running. You have both MySQL and Postgres running on the same box (do you mean for this to be the case? I suggest you just use one or the other) and, depending on your data/config, it is possible that they have both asked for large amounts of RAM for their own internal caches. Has someone been fiddling with DB parameters without considering what they would do?

If I am correct, then your apps that use the database may appear to be slow if they keep performing lookups on database tables that have been swapped out of RAM. I found this presentation the other day:

http://thebuild.com/presentations/not-my-job.pdf

It seemed pretty good (that guy's blog is generally a wealth of information on Postgres).

share|improve this answer
    
Thanks for the replies. Postgres is being used by Cyrus and Postfix, but seeing as we're migrating to google mail we can soon stop those. In the end I pinned it down to saslauthd which was taking up a lot of memory. Killing those 5 processes and restarting it freed up 85% virtual memory. –  Gregor Apr 17 '12 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.