Foreman component

Aki Tuomi aki.tuomi at dovecot.fi
Tue Apr 19 09:55:55 UTC 2016


Hi!

I am planning to add foreman component to dovecot core and I am hoping
for some feedback:

Foreman - generic per-user worker handling component

It is responsible for managing worker pools per protocol, lifecycle
management of workers and handing out instances to others, as in, unix
socket connections.

Each time a request is made to foreman for a worker, the worker is
instantiated (if possible) and locked. Then connection is created to the
socket of the worker, and the file descriptor is returned to requestor.

When the requestor has completed the task, it's responsibility is to
close the DATA channel and also ask foreman to unlock the worker.

Components can register new workers using lib-foreman's API. Each worker
is registered with

struct foreman_worker {
    const char *protocol;
    const char *path;
    const char *version;
    unsigned int max_instances;
    unsigned int max_requests; /* how many requests one worker can handle */
    unsigned int max_idletime_secs; /* how long worker can idle */
    unsigned int max_processtime_secs; /* how long worker can process
something */
    unsigned int max_lifetime_secs; /* how long a worker can live
                       this can be exceeded if the worker
                       has work to do. */
};

/* minimum lifetime of worker: max_idletime_secs */
/* absolute maximum lifetime of worker: max_lifetime_secs +
max_processtime_secs */

The unsigned ints are optional. If they are not defined, the workers are
kept until foreman exceeds the total number of workers permitted across
pools.

Pools are per-worker-class pools, and are generated when a worker is
registered.

Version specifies the protocol version and is going to be "1000" now. 
Next version will always be 1001, 1002 etc.

Any feedback or questions are welcome!

Aki



More information about the dovecot mailing list