Reinaldo de Carvalho wrote:
On Wed, Mar 9, 2011 at 6:40 PM, Tim <t...@woodlouse.co.uk> wrote:
What happens is that Postfix receives the message from the sender, queues
it, then immediately connects to *all* of the destination servers
simultaneously and starts sending the message to them. This completely
saturates the upstream Internet link, so each destination server sees a
gradual trickle of data, and virtually all of them time-out while receiving
data.
Fix the problem on the right way, use traffic control. Example to
outgoing email 1Mbit limit.
# Clean all rules and set default pfifo_fast classless qdisc for each interface.
tc qdisc show dev eth0 | grep -q pfifo_fast || tc qdisc del dev eth0 root
# Set Classfull Qdisc with Hierarchical Token Bucket Algoritm
# and setting class id 1001 as default to non-matched traffic by a filter.
tc qdisc add dev eth0 handle 1: root htb default 1001
# Class root (Available link)
tc class add dev eth0 classid 1:1000 root htb rate 100Mbit ceil 100Mbit
# Two childs (email/1002 and the others/1001)
tc class add dev eth0 classid 1:1001 parent 1:1000 htb rate 99Mbit ceil 99Mbit
tc class add dev eth0 classid 1:1002 parent 1:1000 htb rate 1Mbit ceil 1Mbit
# Classifier outgoing emails (non-emails will be sent to class 1001)
tc filter add dev eth0 protocol ip parent 1: u32 flowid 1:1002
match ip dport 25 0xffff
# attach Classless qdisc Stochastic Fairness Algoritm
# to improve (fairness) of concurrent connections.
tc qdisc add dev eth0 parent 1:1001 handle 1001: sfq perturb 10
tc qdisc add dev eth0 parent 1:1002 handle 1002: sfq perturb 10
So the idea of this is to restrict SMTP conversations to 1Mbps? Won't
that actually make the problem far worse?