By default exim spawned off one mail queue process (runner) every hour which was way to little. I needed multiple runners to receive and send the mail immediately without delay. This option is particularly useful when mails only have one recipient, but every exim server should configure this option anyway.
- Change how many queue runners that are spawned off. In /etc/init.d/exim I changed this option: QUEUE=5m. This ensured that a new queue runner was created every 5 minutes. How often a new queue runner needs to be configured on a server depends on its load.
- Change max number of queue runners that can exist simultaneously in /etc/exim.conf: queue_run_max = 50
- Since we made changes in /etc/init.d/exim, we need to restart the server to make the effects off number of queue runners: /etc/init.d/exim restart
Multiple recipients
If a message shall be delivered to multiple remote hosts (multiple recipients), exim can be configured to run several smtp deliveries simultaneously by setting the configuration option “remote_max_parallel” to a value greater than one. Otherwise a delivery is sent serially. Max number of simultaneous delivery processes is then “queue_run_max * remote_max_parallel”.
In /etc/exim.conf change/add following: remote_max_parallel = 50
Whenever making a change to exim.conf, run the following command to ensure that exim reads the configuration changes and puts them in effect:
kill -HUP `cat /var/spool/exim/exim-daemon.pid`
Message management
There are multiple configuration options in how exim shall deal with the connections/mails itself, and these are the options I have played with.
#Simultaneous number of incoming connections to accept.
smtp_accept_max = 500
The server I was configuring had trusted servers that connected to exim and pushed thousands of mails per connection. So this option is a nice one:
#How many messages to accept per connection
smtp_accept_queue_per_connection = 2000
There is a point where the load gets so high that the server is unable to deal with what is coming. What that limit is depends on the hardware, software running on it, you name it. So the limit is different for every server. When the limit is reached, that’s when the server stops responding. You can set exim to have no queue deliveries if load is high in /etc/exim.conf: deliver_queue_load_max = 10
How to monitor the server during high load
- The top command can be used to view the current load on the server. In the picture you can see the load average in the top right corner (1, 5 and 15 minute average). I experienced that during high load, the server had an load average up to 30, but it barely registered in the cpu. That told me that I could safely configure the server to many more queue runners etc. because it was able to handle the load. I will not even try to enter the science of load average which I have yet to understand. That’s candy for another time.
- The sar command can be used to view historical load on the server by day, hour, minutes: /var/log/sa. Check the date on the files. sar04 is the 4th of the month in question. Command:
sar -f sa09 | less