Memory usage: help me fine tune my FC6 VPS

Discussion in 'Server Operation' started by micko_escalade, Oct 14, 2007.

  1. micko_escalade

    micko_escalade New Member

    Hi,

    Can someone help find unnecessary processes that are running right now?
    Here's the output of free -t -m
    Code:
    [root@linux ~]# free -t -m
                 total       used       free     shared    buffers     cached
    Mem:           256        176         79          0          0         68
    -/+ buffers/cache:        108        147
    Swap:          255          0        255
    Total:         512        176        335
    [root@linux ~]# 
    
    Also Running Processes in webmin

    Code:
    Display :    PID  User  Memory  CPU  Search  Run.. 
    
    Real memory: 256.16 MB total / 174.99 MB free   Swap space: 255.99 MB total / 255.99 MB free
    
    Process ID 	Owner 	Size 	Command
    2180 	mysql 	121024 kB 	/usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/li ...
    2066 	nscd 	107040 kB 	/usr/sbin/nscd
    2037 	named 	38724 kB 	/usr/sbin/named -u named -c /etc/named.caching-nameserver.conf
    2414 	apache 	32924 kB 	/usr/sbin/httpd
    2304 	root 	30064 kB 	/usr/sbin/httpd
    2415 	apache 	30064 kB 	/usr/sbin/httpd
    2416 	apache 	30064 kB 	/usr/sbin/httpd
    2417 	apache 	30064 kB 	/usr/sbin/httpd
    2418 	apache 	30064 kB 	/usr/sbin/httpd
    2419 	apache 	30064 kB 	/usr/sbin/httpd
    2420 	apache 	30064 kB 	/usr/sbin/httpd
    2424 	apache 	30064 kB 	/usr/sbin/httpd
    2370 	root 	28824 kB 	./sc_serv sc_serv_narodna.conf
    2371 	root 	28820 kB 	./sc_serv sc_serv_izvorna.conf
    2367 	root 	21544 kB 	./sc_trans_linux sc_trans_izvorna.conf
    2368 	root 	20512 kB 	./sc_trans_linux sc_trans_narodna.conf
    2228 	sqlgrey 	14768 kB 	/usr/bin/perl -w /usr/sbin/sqlgrey -d
    2491 	root 	12060 kB 	/usr/libexec/webmin/proc/index_size.cgi
    2435 	root 	8640 kB 	sshd: root@pts/0
    2372 	smmsp 	7936 kB 	/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t
    2381 	smmsp 	7936 kB 	/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t
    2384 	smmsp 	7936 kB 	/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t
    2385 	smmsp 	7936 kB 	/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t
    2453 	root 	7588 kB 	/usr/bin/perl /usr/libexec/webmin/miniserv.pl /etc/webmin/miniserv.conf
    2215 	root 	7076 kB 	dovecot-auth
    2290 	postfix 	6748 kB 	qmgr -l -t fifo -u
    2289 	postfix 	6688 kB 	pickup -l -t fifo -u
    2283 	root 	6672 kB 	/usr/libexec/postfix/master
    2293 	nobody 	5604 kB 	proftpd: (accepting connections)
    2085 	root 	5348 kB 	/usr/sbin/sshd
    2402 	root 	4980 kB 	/usr/sbin/saslauthd -m /var/run/saslauthd -a pam
    2403 	root 	4980 kB 	/usr/sbin/saslauthd -m /var/run/saslauthd -a pam
    2404 	root 	4980 kB 	/usr/sbin/saslauthd -m /var/run/saslauthd -a pam
    2405 	root 	4980 kB 	/usr/sbin/saslauthd -m /var/run/saslauthd -a pam
    2406 	root 	4980 kB 	/usr/sbin/saslauthd -m /var/run/saslauthd -a pam
    2225 	dovecot 	4364 kB 	imap-login
    2227 	dovecot 	4364 kB 	imap-login
    2226 	dovecot 	4360 kB 	imap-login
    2222 	dovecot 	4356 kB 	pop3-login
    2223 	dovecot 	4356 kB 	pop3-login
    2224 	dovecot 	4356 kB 	pop3-login
    2314 	root 	4140 kB 	crond
    2315 	root 	4140 kB 	crond
    2316 	root 	4140 kB 	crond
    2317 	root 	4140 kB 	crond
    
    Since I'm not using nscd (name service cache daemon) can I turn it off ? its using 107040 kB

    Thanks!
     
  2. micko_escalade

    micko_escalade New Member

    output of top with SHIFT + M

    Code:
    top - 23:07:34 up 3 min,  1 user,  load average: 0.04, 0.07, 0.03
    Tasks:  99 total,   2 running,  93 sleeping,   0 stopped,   4 zombie
    Cpu(s):  2.5%us,  0.0%sy,  0.0%ni, 97.5%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:    262312k total,   147848k used,   114464k free,       48k buffers
    Swap:   262136k total,        0k used,   262136k free,    61224k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                
     2175 mysql     15   0  119m  19m 4340 S    0  7.7   0:00.11 mysqld                                                                 
     2299 root      18   0 30064  10m 5216 S    0  4.0   0:00.11 httpd                                                                  
     2424 apache    15   0 31016 9448 3056 S    0  3.6   0:00.03 httpd                                                                  
     2428 apache    15   0 31016 9444 3036 S    0  3.6   0:00.03 httpd                                                                  
     2429 apache    15   0 31016 9440 3056 S    0  3.6   0:00.03 httpd                                                                  
     2422 apache    15   0 30992 9424 3040 S    0  3.6   0:00.05 httpd                                                                  
     2423 apache    15   0 30992 9424 3040 S    0  3.6   0:00.05 httpd                                                                  
     2425 apache    15   0 31016 9420 3008 S    0  3.6   0:00.04 httpd                                                                  
     2426 apache    15   0 31016 9400 2988 S    0  3.6   0:00.03 httpd                                                                  
     2427 apache    15   0 31016 9376 2988 S    0  3.6   0:00.03 httpd                                                                  
     2223 sqlgrey   16   0 14768 9044 2552 S    0  3.4   0:00.02 sqlgrey                                                                
     2438 root      15   0  7592 5080 1524 S    0  1.9   0:00.00 miniserv.pl                                                            
     2365 root      18   0 21544 3508  808 S    3  1.3   0:08.00 sc_trans_linux                                                         
     2370 smmsp     18   0  7928 2760 1856 S    0  1.1   0:00.02 sendmail                                                               
     2371 smmsp     18   0  7928 2760 1856 S    0  1.1   0:00.01 sendmail                                                               
     2032 named     18   0 38728 2712 1764 S    0  1.0   0:00.01 named                                                                  
     2379 smmsp     19   0  7928 2656 1820 S    0  1.0   0:00.02 sendmail                                                               
     2380 smmsp     19   0  7928 2656 1820 S    0  1.0   0:00.02 sendmail                                                               
     2364 root      18   0 20512 2424  808 S    2  0.9   0:08.58 sc_trans_linux                                                         
     2447 root      15   0  8780 2400 1924 R    0  0.9   0:00.02 sshd                                                                   
     2495 root      15   0  8640 2364 1912 S    0  0.9   0:00.03 sshd                                                                   
     2366 root      18   0 28824 1916  572 S    0  0.7   0:00.03 sc_serv                                                                
     2363 root      18   0 28820 1912  572 S    0  0.7   0:00.04 sc_serv                                                                
     2278 root      19   0  6668 1656 1320 S    0  0.6   0:00.01 master                                                                 
     2220 dovecot   15   0  4360 1632 1364 S    0  0.6   0:00.00 imap-login                                                             
     2221 dovecot   15   0  4364 1632 1364 S    0  0.6   0:00.00 imap-login                                                             
     2222 dovecot   15   0  4360 1628 1364 S    0  0.6   0:00.00 imap-login                                                             
     2217 dovecot   15   0  4356 1624 1356 S    0  0.6   0:00.03 pop3-login                                                             
     2219 dovecot   15   0  4356 1624 1356 S    0  0.6   0:00.01 pop3-login                                                             
     2209 root      15   0  7076 1620 1192 S    0  0.6   0:00.00 dovecot-auth                                                           
     2218 dovecot   15   0  4352 1620 1356 S    0  0.6   0:00.01 pop3-login                                                             
     2287 postfix   20   0  6744 1596 1280 S    0  0.6   0:00.00 qmgr                                                                   
     2286 postfix   18   0  6692 1564 1252 S    0  0.6   0:00.00 pickup                                                                 
     2309 root      18   0  4136 1424  796 S    0  0.5   0:00.00 crond                                                                  
     2310 root      18   0  4136 1424  796 S    0  0.5   0:00.02 crond                                                                  
     2311 root      18   0  4136 1424  796 S    0  0.5   0:00.00 crond                                                                  
     2312 root      18   0  4136 1424  796 S    0  0.5   0:00.00 crond                                                                  
     2410 avahi     15   0  2920 1304 1140 S    0  0.5   0:00.00 avahi-daemon                                                           
     2459 root      16   0  2576 1300 1060 S    0  0.5   0:00.03 bash                                                                   
     2288 nobody    15   0  5604 1156  556 S    0  0.4   0:00.00 proftpd                                                                
     2142 root      21   0  2576 1104  952 S    0  0.4   0:00.01 mysqld_safe                                                            
     2507 root      15   0  4692 1056  812 S    0  0.4   0:00.01 sftp-server                                                            
     2494 root      15   0  2364 1052  808 R    0  0.4   0:00.06 top                                                                    
     2385 xfs       19   0  3588 1044  636 S    0  0.4   0:00.01 xfs                                                                    
     2061 nscd      18   0  104m 1012  764 S    0  0.4   0:00.00 nscd                                                                   
     2307 root      18   0  3348  992  468 S    0  0.4   0:00.00 crond                                                                  
     2352 root      19   0  2364  960  844 S    0  0.4   0:00.01 bash                                                                   
     2353 root      18   0  2364  960  844 S    0  0.4   0:00.00 bash                                                                   
     2356 root      19   0  2364  960  844 S    0  0.4   0:00.00 bash                                                                   
     2360 root      18   0  2360  956  844 S    0  0.4   0:00.01 bash                                                                   
     2080 root      15   0  5352  936  628 S    0  0.4   0:00.00 sshd                                                                   
     2052 dbus      15   0  2712  852  688 S    0  0.3   0:00.00 dbus-daemon                                                            
     2397 root      25   0  4980  676  428 S    0  0.3   0:00.00 saslauthd                                                              
        1 root      15   0  2032  656  564 S    0  0.3   0:00.03 init                                                                   
     2009 root      18   0  1696  576  484 S    0  0.2   0:00.00 syslogd                                                                
      775 root      18  -4  2120  572  368 S    0  0.2   0:00.34 udevd                                                                  
     2208 root      15   0  2004  556  460 S    0  0.2   0:00.00 dovecot                                                                
     2443 root      18   0  1628  456  392 S    0  0.2   0:00.00 mingetty                                                               
     2445 root      18   0  1628  456  392 S    0  0.2   0:00.00 mingetty                                                               
     2446 root      18   0  1628  456  392 S    0  0.2   0:00.00 mingetty                                                               
    [root@linux ~]# 
    
     
  3. micko_escalade

    micko_escalade New Member

    Anyone plz?
     
  4. ebal

    ebal New Member

    you can only reply to yourself

    google the services and find out what you dont want to run

    what your machine does ?
    what is your necessary processes ?

    if you want a web tool for this i suggest webmin
     
  5. micko_escalade

    micko_escalade New Member

    It seems like its apache that is causing this.
    Almost 3.7MB per process.
    After couple of hours I have only 3MB of free mem left.
    Code:
    [root@linux ~]# free -t -m
                 total       used       free     shared    buffers     cached
    Mem:           256        253          3          0          0         30
    -/+ buffers/cache:        222         33
    Swap:          255         96        159
    Total:         512        349        162
    [root@linux ~]# 
    
    That causes "my" VPS server to crash.
    Apache, mysql, ftp and shoutcast that's about it.
    I already have webmin.
     
  6. falko

    falko Super Moderator ISPConfig Developer

  7. micko_escalade

    micko_escalade New Member

    Thanks for the reply!
    Without some detailed instruction I'm really lost in this howto. I found some info on the web for MaxRequestsPerChild but then I guess after v1.3 of apache they started using <IfModule worker.c> and <IfModule prefork.c> so for worker I changed from 0 (which means infinite connections) to 100. That did not do anything my memory still goes from ~170MB down to 2MB after some time.

    I also think I have this part setup wrong, do all virtual sites needs to be listed in /etc/httpd/conf/httpd.conf
    with this setup ?
    Code:
    <VirtualHost *:80>
    DocumentRoot "/var/www/domain1.com"
    ServerName www.domain1.com
    ServerAlias domain1.com
    ErrorLog /var/log/httpd/domain1_com_error_log
    CustomLog /var/log/httpd/domain1_com_access_log combined
    <Directory "/var/www/domain1.com">
    allow from all
    Options -Indexes
    </Directory>
    </VirtualHost>
    
    and so on with domain2 etc.

    In the late hours when no users are active
    in less 10 seconds after loading 2 virtual domain sites my memory went from 40 to 28MB
    Code:
    [root@linux ~]# free -t -m
                 total       used       free     shared    buffers     cached
    Mem:           256        215         40          0          0        119
    -/+ buffers/cache:         95        160
    Swap:          255          0        255
    Total:         512        215        296
    [root@linux ~]# free -t -m
                 total       used       free     shared    buffers     cached
    Mem:           256        219         36          0          0        121
    -/+ buffers/cache:         98        158
    Swap:          255          0        255
    Total:         512        219        292
    [root@linux ~]# free -t -m
                 total       used       free     shared    buffers     cached
    Mem:           256        227         28          0          0        123
    -/+ buffers/cache:        103        152
    Swap:          255          0        255
    Total:         512        227        284
    [root@linux ~]# 
    
     
    Last edited: Oct 18, 2007

Share This Page