DirectAdmin spawning too many processes?

BTCentral

Verified User
Joined
Nov 18, 2009
Messages
8
Hi All,

I noticed earlier today that my VPS was using far more ram than I was expecting it to be (upwards of 500MB) just running DirectAdmin and the services it installed.

So, I SSH'd into the VPS, and ran top - and was rather supprised to discover it was running 16 instances of pop3-login and imap-login.

I finally figured out how to change this, and reduced the number of each from 16 to 3 (and limit it to this), which brought the memory usage down to ~250MB for a while. There are not going to be many people accessing this mail server (generally around 6 people, and most likely not at the same time) so would you have thought this would be enough?

I really want to reduce the amount of RAM used by these services to as little as possible so that I have a fair bit of free memory for other things.

I am going to be the only person ever logging into the DirectAdmin interface, so do I really need 6 instances of DirectAdmin spawned? And if not, is it possible to limit the amount of spawned processes?

I will however obviously be wanting people to be able to access my website via it, but again, do I really need the 10 odd instances of Apache running that it has spawned, and if not, how do I limit this?

Any help/advice would be much appreciated.

Thank you.
 
There never will be more then one directadmin process running. You can change dovecot and apache settings by editing their configs to limit the amount of child processes.
 
There never will be more then one directadmin process running. You can change dovecot and apache settings by editing their configs to limit the amount of child processes.

So I assume this isn't normal then in that case?

Code:
[admin@server ~]$ top
top - 15:48:33 up 6 min,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:  41 total,   1 running,  40 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.1%us,  0.0%sy,  0.0%ni, 99.7%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1048576k total,   285088k used,   763488k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      15   0 10348  744  624 S  0.0  0.1   0:00.12 init
 5466 root      15  -4 12604  672  360 S  0.0  0.1   0:00.00 udevd
 5799 root      16   0  5908  620  500 S  0.0  0.1   0:00.00 syslogd
 5807 root      18   0 10332  680  500 S  0.0  0.1   0:00.00 dovecot
 5808 root      15   0 14800 1060  820 S  0.0  0.1   0:00.00 dovecot-auth
 5821 root      18   0 62624 1212  652 S  0.0  0.1   0:00.00 sshd
 5833 root      18   0 21644  928  716 S  0.0  0.1   0:00.00 xinetd
 5845 root      18   0 11928 1412 1176 S  0.0  0.1   0:00.00 mysqld_safe
 5869 mysql     18   0  136m  18m 3748 S  0.0  1.8   0:00.02 mysqld
 5897 dovecot   16   0 38192 2368 1872 S  0.0  0.2   0:00.00 pop3-login
 5898 dovecot   15   0 38192 2372 1872 S  0.0  0.2   0:00.00 pop3-login
 5899 dovecot   18   0 38192 2372 1872 S  0.0  0.2   0:00.00 pop3-login
 5900 dovecot   20   0 38204 2388 1888 S  0.0  0.2   0:00.00 imap-login
 5901 dovecot   21   0 38204 2384 1888 S  0.0  0.2   0:00.00 imap-login
 5902 dovecot   21   0 38204 2388 1888 S  0.0  0.2   0:00.00 imap-login
 5912 root      18   0  1232  292  236 S  0.0  0.0   0:00.00 da-popb4smtp
 5922 nobody    18   0 48648 2064 1400 S  0.0  0.2   0:00.06 [B]directadmin[/B]
 5930 mail      19   0 54588 1216  632 S  0.0  0.1   0:00.00 exim
 5935 nobody    18   0 48648  848  180 S  0.0  0.1   0:00.00 [B]directadmin[/B]
 5936 nobody    18   0 48648  848  180 S  0.0  0.1   0:00.00 [B]directadmin[/B]
 5937 nobody    18   0 48648  848  180 S  0.0  0.1   0:00.00 [B]directadmin[/B]
 5938 nobody    18   0 48648  848  180 S  0.0  0.1   0:00.00 [B]directadmin[/B]
 5939 nobody    18   0 48648  848  180 S  0.0  0.1   0:00.00 [B]directadmin[/B]
 5945 root      18   0 99.9m  41m 2416 S  0.0  4.1   0:00.64 spamd
 5952 root      18   0 92864 7804 3356 S  0.0  0.7   0:00.02 httpd
 5960 ftp       18   0  8800  948  508 S  0.0  0.1   0:00.00 proftpd
 5970 root      15   0 20876 1176  592 S  0.0  0.1   0:00.00 crond
 5978 root      18   0 46744  820  428 S  0.0  0.1   0:00.00 saslauthd
 5979 root      18   0 46744  552  160 S  0.0  0.1   0:00.00 saslauthd
 5989 apache    15   0 92864 5232  756 S  0.0  0.5   0:00.00 httpd
 5990 apache    15   0 92864 5224  748 S  0.0  0.5   0:00.00 httpd
 5996 apache    15   0 92864 5224  748 S  0.0  0.5   0:00.00 httpd
 5997 apache    19   0 92864 5224  748 S  0.0  0.5   0:00.00 httpd
 5998 apache    19   0 92864 5224  748 S  0.0  0.5   0:00.00 httpd
 6033 named     20   0  180m 4300 2040 S  0.0  0.4   0:00.00 named
 6073 root      18   0 99.9m  40m  676 S  0.0  3.9   0:00.00 spamd
 6074 root      18   0 99.9m  40m  588 S  0.0  3.9   0:00.00 spamd
10233 root      17   0 85916 3272 2556 S  0.0  0.3   0:00.00 sshd
11329 admin     15   0 85916 1824 1100 S  0.0  0.2   0:00.00 sshd
11330 admin     17   0 12064 1632 1284 S  0.0  0.2   0:00.01 bash
11366 admin     18   0 12736 1132  852 R  0.0  0.1   0:00.00 top

Note the 6 directadmin processes.

Thank you.
 
I'm not aware of any way to limit directadmin's processes (which are always 1 main process + 5 spawned handlers), but for Apache you can configure the MPM within /etc/httpd/conf/extra/httpd-mpm.conf. By default it's the prefork MPM, I suggest you compile Apache with the worker MPM. Instructions can be found on this forum.

Also, remember that if you have spare RAM, it's best to use it, up to 80% or so unless you have particular needs. Those processes aren't there just for fun: every time a new handler process is spawned a complete copy of the program is written to the RAM, creating disk/bus IO and CPU load. If the handler process is already spawned, the application will be ready to reply without any effort.

It's the same concept of data cache, only applied to processes.

An alternative (as the one offered by the worker MPM in Apache) is to use multithreaded processes, that won't copy all of their instructions but only the few needed to execute the handler functions.

To see the difference between processes and threads, and to see the real memory used by a process/thread and the one shared between copies, use either "pstree -up" (threads are shown within braces: "{proc}") or "htop" (much better alternative to "top").
 
Nevermind I guess there is 6 directadmin processes running 1 parent and 5 child processes.

This can be changed by the variable "numservers" in /usr/local/directadmin/conf/directadmin.conf
 
Thanks both for the help, much appreciated.

As top doesn't differentiate between parent/child processes, I assumed that there were just 6 instances of it running for some weird reason - rather than it running child processes too.

tillo - Thanks for the tip about "htop", I'd not heard of that before - I've just compiled & installed it and really like it - it's rather useful to be able to set it up so that you can view child processes in a different colour for example.

Thanks again.
 
Back
Top