/usr/local/cpanel/bin/courier-auth what is this?

dicen

Member
May 29, 2005
17
0
151
What is /usr/local/cpanel/bin/courier-auth? It is linked to from /etc/authlib/authProg. It uses 8.4MB of memory for each process. It has something to do with authentication for Imap. Normally 5 of these processes are run (as configured in /etc/authlib/authdaemonrc). I lowered it to 1 already but it is still excessive.

This doesn't appear to be the Courier Imap authencation process. It looks like something that is custom to Cpanel and working as a Pipe. It also doesn't appear to fork itself so when I said 8.4MB of memory for each process, it really uses that much. No copy on write optimization from the Linux kernel. The actual Imap processes use far less. mysqld only uses 5MB.

There have been other threads about this processes memory usage. Could Cpanel shed some light on this please? Where is the source code? Can we get access to the source code as the binary is not in the 3rdparty/bin directory.

This doesn't look encouraging.

[email protected] [/usr/local/cpanel/bin]# ldd courier-auth
libnsl.so.1 => /lib/libnsl.so.1 (0xb7fc9000)
libdl.so.2 => /lib/libdl.so.2 (0xb7fc4000)
libm.so.6 => /lib/tls/libm.so.6 (0xb7fa1000)
libc.so.6 => /lib/tls/libc.so.6 (0xb7e76000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7e48000)
libutil.so.1 => /lib/libutil.so.1 (0xb7e44000)
/usr/local/cpanel/perl/IO/IO.so (0xb7e3f000)
/usr/local/cpanel/perl/Digest/MD5/MD5.so (0xb7e3a000)
/usr/local/cpanel/perl/Sys/Hostname/Hostname.so (0xb7e38000)
/usr/local/cpanel/perl/POSIX/POSIX.so (0xb7e22000)
/usr/local/cpanel/perl/Storable/Storable.so (0xb7e11000)
/usr/local/cpanel/perl/version/vxs/vxs.so (0xb7e0b000)
/usr/local/cpanel/perl/Cwd/Cwd.so (0xb7e07000)
/usr/local/cpanel/perl/Fcntl/Fcntl.so (0xb7e04000)
/usr/local/cpanel/perl/libperl.so (0xb7d1c000)
/lib/ld-linux.so.2 (0xb7fe9000)

In fact a lot of this doesn't look encouraging.

[email protected] [/usr/local/cpanel]# ldd cpsrvd
libnsl.so.1 => /lib/libnsl.so.1 (0xb7fc9000)
libdl.so.2 => /lib/libdl.so.2 (0xb7fc4000)
libm.so.6 => /lib/tls/libm.so.6 (0xb7fa1000)
libc.so.6 => /lib/tls/libc.so.6 (0xb7e76000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7e48000)
libutil.so.1 => /lib/libutil.so.1 (0xb7e44000)
/usr/local/cpanel/perl/Fcntl/Fcntl.so (0xb7e41000)
/usr/local/cpanel/perl/IO/IO.so (0xb7e3b000)
/usr/local/cpanel/perl/BSD/Resource/Resource.so (0xb7e37000)
/usr/local/cpanel/perl/Sys/Hostname/Hostname.so (0xb7e35000)
/usr/local/cpanel/perl/Storable/Storable.so (0xb7e24000)
/usr/local/cpanel/perl/Sys/Syslog/Syslog.so (0xb7e20000)
/usr/local/cpanel/perl/Digest/MD5/MD5.so (0xb7e1b000)
/usr/local/cpanel/perl/Compress/Zlib/Zlib.so (0xb7e01000)
/usr/local/cpanel/perl/Cpanel/UniqId/UniqId.so (0xb7dff000)
/usr/local/cpanel/perl/String/CRC32/CRC32.so (0xb7dfd000)
/usr/local/cpanel/perl/IO/Interface/Interface.so (0xb7df8000)
/usr/local/cpanel/perl/POSIX/POSIX.so (0xb7de1000)
/usr/local/cpanel/perl/Socket/Socket.so (0xb7ddc000)
/usr/local/cpanel/perl/version/vxs/vxs.so (0xb7dd6000)
/usr/local/cpanel/perl/Cwd/Cwd.so (0xb7dd3000)
/usr/local/cpanel/perl/Cpanel/OS/OS.so (0xb7dd0000)
/usr/local/cpanel/perl/libperl.so (0xb7ce7000)
/lib/ld-linux.so.2 (0xb7fe9000)


Lets take a look at the memory hitters over 2MB (I optimized Apache way down.).

4 0 24207 18258 16 0 7232 2480 - Ss ? 0:00 sshd: [email protected]/0
1 25 18229 1 19 0 67596 3400 rt_sig Ssl ? 0:00 /usr/sbin/named -u named
1 0 19718 1 16 0 6892 5096 - S ? 0:00 cpbandwd
4 100 18306 18282 16 0 21388 5124 - Sl ? 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/
1 47 19665 1 16 0 7824 5268 - S ? 0:00 eximstats
5 0 19720 1 34 19 9604 6752 - SN ? 0:00 cpanellogd - sleeping for logs
1 0 18338 1 16 0 9756 8016 - S ? 0:00 chkservd
4 0 26591 18255 16 0 9876 8400 pipe_w S ? 0:00 /etc/authlib/authProg
1 0 19768 1 16 0 17456 9080 - S ? 0:03 cpsrvd - waiting for connections
1 0 19869 1 16 0 25708 23544 - Ss ? 0:00 /usr/bin/spamd -d --allowed-ips=127.0.0.1 --pidfile=/var/run/spamd.pid --max-children=1
5 0 19875 19869 16 0 27108 24964 - S ? 0:00 spamd child


Compiled Perl Code: courier-auth (/etc/authlib/authProg), cpsrvd
Perl Code: cpbandwd, eximstats, cpanellogd, chkservd, and of course spamd

I have nothing against Perl. I love the langauge. But, even though the compiled Perl code is dynamically linked, the Perl interpreter uses most of the memory. Not the mention the Perl daemons we have the source to. Well, I will spend sometime trying to optimize Perl to use less memory for the code I have. But, it would be nice to know what exactly the Cpanel courier-auth does (that the normal one doesn't do) to see what can be optimized here.


Running separate Perl VMs is like running separate Java VMs per class. We should be able to find a way to share an interpreter for the less security critical daemons.

Thanks...

dicen
 

dicen

Member
May 29, 2005
17
0
151
Now /etc/authlib/authProg (/usr/local/cpanel/bin/courier-auth) is using 2MB instead of over 8MB. Something changed here. This file was modified on Dec 26 of 2006. I was not the only one who mentioned the memory usage of this process. Did Cpanel do something here? Please share. We do like to compliment you sometimes :).

VSZ RSS
9884 2132 pipe_w S ? 0:19 /etc/authlib/authProg
6896 2776 - S ? 0:05 cpbandwd
7848 3416 - S ? 0:01 eximstats
9724 4124 - S ? 0:31 chkservd
9772 5296 - SN ? 0:15 cpanellogd - sleeping for logs
17484 14956 - S ? 0:00 cpsrvd - waiting for connections
25776 8632 - Ss ? 0:04 /usr/bin/spamd -d ...
27896 20532 - S ? 0:00 spamd child

Compiled Perl using the /usr/local/cpanel/perl library files.
/etc/authlib/authProg
cpsrvd

Perl script daemons using /usr/bin/perl on my CentOS based VPS (5.8.7).
cpbandwd
eximstats
chkservd
cpanellogd
spamd

It looks like memory usage has improved for a number of these (and gotten worse for others). But things are definitely better and headed in the right direction.

Thanks...

dicen
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,462
25
473
Go on, have a guess
/usr/local/cpanel/bin/courier-auth is the authentication daemon for courier-imap which is the default POP3/IMAP server on cPanel servers.
 

cPanelNick

Administrator
Staff member
Mar 9, 2015
3,488
35
158
cPanel Access Level
DataCenter Provider
Now /etc/authlib/authProg (/usr/local/cpanel/bin/courier-auth) is using 2MB instead of over 8MB. Something changed here. This file was modified on Dec 26 of 2006. I was not the only one who mentioned the memory usage of this process. Did Cpanel do something here? Please share. We do like to compliment you sometimes :).

VSZ RSS
9884 2132 pipe_w S ? 0:19 /etc/authlib/authProg
6896 2776 - S ? 0:05 cpbandwd
7848 3416 - S ? 0:01 eximstats
9724 4124 - S ? 0:31 chkservd
9772 5296 - SN ? 0:15 cpanellogd - sleeping for logs
17484 14956 - S ? 0:00 cpsrvd - waiting for connections
25776 8632 - Ss ? 0:04 /usr/bin/spamd -d ...
27896 20532 - S ? 0:00 spamd child

Compiled Perl using the /usr/local/cpanel/perl library files.
/etc/authlib/authProg
cpsrvd

Perl script daemons using /usr/bin/perl on my CentOS based VPS (5.8.7).
cpbandwd
eximstats
chkservd
cpanellogd
spamd

It looks like memory usage has improved for a number of these (and gotten worse for others). But things are definitely better and headed in the right direction.

Thanks...

dicen
cpsrvd should be a lot smaller in 11.x
[process] [mem size] [file size]
cpsrvd - waiting for connections 9812 11264036