Previous Section Next Section

QueueSortOrder

How to presort the queue V8.7 and later

Prior to V8.7 sendmail, mail messages in the queue were sorted by priority when the queue was processed. Under V8.7 an enhanced sort can be implemented with the QueueSortOrder option, the forms of which are as follows:

O QueueSortOrder=how               configuration file (V8.7 and later) 
-OQueueSortOrder=how               command line (V8.7 and later) 
define(`confQUEUE_SORT_ORDER',how) mc configuration (V8.7 and later) 

The argument how is of type character.[53] It can be a P or p (for priority), which causes sendmail to emulate its old (sort by priority) behavior. It can be an H or h (for host), which causes sendmail to perform an enhanced sort. Beginning with V8.8 sendmail, it can be T or t (for time), which sorts by submission time. Beginning with V8.10 sendmail, it can be F or f (for file), which sorts by filename. Beginning with V8.12 sendmail, it can be R or r (for random), which randomize the list of hosts, or M or m, which sorts based on file modification time. If any other character is specified or if how is omitted, the following message is printed and the option is skipped:

[53] Of course, we recommend using full words for clarity.

Invalid queue sort order "badchar"

If this option is omitted entirely, the default is to sort by priority. The default in configuring with the mc technique is also priority.

The QueueSortOrder option is safe. If specified from the command line, sendmail will not relinquish its special privileges.

QueueSortOrder=host

If what is host, the messages in the queue are first sorted by recipient host,[54] lock status, and priority. If any message for a host is locked (currently being delivered), all the messages for that host are also marked as locked. Then the queue is sorted again, this time by lock status (unlocked first), recipient host, and priority. Delivery attempts after this sort tend to group SMTP connections to the same host together sequentially.

[54] When there are multiple recipients, the host is taken from the first recipient in the list. If that recipient is successfully delivered but others are deferred, a different recipient will be first in the next queue run. That new first recipient can result in a new host for the sort.

Be careful in sorting by host. If you have a large backlog of low-priority (batch) mail on a low-speed link to some host (for example, news), you might end up delaying higher-priority mail intended for other hosts. The host sort is recommended for high-speed links but is less desirable on low-speed links.

QueueSortOrder=priority

The method to order a queue run that has been used by sendmail for many years is a simple sort of the message priorities. A message's priority is found in the qf file's P line (P line). The sort is based on cost. That is, low (less positive) priorities are sorted ahead of high (more positive) values.

QueueSortOrder=time (V8.8 and later)

Beginning with V8.8, sendmail recognizes the time keyword, which causes it to sort based on submission time. This setting is not intended for use in the configuration file. Instead, it should be used only from the command line and in combination with the -qR command-line switch (Section 11.8.2.3).

If you wrongly set time in the configuration file, large and old jobs will be sorted in with small, new jobs. This can delay important mail.

QueueSortOrder=filename (V8.10 and later)

Beginning with V8.10, sendmail recognizes the filename keyword, which causes it to sort based on filenames in the queue directory. This setting is not intended for use in the configuration file. Instead, it should be used when queues are unusually deep, as a fast way to process the queue.

The preceding sort modes open and read every qf file, dramatically slowing down the sort. Because the sort must happen before sendmail will begin processing the queue, such a slowdown on a very deep directory can lead to serious bottlenecks. This filename sorts on filename only, and does not open qf files to read them. See Section 6.1 for a description of how to handle deep queues.

QueueSortOrder=random (V8.12 and later)

Beginning with V8.12, sendmail recognizes the random keyword, which causes it to sort using a pseudorandomizer so that the list of envelopes ends up in a pseudorandom order. This setting is not intended for use in the configuration file. Instead, it should be used when queues are unusually deep, as a fast way to process the queue. Like the filename keyword, this mode avoids the cost of opening and reading every qf file. Unlike filename, however, parallel queue runners will have different lists to process. This avoids lock and other contentions that could somewhat slow a queue run.

QueueSortOrder=modtime (V8.12 and later)

Beginning with V8.12, sendmail recognizes the modtime keyword, which causes it to sort based on the modification time of each qf file. The list is ordered in reverse, so the oldest qf files are processed first. Although you can set modtime in the configuration file, it has the potential to unacceptably delay important new mail. In general, this setting is better used as part of a command-line invocation of sendmail.

    Previous Section Next Section