Table of Contents

Global Limits

Avaliable file descriptors

Other than file descriptors globally used by ze-filter (log files, databases, …) the filters consummes two file descriptors per SMTP connection - one to communicate with the MTA (libmilter) and another one to save the message being handled in the spool. So, roughly speaking, the number of file descriptors in use is the double of the number of connections being handled plus a little fixed quantity (~ 30).

Under Unix, the number of file descriptors being used by a processus simultaneously is upper bounded by :

You can get rid of this limitation if the libmilter you're using was compiled with one of the following options enabled : SM_CONF_POLL or _FFR_WORKERS_POOL. To do this, you shall add the following line to file devtools/Site/site.config.m4 :
APPENDDEF(`conf_ENVDEF',`-D_FFR_WORKERS_POOL=1')
APPENDDEF(`conf_ENVDEF',`-DSM_CONF_POLL=1')

In both cases, all libmilter calls to select(2) are replaced by poll(2) which isn't limited by FD_SETSIZE.

This solution is valid only if the milter itself doesn't call select(2) itself.

Checking if the limit is reached is the responsibility of the milter, not libmilter. ze-filter uses the following options to control it. These values are usually fine.

USE_SELECT_LIMIT                   YES
FILE_DESCRIPTORS                   MAX
FD_FREE_SOFT                       100
FD_FREE_HARD                       50

Maximum simultaneous connections

This value shall usually be set to, no more than, half the limit of the file descriptors available to the filter.

MAX_OPEN_CONNECTIONS               500

CPU load control

If the CPU idle value is less than LOAD_CPU_IDLE_SOFT %, the filter will reject connections from unknown SMTP clients. If the CPU idle value is less than LOAD_CPU_IDLE_HARD %, the filter will stop accepting connections till this value gets up again.

LOAD_CPU_IDLE_SOFT                20
LOAD_CPU_IDLE_HARD                10

Default values are 0 and 0 : no load control

CPU load monitoring

ze-filter logs, once a minute, the server load. It's useful when you need to debug load problems.

# grep "SYSTEM LOAD" /var/log/ze-filter
Oct 5 06:27:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.7  0.2  0.0  0.0
Oct 5 06:28:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.8  0.1  0.1  0.0
Oct 5 06:29:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.8  0.2  0.0  0.0
Oct 5 06:30:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.8  0.2  0.0  0.0
Oct 5 06:31:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.6  0.3  0.1  0.0
Oct 5 06:32:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.9  0.1  0.0  0.0
Oct 5 06:33:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.8  0.1  0.0  0.0
Oct 5 06:34:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.8  0.1  0.0  0.0
Oct 5 06:35:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.9  0.1  0.0  0.0
Oct 5 06:36:08 ... SYSTEM LOAD - idle/kernel/user/nice = 99.7  0.2  0.1  0.0