邮件系统-Postfix续

1.postfix采用文件队列来处理邮件,
从本地邮件->maildrop->incoming-.....
从外网邮件->incoming....如果是本地邮件则转到上一步

因为有文件队列保证,使得消息都不会丢失--------持久化的作用。


2.队列由queueManager几种管理,使得队列状态和消息流向都清晰可控。这里有点
像MVC的controller ,负责处理所有的请求,请求转发等等。

3.一套消息系统应该分模块。比如消息存储子模块,消息接受子模块,消息递送子模块,

安全校验子模块,用户信息子模块,等等。

4.对于一个消息系统,应该有完善的健康指标检验手段,比如队列健康情况(轻松,拥堵)

,机器健康情况(load,cpu使用率),出口健康检查(下一个结点接收消息的能力,如数据库情况,下一个邮件网关的接收能力,延迟等等)


5.The "Incomming queue"

The queue manager scans the incoming queue bringing any new mail into the

"active" queue if the active queue resource limits have not been exceeded. By

default, the active queue accommodates at most 20000 messages. Once the active

queue message limit is reached, the queue manager stops scanning the incoming

(and deferred, see below) queue.
当active queue满时,将不会在去取deferred queue 和incoming queue里的东西


The incoming queue grows when the message input rate spikes above the rate at

which the queue manager can import messages into the active queue.

当消息的入量大于消息进入active的量时incoming queue的大小增长

queueManager的效率往往是又IO拖慢的

in_flow_delay参数用来控制刷入active queue的速率


6.the "active queue"

Messages in the "maildrop", "hold", "incoming" and "deferred" queues (see

below) do not occupy memory; they are safely stored on disk waiting for their

turn to be processed. The envelope information for messages in the "active"

queue is managed in memory, allowing the queue manager to do global scheduling

以上队列并不毫内存而是存放在磁盘上,内存中只是放头信息,用于queue manager全局调



Congestion occurs in the active queue when one or more destinations drain

slower than the corresponding message input rate.

active queue的拥堵往往是因为目标节点的处理速度低于消息进入速度

Input into the active queue comes both from new mail in the "incoming" queue,

and retries of mail in the "deferred" queue. Should the "deferred" queue get

really large, retries of old mail can dominate the arrival rate of new mail.

active queue中的消息有incoming queue和deferred queue的部分重试消息构成,重试消

息的发送回牺牲新邮件的到达

The only way to reduce congestion is to either reduce the input rate or

increase the throughput. Increasing the throughput requires either increasing

the concurrency or reducing the latency of deliveries.

减少拥堵的方法要么是减少进入量要么是增加输出量,而增加输出量往往需要增加目标主

机的并发量并减少其延迟

no use increasing concurrency once the network pipe is full
当网络已经拥堵时增加并发量与事无补

The best way to avoid bottlenecks when one or more MX hosts is non-responsive

is to use connection caching.

解决MX主机无响应而造成的性能瓶颈的最好方法是使用连接缓存
(当主机不可用时缓存连接,这样就不用重试,当连接可用时再将这部分邮件逐渐发出去,

这样能减少不必要的连接数)


7.The deferred queue
延迟队列为每条消息打上一个时间标签(the cool-off time间隔时间),时间标签用于指

定下一个发送时间。当发送时间到时,消息会再次放入active queue.当发送失败时并需要

再次重试时,时间标签会变成现在的两倍长。这样做能够让新的邮件更多的发出去,而可

能再次发送失败的邮件会被滞留的更久。

cool-off time需要设置在minimal_backoff_time和maximal_backoff_time中,当时间已经

超过maximal_backoff_time。所以当有大量defferedmail 的机器down的时候,重启后可能

会有大量的消息阻塞掉active queue 可以用更加权衡的方法处理


8.投递调度算法
如果有多封邮件要送到同一个目的地,MDA第一次最多只能同时送

initial_destination_concurrency封邮件,如果能够完成初次投递,则会尝试同时送出更

多的邮件,指导发现目的系统不能承担当前复核或者同时投递的数目超过

default_destination_concurrency_limit.如果遇到问题会降低此值

当新收到的邮件数量超过postfix的投递能力,postfix会暂时停止投递deferred队列里的

邮件而去处理新接收到的邮件。这是因为处理新邮件的延迟要小于处理deferred队列中的

邮件。然后在空闲时再去处理deferred中的邮件

Note that whenever the queue manager is restarted, there may already be

messages in the active queue directory, but the "real" active queue in memory

is empty. In order to recover the in-memory state, the queue manager moves all

the active queue messages back into the incoming queue, and then uses its

normal incoming queue scan to refill the active queue. The process of moving

all the messages back and forth, redoing transport table (trivial-rewrite(8)

resolve service) lookups, and re-importing the messages back into memory is

expensive. At all costs, avoid frequent restarts of the queue manager (e.g. via

frequent execution of "postfix reload").

当queueamanger被重启,已经存在于active queue文件夹里的消息不会丢失,但是并不真

正存在于队列中,为了将其读入内存,qm将所有在aq里的消息放入incoming队列并进行常

规的队列检查并放入aq里,这些操作都很费资源,故尽量少的重启qm
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值