autoupdate
[postfix-master.git] / postfix-master / queuing.html
blobfe9c113713497976dfe0236082d722266a59d160
1 <html>
3 <head>
5 <title>Postfix Overview - Queue Management</title>
7 <META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW">
8 </head>
10 <body background="obsolete.gif">
12 <h1><a href="big-picture.html"><img src="small-picture.gif" width="115" height="45"></a>
13 Postfix Overview - Queue Management</h1>
15 <hr>
17 <p> <strong> Note: this web page is no longer maintained. It exists
18 only to avoid breaking links in web pages that describe earlier
19 versions of the Postfix mail system. </strong> </p>
21 <a href="docs.html">Up one level</a> | <a
22 href="motivation.html">Introduction</a> | <a href="goals.html">Goals
23 and features</a> | <a href="architecture.html">Global architecture</a>
24 | Queue Management | <a href="security.html">Security</a>
26 <h2>Postfix mail queues</h2>
28 Postfix has four main queues: <b>maildrop</b>, <b>incoming</b>,
29 <b>active</b> and <b>deferred</b> (click the upper left-hand icon
30 for the big picture). Locally-posted mail is deposited into the
31 <b>maildrop</b>, and is copied to the <b>incoming</b> queue after
32 some cleaning up. The <b>incoming</b> queue is for mail that is
33 still arriving or that the queue manager hasn't looked at yet.
34 The <b>active</b> queue is a limited-size queue for mail that the
35 queue manager has opened for delivery. Mail that can't be delivered
36 goes to the <b>deferred</b> queue, so that it does not get in the
37 way of other deliveries.
39 <p>
41 The queue manager keeps information in memory about the <b>active</b>
42 queue only. The active queue size is limited on purpose: <i>the
43 queue manager should never run out of working memory because of a
44 peak message workload</i>. Whenever there is space in the
45 <b>active</b> queue, the queue manager lets in one message from the
46 <b>incoming</b> queue and one from the <b>deferred</b> queue. This
47 guarantees that new mail will get through even when there is a
48 large backlog.
50 <p>
52 In addition to the queues mentioned above Postfix also maintains
53 two parking spaces. The <b>hold</b> queue is for mail that is frozen
54 in the queue; no delivery attempts are made until someone releases
55 these messages with the <a href="postsuper.1.html">postsuper</a>
56 command. The <b>corrupt</b> directory is for damaged queue files.
57 Rather than discarding these, Postfix leaves them here for human
58 inspection.
60 <h2>No thundering herd</h2>
62 Implementing a high-performance mail system is one thing. However,
63 no-one would be pleased when Postfix connects to their site and
64 overwhelms it with lots of simultaneous deliveries. This is an
65 issue especially when a site has been down and mail is backed up
66 elsewhere in the network.
68 <p>
70 Postfix tries to be a good network neighbor. When delivering mail
71 to a site, Postfix will initially make no more than two simultaneous
72 connections. As long as deliveries succeed, the concurrency slowly
73 increases up to some configurable limit (or until the host or
74 network is unable to handle the load); concurrency is decreased in
75 the face of trouble. For those familiar with TCP/IP implementation
76 details, Postfix implements its own analog of the TCP <i>slow
77 start</i> algorithm
79 <h2>Fairness</h2>
81 Apart from the <i>thundering herd</i> controls, the Postfix delivery
82 strategy is based on <i>round-robin</i> selection. The queue
83 manager sorts message recipients in the active queue by destination,
84 and makes round-robin walks <i>along</i> all destination queues.
86 <p>
88 On the average, Postfix will do simultaneous deliveries to the same
89 domain only when there is not enough work to keep all outbound SMTP
90 channels busy. So, when AOL goes off-line and comes back, it should
91 not stop the system from delivering to other sites.
93 <p>
95 When mail arrives faster than Postfix can deliver it, Postfix will
96 favor new mail over delayed mail. The idea is that new mail should
97 be delivered with as little delay as possible; delayed mail can be
98 delivered while the system would otherwise be idle.
100 <h2>Exponential backoff</h2>
102 Postfix implements per-message exponential backoff. When a message
103 cannot be delivered upon the first attempt, the queue manager gives
104 the queue file a time stamp that is offset into the future by some
105 configurable amount of time. Queue files with future time stamps
106 are normally ignored by the queue manager.
110 Whenever a repeat delivery attempt fails, the queue file time stamp
111 is moved into the future by an amount of time equal to the age of
112 the message. Thus, the time between delivery attempts doubles each
113 time. This strategy effectively implements exponential backoff.
115 <h2>Destination status cache</h2>
117 The Postfix queue manager maintains a limited, short-term list of
118 unreachable destinations. This list helps it to avoid unnecessary
119 delivery attempts, especially with destinations that have a large
120 mail backlog.
122 <hr>
124 <a href="docs.html">Up one level</a> | <a
125 href="motivation.html">Introduction</a> | <a href="goals.html">Goals
126 and features</a> | <a href="architecture.html">Global architecture</a>
127 | Queue Management | <a href="security.html">Security</a>
129 </body>
131 </html>