Mailing List Archive

Possible work this weekend...
I'm planning to put another solid day or two into Shambhala this
weekend. Aside from fixing any open bugs which may come up, I've got
three things I'm thinking about; the last two at least have been on my
TODO list for a while, but some of them do involve (minor)
incompatible changes to the API.

If I get all this done (and perhaps even if I don't), I'm strongly
considering a feature freeze on the server core and the current module
set until the first public release after that (new modules would be
fine). If anyone thinks there's something wrong with the plan, please
let me know...

1) Attempt the change in handling of timeouts and client aborts which
I discussed earlier this week --- don't immediately longjmp() out
of module code back to http_main(); just put the connection in an
aborted state. This means that whatever code that the module may
need to clean up its work in progress will still run. (This should
make integration with the run time systems for languages other than
C a little easier, and give module writers generally a somewhat
less threatening environment).

2) Give modules a one-time initialization function, to be called once
at start time (or when the module is first loaded, if it's loaded
at run-time by something like mod_dld). Allow them to request new
AllowOverrides and Options bits at this time (so that a SetEnv
module could could add AllowOverride Environment, to govern the
placement of SetEnv directives in .htaccess files). I might want
to change the command tables as well to make the interface to this
facility little more graceful; right now, it's basically set up to
be convenient only if the bits in the "where-allowed" bitmask are
known at compile time.

3) A new strategy for managing the number of extant child processes:

This would involve putting up a scoreboard for the child server
processes, indicating their state. This would be a file in which
each child server has a few words to indicate its pid, and whether
it is waiting for a request. This allows us to then do the
following:

The root server periodically checks to see how many child servers
are waiting for a request. If there are fewer than some set
"MinFree" value, it forks off a *single* new child, and then goes
to sleep for a little while. Conversely, when a child is about to
wait for a new request, it checks the numbers of its fellow
children which are already waiting. If that's greater than
"MaxFree", it dies off. The aim here is to automatically spawn off
new servers if all of them are taken up with slow clients, without
ever reverting to full forking mode, and without keeping large
numbers of server processes idle when the server is just not busy
(which is bad, as they tend to get swapped out).

I figure we want at most one new child per second, to keep it from
going nuts in response to some transient load spike; I was going to
try MinFree and MaxFree of 5 and 20 respectively.

I can't promise I'll get to all these, and I certainly can't promise
they'll all work, but that's the plan. Any comments? [.I probably
won't start till Saturday noon, and whatever looks like the worst idea
can probably be put off...].

rst
Re: Possible work this weekend... [ In reply to ]
On Fri, 7 Jul 1995, Robert S. Thau wrote:
> I can't promise I'll get to all these, and I certainly can't promise
> they'll all work, but that's the plan. Any comments? [.I probably
> won't start till Saturday noon, and whatever looks like the worst idea
> can probably be put off...].

My only comment is: we've gone a long time without a public release, and lots
of people are looking into using Apache as a base for more advanced
programming, so the modular core couldn't be more well timed. I suggest
we make sure what we have is solid, and that the module API is stable.
Your proposed changes all seem fine, and if a code freeze on the API is
in effect this weekend, we can all hammer the hell out of it early next
week, with a target announcement date of next Thursday? At that point
we'd restart the bugs patch db, put the new version on hyperreal, post to
the newsgroups and mailing lists about it, and make the API public. How
does that sound?

Brian

--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com brian@hyperreal.com http://www.[hyperreal,organic].com/
Re: Possible work this weekend... [ In reply to ]
> 3) A new strategy for managing the number of extant child processes:
>
> This would involve putting up a scoreboard for the child server
> processes, indicating their state. This would be a file in which
> each child server has a few words to indicate its pid, and whether
> it is waiting for a request. This allows us to then do the
> following:
>
> The root server periodically checks to see how many child servers
> are waiting for a request. If there are fewer than some set
> "MinFree" value, it forks off a *single* new child, and then goes
> to sleep for a little while.

: : : :


one system I was thinking of was..

a) enable the mutual exclusion around all accepts (even on safe
systems such as SunOs and HPsUX).

b) set a signal handler (maybe SIGHUP) in the children to be a
routine which they use to signal back to the parent that they are
waiting for another child to release the lock i.e. they are idle

c) parent periodically signals the children to see which ones are
idle... if there are <X, it can spawn another child (X ~ 2 I think)

d) each child is given an alarm timeout, so that if they wait for
say >3 seconds for the lock to release, they are allowed to shutdown
and die. (if a child is idle for this long, it's almost certain that
the are too many children for the current request rate)

e) parent detects dead children as it does now, but then uses the
above signalling to determine if the child needs replacing. The parent
will also know how many active children there are, and keep this above
some minimum and below some maximum at all times.

f) when a child gets past the lock, it disables the alarm and
SIGHUP handlers so that there's at least one child always ready
to accept.



...maybe.

rob
Re: Possible work this weekend... [ In reply to ]
Date: Fri, 7 Jul 1995 11:53:11 -0700 (PDT)
From: Brian Behlendorf <brian@organic.com>

My only comment is: we've gone a long time without a public
release, and lots of people are looking into using Apache as a base
for more advanced programming, so the modular core couldn't be more
well timed. I suggest we make sure what we have is solid, and that
the module API is stable.

OK, last call for the first release....

Your proposed changes all seem fine, and
if a code freeze on the API is in effect this weekend, we can all
hammer the hell out of it early next week, with a target
announcement date of next Thursday?

Hmmm..... there are two things I'd like to see for a public release
--- a little more cross-platform testing (so far, we have SunOS, BSDi,
NetBSD, FreeBSD, what else?), and some sort of config script, however
crude, which would rewrite the Makefile and modules.c as appropriate
to allow people to slot in and take out optional modules. If that's
all in place, and if I get all the work done this weekend, the
schedule sounds doable...

rst
Re: Possible work this weekend... [ In reply to ]
> OK, last call for the first release....
>
> Your proposed changes all seem fine, and
> if a code freeze on the API is in effect this weekend, we can all
> hammer the hell out of it early next week, with a target
> announcement date of next Thursday?
>
> Hmmm..... there are two things I'd like to see for a public release
> --- a little more cross-platform testing (so far, we have SunOS, BSDi,
> NetBSD, FreeBSD, what else?), and some sort of config script, however
> crude, which would rewrite the Makefile and modules.c as appropriate
> to allow people to slot in and take out optional modules. If that's
> all in place, and if I get all the work done this weekend, the
> schedule sounds doable...
>
> rst

I agree that this thing seems very close to release quality with
exception of the problems that RobH seems to be seeing on HPsUX.
5.2 seems to be running fine on NetBSD and SunOS for me.

One thing on my wish list before the release would be to get
the logging system worked over. I have a start on this,
but will probably muddle through the weekend to get the
configurability that we have all asked for. Has anyone else
started looking at this end of the horse?

As for the crude config script... I suppose that can't be written
in perl....
Re: Possible work this weekend... [ In reply to ]
> From: Randy Terbush <randy@zyzzyva.com>
> Reply-To: new-httpd@hyperreal.com
>
> One thing on my wish list before the release would be to get
> the logging system worked over. I have a start on this,
> but will probably muddle through the weekend to get the
> configurability that we have all asked for. Has anyone else
> started looking at this end of the horse?
>
> Hmmm... there already is at least one person who has simply written a
> new logging module to get the logs in the format he wants. (This is
> Mark Cox, who's tracking click-trails based on Netscape cookies, and
> needs the custom logger to log the cookies).
>
> The only change to the current mod_common_log that I'm currently
> thinking about is to support something like
>
> Transferlog "| /my/log-postprocessor -arg foo"

I have this working as soon as I figure out spawn_child() syntax.


> (NB the hard part of this is actually testing it, which would take
> quite a bit more time than writing the code).
>
> Beyond that, I'd like to see any new logging schemes supported as new
> (optional) modules, unless there's a particularly good reason to merge
> them into the existing mod_common_log code. I'm also not sure it's a
> good idea to rush headalong into this simply to have something to show
> next week... if we're doing something radical, we should probably toy
> around with it first. (There's likely to be a bugfix respin a few
> weeks after the first Shambhala-based Apache release simply because
> the code is not perfect; that would be a reasonable time to introduce
> new optional modules).

The approach I am pursuing is the above Transferlog changes you
suggested, and an additional config parameter LogFormat that would
default to CLF. My biggest programming obstacle here is working
out the various tags for IP, date, bytes sent, etc. and optional fields.
Mark had suggested some tags in the past that were common to zsh,
I believe, that seemed reasonable to use. I also would like to allow
the ability to add Headers into the format as RobH has requested.

This has been a high priority on my personal agenda for some time.
I have managed to slot the time today to dig into this seriously.
Feedback and code-snipits welcome. I understand that this may
not make it into the first release cut.
Re: Possible work this weekend... [ In reply to ]
From: Randy Terbush <randy@zyzzyva.com>
Reply-To: new-httpd@hyperreal.com

One thing on my wish list before the release would be to get
the logging system worked over. I have a start on this,
but will probably muddle through the weekend to get the
configurability that we have all asked for. Has anyone else
started looking at this end of the horse?

Hmmm... there already is at least one person who has simply written a
new logging module to get the logs in the format he wants. (This is
Mark Cox, who's tracking click-trails based on Netscape cookies, and
needs the custom logger to log the cookies).

The only change to the current mod_common_log that I'm currently
thinking about is to support something like

Transferlog "| /my/log-postprocessor -arg foo"

(NB the hard part of this is actually testing it, which would take
quite a bit more time than writing the code).

Beyond that, I'd like to see any new logging schemes supported as new
(optional) modules, unless there's a particularly good reason to merge
them into the existing mod_common_log code. I'm also not sure it's a
good idea to rush headalong into this simply to have something to show
next week... if we're doing something radical, we should probably toy
around with it first. (There's likely to be a bugfix respin a few
weeks after the first Shambhala-based Apache release simply because
the code is not perfect; that would be a reasonable time to introduce
new optional modules).

Besides... design in haste, repent at leisure.

As for the crude config script... I suppose that can't be written
in perl....

Unfortunately, some mix of shell and perhaps (old) awk is the best we
can do and preserve the old NCSA code's portability.

rst
Re: Possible work this weekend... [ In reply to ]
>From: rst@ai.mit.edu (Robert S. Thau)
>Date: Fri, 7 Jul 95 13:55:16 EDT

>3) A new strategy for managing the number of extant child processes:
>
> This would involve putting up a scoreboard for the child server
> processes, indicating their state. This would be a file in which
> each child server has a few words to indicate its pid, and whether
> it is waiting for a request. This allows us to then do the
> following:
>
> The root server periodically checks to see how many child servers
> are waiting for a request. If there are fewer than some set
> "MinFree" value, it forks off a *single* new child, and then goes
> to sleep for a little while. Conversely, when a child is about to
> wait for a new request, it checks the numbers of its fellow
> children which are already waiting. If that's greater than
> "MaxFree", it dies off. The aim here is to automatically spawn off
> new servers if all of them are taken up with slow clients, without
> ever reverting to full forking mode, and without keeping large
> numbers of server processes idle when the server is just not busy
> (which is bad, as they tend to get swapped out).
>
> I figure we want at most one new child per second, to keep it from
> going nuts in response to some transient load spike; I was going to
> try MinFree and MaxFree of 5 and 20 respectively.

Earlier I suggested a slightly different scheme; (if anyone commented on it,
then I didn't receive their messages)

Create a new process if there are no children waiting to accept.
(i.e. MinFree = 1), up to a maximum rate of cmax.
A process dies after a (perhaps random) time tmax.

I originally suggested that tmax scale with the mean connection time.

The number of processes is limited to cmax*tmax.

It has the advantage that the server should always fall back to the quiescent
state of one parent and one child when no connections are received.
The children have a finite life as a check against resouce lossage; although
shambhala looks to be better than apache in that respect.

The main problem with any such scheme is that it _requires_ IPC.
Hence, if something like this is implemented, it should be designed around
the IPC rather than vice versa; once we have IPC there are lots of other
useful things that can be done. (Alternative accept locking, DNS caching,
logging etc.)

David.