librelist archives

« back to archive

[RFC] process and task management

[RFC] process and task management

From:
Loic d'Anterroches
Date:
2011-06-29 @ 10:18
Hello,

after quite some thinking, not necessarily very "smart", I think it
would be good to remove the current way to "$ hnu server start" spanning
tasks and processes and expecting the main process to control the children.

The problem is that controlling the children is a hard job, many tools
are already doing it and you end up with something like:

init -> upstart -> processcontroller -> photon -> children

where in fact, a well designed process controller could be idempotent,
restarted if needed from cron every 60s (worse case scenario) and
control each photon process.

A simple example I cannot solve nicely with the current approach is when
the master server die (kill -9) and the forked children keep running.
When the process manager launch the master again, we have children out
of control.

The good side of the master/workers approach is that you consider the
master to be there, that is, the workers can connect to the master for
the control port. The control port is a good way to provide stats etc.

We can easily replace the hnu server start with a small script launching
them in series (with one pid file per process).

The rationale is that I am building a distributed process controller. At
the moment, everything is under one VM, but now, for baregit I need to
have some tasks running on multiple VM to serve one "application". The
unit of work is not the application but each photon process (be it a web
handler for mongrel2 or a task for background processing).

When you start to distribute, where you start a task or an handler is
not the problem, you only need to have access to the resources
(input/output). For example you can have one application with 4
processes — 3 handlers and 1 background task — distributed over 4 VMs
with mongrel2 itself on a fifth.

It also means that when you put a new version in production, you need to
push the new code on 4 VMs and restart the 4 processes.

So, my idea is to have when deploying on a system the basic building
block being "a photon process". Each one beeing independent of the
others. It would be possible to have a "controller" process defined
(think the current master), but it would be only for statistics.
Kill/restart should be handled by the process manager.

The server code would be simpler too, which is always a good thing.

Questions? Ideas? Remarks?

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com