You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/02/15 04:19:27 UTC

roy's l_c perf patch and spareservers

I put Roy's l_c perf patch on HotWired's servers for a few hours... but
the FIN_WAIT_2s flew through the roof, so I had to go back to
-DNO_LINGCLOSE.  (IRIX 5.3).  There was some speculation that this might
help the FIN_WAIT_2 situation, but it doesn't look like it.  As far as
performance goes I didn't really get a chance to compare, I'll try again.

One idle thought I had was that we might try playing with the order of
things -- do the shutdown(sd,1) after a select() timeout or a successful
read(). 

The other thing I found, just like Chuck said a while back, I played with
the Min/MaxSpareServers settings and removed all the huge spikes from my
load averages.  The change in load *could* be related to locality of
reference in the L2 cache, but I'm not convinced that is the only thing.
We're talking a difference of 50% vs 20% "cpu usage" as reported by the
status module.  (I'd really like to revamp status to do 5 minute rolling
averages.)

Dean


Re: roy's l_c perf patch and spareservers

Posted by Chuck Murcko <ch...@topsail.org>.
Marc Slemko wrote:
> 
> On Sat, 15 Feb 1997, Chuck Murcko wrote:
> 
> > excessive forking and lousy response on load spikes; making Max too high
> > results in wasted machine resources. It's just solving a limit problem
> 
> Did you notice making max too high hurting anything if you have enough RAM
> to keep all the child processes in memory?  ie. is it just the extra
> footprint of the extra child or is there actually some interaction going
> on between the children that gets worse as the numbers increase?

No special or weird effects happen from having too many child httpds
around, just the usual lack of resources for any CGIs that run, or other
stuff running on the same machine. There's nothing inherently bad about
having a lot of children around unless you need the memory for something
else.
-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org

Re: roy's l_c perf patch and spareservers

Posted by Dean Gaudet <dg...@arctic.org>.
My machines regularly show 20Mb free RAM even during peak loads.
(I'm using IRIX's osview command to get that figure.)

I suspect that the extra number of children blows the L2 cache so that
you spin too many cycles causing the cache to repop.  In my case these
aren't super-high-end SGIs, they're just IP22 Challenge Ss, and I think
the L2 is only 1Mb (real ram is 128Mb).  I'm pulling that figure
out of my butt based on what the same generation of Sparcs have.

I'm not convinced that's the only reason.  As I mentioned, I saw a change
from 50% to 20% cpu just by losing 20 spare children on average.

I should go stick some child creation/death logging code in. 

Dean

P.S. IdleOptimizationThought: It's too bad we can't better control who
gets to go into accept() 'cause we'd get the best locality using LIFO.
Starvation is good in this case.

On Sat, 15 Feb 1997, Marc Slemko wrote:

> On Sat, 15 Feb 1997, Chuck Murcko wrote:
> 
> > excessive forking and lousy response on load spikes; making Max too high
> > results in wasted machine resources. It's just solving a limit problem
> 
> Did you notice making max too high hurting anything if you have enough RAM
> to keep all the child processes in memory?  ie. is it just the extra
> footprint of the extra child or is there actually some interaction going
> on between the children that gets worse as the numbers increase?
> 
> 


Re: roy's l_c perf patch and spareservers

Posted by Marc Slemko <ma...@znep.com>.
On Sat, 15 Feb 1997, Chuck Murcko wrote:

> excessive forking and lousy response on load spikes; making Max too high
> results in wasted machine resources. It's just solving a limit problem

Did you notice making max too high hurting anything if you have enough RAM
to keep all the child processes in memory?  ie. is it just the extra
footprint of the extra child or is there actually some interaction going
on between the children that gets worse as the numbers increase?


Re: roy's l_c perf patch and spareservers

Posted by Chuck Murcko <ch...@topsail.org>.
Marc Slemko wrote:
> 
> On Fri, 14 Feb 1997, Dean Gaudet wrote:
> 
> >
> > The other thing I found, just like Chuck said a while back, I played with
> > the Min/MaxSpareServers settings and removed all the huge spikes from my
> > load averages.  The change in load *could* be related to locality of
> > reference in the L2 cache, but I'm not convinced that is the only thing.
> > We're talking a difference of 50% vs 20% "cpu usage" as reported by the
> > status module.  (I'd really like to revamp status to do 5 minute rolling
> > averages.)
> 
> Played in what way?  Just increased them both?

Sort of. Start with Min/Max set to a factor of 2 difference, say, 4/8.
Double 'em until the CPU percentage indicated in the status display
drops no further (or only a little), and then leave 'em there. The
original ratio of 1/2 can be tuned up for servers under higher load, or
down for those under lower loads. Dropping Min too low results in
excessive forking and lousy response on load spikes; making Max too high
results in wasted machine resources. It's just solving a limit problem
iteratively. An initial ratio of 1/2 worked best for my moderate to high
loads.

You have to let the machine run a while, how long depends on time of day
if the load varies in the usual sinusoidal way over each 24 hr. period,
and how well you can extrapolate. 8^)
-- 
chuck
Chuck Murcko
The Topsail Group, West Chester PA USA
chuck@topsail.org

Re: roy's l_c perf patch and spareservers

Posted by Dean Gaudet <dg...@arctic.org>.
Oh yeah, once I have the patch from SGI for FIN_WAIT_2 timeouts I can test
the performance of Roy's patch... but right now I can't really afford
death by FIN_WAIT_2.

Dean

On Fri, 14 Feb 1997, Marc Slemko wrote:

> On Fri, 14 Feb 1997, Dean Gaudet wrote:
> 
> > I put Roy's l_c perf patch on HotWired's servers for a few hours... but
> > the FIN_WAIT_2s flew through the roof, so I had to go back to
> > -DNO_LINGCLOSE.  (IRIX 5.3).  There was some speculation that this might
> > help the FIN_WAIT_2 situation, but it doesn't look like it.  As far as
> > performance goes I didn't really get a chance to compare, I'll try again.
> 
> Most important is the performance comparisons between the old
> lingering_close and the one with Roy's patch, although I guess the
> difference between no l_c and the new l_c tells other things that are more
> important in the long-term analysis.
> 
> > 
> > One idle thought I had was that we might try playing with the order of
> > things -- do the shutdown(sd,1) after a select() timeout or a successful
> > read(). 
> 
> Umm... I'm not sure that is nice.  The half close is the only way for the
> client to know that we are terminating the connection.  If we don't do it
> until later, the client won't know that the connection has been closed.
> If the client doesn't know the connection is closed, it can't close its
> half.  That would extend the lifetime of _all_ connections beyond what it 
> is right now even with lingering_close.
> 
> > 
> > The other thing I found, just like Chuck said a while back, I played with
> > the Min/MaxSpareServers settings and removed all the huge spikes from my
> > load averages.  The change in load *could* be related to locality of
> > reference in the L2 cache, but I'm not convinced that is the only thing.
> > We're talking a difference of 50% vs 20% "cpu usage" as reported by the
> > status module.  (I'd really like to revamp status to do 5 minute rolling
> > averages.)
> 
> Played in what way?  Just increased them both?
> 
> 


Re: lingering_close and performance

Posted by Marc Slemko <ma...@znep.com>.
On Mon, 17 Feb 1997, Ed Korthof wrote:

> Sorry I've been uninvolved for the past week and a half; I've been too
> busy to deal with the topics going on effectively.  I like the solutions
> to the lingering_close problem which I've seen discussed here; for all
> that I think the performance hit is a potential problem (20% is not
> overstating it under certain conditions), functionality is also relevant. 
> 
> One thing comes to mind about the SIGHUP problem I've been seeing -- it
> appears that it may go away when Apache is compiled with NO_LINGCLOSE.  I
> can't test this easily, because none of the servers I administer have
> sufficient relative traffic (this problem was easy to reproduce under high
> traffic, but almost non-existent under low traffic).  But someone (I can't
> seem to find the mail) mentioned possible problems in some version of
> lingering_close, and I figured I'd mention it.  If there was a problem in
> l_c where SIGHUP was blocked, this would explain why and when the bug
> occured, as well as why it isn't reproducible except under high load.

I don't think a HUP should be blocked by anyting l_c is doing.  In any
case, I see the same problem with 1.1.  We _shouldn't_ be loosing signals
from what I understand, but if the OS is it would make sense that it
happens when there are many more children running.  I have never had a
case where a second HUP to the child didn't fix it.  Would be interesting
to add some debugging to my kernel to trace what processes signals are
sent to.  I would not be suprised to learn that the cause of the problem
is something else, but....


lingering_close and performance

Posted by Ed Korthof <ed...@organic.com>.
Sorry I've been uninvolved for the past week and a half; I've been too
busy to deal with the topics going on effectively.  I like the solutions
to the lingering_close problem which I've seen discussed here; for all
that I think the performance hit is a potential problem (20% is not
overstating it under certain conditions), functionality is also relevant. 

One thing comes to mind about the SIGHUP problem I've been seeing -- it
appears that it may go away when Apache is compiled with NO_LINGCLOSE.  I
can't test this easily, because none of the servers I administer have
sufficient relative traffic (this problem was easy to reproduce under high
traffic, but almost non-existent under low traffic).  But someone (I can't
seem to find the mail) mentioned possible problems in some version of
lingering_close, and I figured I'd mention it.  If there was a problem in
l_c where SIGHUP was blocked, this would explain why and when the bug
occured, as well as why it isn't reproducible except under high load.

Also, earlier I said I'd work on a generalized way to avoid multiple calls
to mod_browser's parse_headers_browser_module -- I believe the attatched
patch does so.  Other modules should be able to make use of the same
functionality as described in the comments; this should also work when
Apache runs as an inetd daemon.  I've tested it an it appears to work
fine.  Nice work cleaning up the loop in child_main, btw -- it's much
cleaner. :)

     -- Ed Korthof        |  Web Server Engineer --
     -- ed@organic.com    |  Organic Online, Inc --
     -- (415) 278-5676    |  Fax: (415) 284-6891 --






Re: roy's l_c perf patch and spareservers

Posted by Dean Gaudet <dg...@arctic.org>.
On Fri, 14 Feb 1997, Marc Slemko wrote:

> On Fri, 14 Feb 1997, Dean Gaudet wrote:
> 
> > One idle thought I had was that we might try playing with the order of
> > things -- do the shutdown(sd,1) after a select() timeout or a successful
> > read(). 
> 
> Umm... I'm not sure that is nice.  The half close is the only way for the
> client to know that we are terminating the connection.  If we don't do it
> until later, the client won't know that the connection has been closed.
> If the client doesn't know the connection is closed, it can't close its
> half.  That would extend the lifetime of _all_ connections beyond what it 
> is right now even with lingering_close.

Well my reasoning was this... if we happen to read() everything the client
has written before we do the shutdown(), then there's a chance we won't
trigger their tcp stack lameness that causes the FIN_WAIT_2 problem.  We
should still do the shutdown(), we just might want to do it after one
read().

> > The other thing I found, just like Chuck said a while back, I played with
> > the Min/MaxSpareServers settings and removed all the huge spikes from my
> > load averages.  The change in load *could* be related to locality of
> > reference in the L2 cache, but I'm not convinced that is the only thing.
> > We're talking a difference of 50% vs 20% "cpu usage" as reported by the
> > status module.  (I'd really like to revamp status to do 5 minute rolling
> > averages.)
> 
> Played in what way?  Just increased them both?

Decreased actually.  I had them at 32/64 and lowered them to 16/32 and
it hovers around 20 idle now.  I still get the spike when I restart the
servers -- StartServers is at 64, which is roughly the mid-day median
active servers.  It starts 64, but kills a bunch early.  I'm tempted to
hack it to not kill until it's been up for a minute.

Dean


Re: roy's l_c perf patch and spareservers

Posted by Marc Slemko <ma...@znep.com>.
On Fri, 14 Feb 1997, Dean Gaudet wrote:

> I put Roy's l_c perf patch on HotWired's servers for a few hours... but
> the FIN_WAIT_2s flew through the roof, so I had to go back to
> -DNO_LINGCLOSE.  (IRIX 5.3).  There was some speculation that this might
> help the FIN_WAIT_2 situation, but it doesn't look like it.  As far as
> performance goes I didn't really get a chance to compare, I'll try again.

Most important is the performance comparisons between the old
lingering_close and the one with Roy's patch, although I guess the
difference between no l_c and the new l_c tells other things that are more
important in the long-term analysis.

> 
> One idle thought I had was that we might try playing with the order of
> things -- do the shutdown(sd,1) after a select() timeout or a successful
> read(). 

Umm... I'm not sure that is nice.  The half close is the only way for the
client to know that we are terminating the connection.  If we don't do it
until later, the client won't know that the connection has been closed.
If the client doesn't know the connection is closed, it can't close its
half.  That would extend the lifetime of _all_ connections beyond what it 
is right now even with lingering_close.

> 
> The other thing I found, just like Chuck said a while back, I played with
> the Min/MaxSpareServers settings and removed all the huge spikes from my
> load averages.  The change in load *could* be related to locality of
> reference in the L2 cache, but I'm not convinced that is the only thing.
> We're talking a difference of 50% vs 20% "cpu usage" as reported by the
> status module.  (I'd really like to revamp status to do 5 minute rolling
> averages.)

Played in what way?  Just increased them both?