-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, 19 Apr 2016, Aki Tuomi wrote:
Hi Aki,
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.
this is not like a multiplexor, that forwards the data between client and
worker, but Forman will pass the new fd back to the client and may close
the connection to it, right?
Like: http://man7.org/tlpi/code/online/dist/sockets/scm_rights_send.c.html
http://keithp.com/blogs/fd-passing/
When the requestor has completed the task, it's responsibility is to
close the DATA channel and also ask foreman to unlock the worker.
If the client abends, Foreman would held the worker locked forever.
Workers should notify their Foreman, that they are ready to take another
task. Or, when a new client wants to make a connection to a worker,
Foreman could probe unlocked workers first, then locked workers, if they
are available. So the "locked" state is more a soft rather than a hard
condition.
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
- --
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEVAwUBVxcVKnz1H7kL/d9rAQJEnAf9H7qUT5AGVaaUkuRO24rtymCxGa2Pqupl
jyYARY4P7hwUVohe+f4WeaPtppq7hzpzpJeVsh3oSsDOm1q96SFGzlGMZALurW78
P4Yqn0OwJXAfGF6g/84PKd+kNum+a9aXVOjHcGMsqpXg8UlVTnz3NrrrG/sGdKna
4cLOlorrITQ38Mo/bjPBxP2BMhUhGRib8pIk6fND25OOJwN0NH420AvXOl80aGa6
a6jJhE80qHaAWDwhpU8Oj09AvD8/WNY172Bg7UjHQhrczQKRRp4dGWIDXVMnm2wd
HK9MriOubvdZ4hcSs56W0GsFnY/p8saT+e+94ruT8OPbUrEyYFu1zg==
=B3I3
-----END PGP SIGNATURE-----