Re: [PREVIEW] -M command line option

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Thu, 20 Feb 2014 10:51:00 -0700

On 02/14/2014 05:24 AM, Amos Jeffries wrote:
> Just to kick this further along. I've put together the proposal in patch
> form.
>
> Anyone game to test the SMP support is working properly with "-M
> foreground" when this is applied?

Not me, but it should be tested before commit IMO.

> I'm also beginning to think we are needing to add getopts_long() support
> and just use "--foreground" for the no-daemon mode.

I think it is best to keep these options grouped. If you add long
options support, use --run-mode <mode> or similar.

> - " -N No daemon mode.\n"
> + " -M mode Operational mode for the service daemon.\n"
> + " Modes:\n"
> + " background - run as a background service with a\n"
> + " master process for auto-restart.\n"
> + " This is the default mode.\n"
> + " foreground - run in foreground. Rely on calling process\n"
> + " for error recovery on process failures.\n"
> + " -N Deprecated. Disables SMP support and implies '-M foreground'.\n"

I believe the following behavior and documentation would be better
because they

* present a full set of useful options;
  (making it easier for admins to grasp the difference/tradeoffs)
* avoid "auto-restart" and "error recovery" terms in confusing contexts
* do not mix -N with "-M foreground" (the two are mutually exclusive,
  not one mode implemented on top of another)

-M mode Squid process management behavior. Supported modes are:

  background: Run master process as a background daemon
              (i.e., return control to the calling process ASAP).
              Start dedicated worker and other kid processes as needed.
              Restart crashed kid processes.
              This is the default.

  foreground: Run master process in the foreground
              (i.e., return control to the calling process on exit).
              Start dedicated worker and other kid processes as needed.
              Restart crashed kid processes.
              This is useful for systemd scripts.

  monolith: Run master process in the foreground.
              Use the master process as the only worker process. No SMP.
              This is useful for debugging.

-N Deprecated. Same as "-M monolith".

The "(i.e., ...)" and even "This is useful for ..." clarifications can
be removed if you think they are useless.

Again, I would not object to other configuration approaches that give
the same functionality. For example:

-M mode Squid process management behavior. Supported modes are:

  background: Run master process as a background daemon
              (i.e., return control to the calling process ASAP).
              Start dedicated worker and other kid processes as needed.
              Restart crashed kid processes.
              This is the default.

  foreground: Run master process in the foreground
              (i.e., return control to the calling process on exit).
              Start dedicated worker and other kid processes as needed.
              Restart crashed kid processes.
              This is useful for systemd scripts.

-N Run master process in the foreground.
              Use the master process as the only worker process. No SMP.
              This is useful for debugging.

However, I think we should implement all of the above modes as one patch
rather than kill a useful mode (current -N behavior) now and then wait
for another patch to reinstate it eventually.

Even if you reject all these versions, please at least note that the
foreground definition in the patch leaves "process" unqualified in the
context with other "processes", which is confusing and should be polished.

Thank you,

Alex.
Received on Thu Feb 20 2014 - 17:51:17 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 21 2014 - 12:00:15 MST