1995-Sep-27/mea			-*- text -*-


	Some notes on configuring ZMailer-3.0 scheduler
	(aka. scheduler-new / nscheduler on ZMailer-2.99.16+)



	The new scheduler has a concept of threads, where all
	messages with same recipients (hosts, or users in case
	of 'local' channel) are groupped together.

	It has also a concept of thread-rings, which are groups
	of threads, where channel, config entry, and argv are
	identical.  Therefore commands should NOT have "$host"
	defined in their parameter lists, if a thread-ring is
	wanted to contain more than one thread.


	The new scheduler has also a mechanism to keep transporter
	processes around for latter re-activation, when previous
	jobs have been finished, and new ones haven't yet arrived.
	The thread idle-pool can contain all of the processes that
	a thread-ring (even w/o threads!) can have.

	For resource control there are configuration attributes:

		maxta=nnn	Max number of transporter processes
				under the scheduler (all of them!)
		maxchannel=nnn	Max number of processes with this
				same "channel"
		maxring=nnn	Max number of processes with this
				set of threads (= this thread-ring)
		idlemax=time	How long the non-active (idle)
				transporter processes are allowed
				to keep around..
		overfeed=nnn	Max number of tasks to feed from
				the thread to the transporter agent
				when feeding jobs to it.
				The scheduler main-loop at the mux()
				is a bit sluggish, thus with this
				we can keep the transporters busy.
		ageorder	Default is to randomize the order
				of tasks at the queue, when it is
				started, with this the order is that
				of the original spool-file MTIME.
				Oldest first..

	Former configuration flags 'byhost', 'maxhost', and
	'gangschedule' have been removed, however their
	functionality is now inherent to the thread-ring/thread
	structures. (And is, in effect, always turned on..)
	EXISTENCE OF THEM WILL CAUSE THE SCHEDULER TO ABORT!

	Former resource control option:  maxhost=nnn  has been
	removed, and only ONE transporter can process any given
	thread at any given time.  (But there can be multiple
	transporters on a thread-ring, of course..)


	To get the most out of the new scheduler, configuration
	in style of the one appended below is recommended.

----------------------------------------------------------------
#
# Scheduler configuration file
#
# The scheduler reads this file on startup or when it receives a SIGUSR1 signal
#
# Every channel/host combination in recipient addresses will be sifted through
# the clauses matched in this file, picking up parameters until a clause that
# specifies a command.  Everything is free-form with three requirements:
# Clauses (i.e. the channel/host pattern) start at the beginning of a line.
# Clause contents (i.e. the parameters) don't.
# Components are separated by whitespace.
# NB! For command paths, the "current directory" is MAILBIN/ta

# Boilerplate default parameters
*/*		interval=1m
		idlemax=2m
		# expire messages after 3 days without full delivery
		expiry=3d
		# when the scheduler gets to the end of the retry sequence,
		# it starts over at some random point in the middle.  The
		# numbers are factors of the scheduling interval.
		retries="1 1 2 3 5 8 13 21 34"
		# no default limits on simultaneous transport agents or
		# connections to a particular host
		maxchannel=0
		maxring=20
		#
		maxta=250 # SunOS has a limit of 256 FDs, don't overbook..
		#
		# skew is maximum number of tries before the retry time is
		# aligned to a standard boundary (seconds modulo interval).
		skew=1
		# default uid/gid of transport agents
		user=root
		group=daemon
#
#	Performance issues..
#
		ageorder	# If the requests should be kept in strict
				# timeorder..
		overfeed=150	# How many ``extra'' jobs to feed to the ta-
				# child when it reports ``#hungry'' ?


# Deferred delivery is handled by this transport agent.  Deferrals are low
# priority, but they tend to bunch up.  The 1 channel slot means there will
# be lots of contention, and typical checking intervals will be a bit higher
# than what is specified (due to waiting for a free slot).
hold/*		interval=5m
		maxchannel=1
		command=hold

# BITNET delivery methods

defrt1/*
		maxchannel=3
		command="sm -c $channel defrt1"

bsmtp3/*
		maxchannel=3
		command="sm -c $channel bsmtp3"

bsmtp3nd/*
		maxchannel=3
		command="sm -c $channel bsmtp3nd"
bsmtp3rfc/*
		maxchannel=3
		command="sm -c $channel bsmtp3"

bsmtp3ndrfc/*
		maxchannel=3
		command="sm -c $channel bsmtp3nd"

# Local delivery: user mail, files, processes
local/*
		interval=60s
		idlemax=90s
		expiry=3h
		# want 20 channel slots, but only one HOST
		maxchannel=20
		maxring=20
		#
		# Do MIME text/plain; Quoted-Printable -> text/plain; 8BIT
		# conversion on flight!
		command="mailbox -8"

# This is a FAST EXPIRY test case.. Will always cause bounce, btw..
smtp/*-gw.funet.fi
		maxchannel=0
		maxring=20
		expiry=1m
		interval=15s
		retries="1"
		skew=1
		command="smtp -sl /var/log/mail/smtp"

# Within FUNET we have a bit longer expiry..
smtp/*funet.fi
		maxchannel=199
		maxring=20
		# maxta=2
		expiry=14d
		interval=10m
		retries="1 1 2 3 5 8 13 21 34"
		skew=1
		# Do FORCED MIME-decoding into C-T-E: 8BIT
		command="smtp -8sl /var/log/mail/smtp"

# Within our organization we care more about speed and capacity than connections
# The maxchannel value should be larger than the value used by smtp/*, to avoid
# some potential state and phase problems in the queues.
smtp/*.fi
		maxchannel=199
		maxring=20
		interval=10m
		retries="1 1 2 3 5 8 13 21 34"
		skew=1
		command="smtp -sl /var/log/mail/smtp"

# Connections to the outside shouldn't duplicate effort so we only allow one
# per destination.
smtp/*
		maxchannel=199
		maxring=20
		command="smtp -sl /var/log/mail/smtp"

# Error messages.  Delivery can be retried at leisure.
error/*		interval=5m
		idlemax=2m
		maxchannel=10
		command=errormail

# UUCP delivery.  The "sm" transport agent picks the first host it sees and
# will select further recipient addresses with that host only.  We tell
# the scheduler this with the "byhost" boolean, to avoid a staggered delivery
# effect if the scheduler has to discover this on its own.
uucp/*		maxchannel=5
		command="sm -8c $channel uucp"

# News delivery.  Hostname is always the same here.
usenet/*	maxchannel=2
		command="sm -8c $channel usenet"

# UBC EAN X.400 gateway.  See comment at UUCP.
ean/*		maxchannel=1
		command="sm -c $channel ean"
