Mailing List Archive

[mod_backhand-users] KeepAlive question
Hi,

I read the performance tips about the KeepAlive, and we implemented the
patch so TCP connections within the cluster are kept. What I'm wondering
is the KeepAlive for the public client. Should this be On or Off? We
have about 3-5 million hits a day coming through one server (being
proxied to the cluster). All of the websites are mostly database driven
content. If I turn on the KeepAlive, this could potentially keep
thousands of connections open on the public server. Let's see if I can
estimate the # of connections:

5 million hits a day is rougly 58 hits per second. Obviously these are
not spread evenly throughout the day, there will generally be a bell
curve during daytime hours. So lets say there can be roughly 10x this
amount, or 580 requests per second during "busy" hours. If the KeepAlive
can potentially last for 15 seconds, that is about 8700 connections held
open at any one given time. And of course, these numbers will grow over
time as we gain clients. Am I even close in the ballpark with these
calculations? Am I better off turning off KeepAlives? (The system on
the front end is a 450mzh Sparc with Solaris 8, 1GB RAM, 100mb ethernet)

TIA
Monte
[mod_backhand-users] KeepAlive question [ In reply to ]
On Saturday, August 18, 2001, at 12:49 PM, Monte Ohrt wrote:
> I read the performance tips about the KeepAlive, and we implemented the
> patch so TCP connections within the cluster are kept. What I'm wondering
> is the KeepAlive for the public client. Should this be On or Off?

The way the patch works is that it ignores the KeepAlive Off directive
if the request has a valid BackhandProxied header (Valid being from
another machine in the cluster).

So, turn KeepAlives off on all your machines, but _do_ set the
MaxKeepAliveRequests to something like 1000 and the KeepAliveTimeout to
something like 5 seconds.

The front end machines (or any machine) that receives client-originating
requests will not use KeepAlives and thus free up an enormous number of
resources. All proxied requests will have the BackhandProxies header
and the Apache instances that serve them will keep the connection alive
(if you applied the patch) for up to five seconds after the request is
served with the expectation that another proxied request will reuse it.

--
Theo Schlossnagle
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
[mod_backhand-users] KeepAlive question [ In reply to ]
So your recommendation is to definately turn of KeepAlives on the public
side. So, MaxKeepAliveRequests should be at least the maximum number of
simultaneous requests we expect to have, is that correct? And why the 5
seconds on KeepAliveTimeout? Why not longer?


Theo Schlossnagle wrote:
>
> On Saturday, August 18, 2001, at 12:49 PM, Monte Ohrt wrote:
> > I read the performance tips about the KeepAlive, and we implemented the
> > patch so TCP connections within the cluster are kept. What I'm wondering
> > is the KeepAlive for the public client. Should this be On or Off?
>
> The way the patch works is that it ignores the KeepAlive Off directive
> if the request has a valid BackhandProxied header (Valid being from
> another machine in the cluster).
>
> So, turn KeepAlives off on all your machines, but _do_ set the
> MaxKeepAliveRequests to something like 1000 and the KeepAliveTimeout to
> something like 5 seconds.
>
> The front end machines (or any machine) that receives client-originating
> requests will not use KeepAlives and thus free up an enormous number of
> resources. All proxied requests will have the BackhandProxies header
> and the Apache instances that serve them will keep the connection alive
> (if you applied the patch) for up to five seconds after the request is
> served with the expectation that another proxied request will reuse it.
>
> --
> Theo Schlossnagle
> 1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
> 2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
>
> _______________________________________________
> backhand-users mailing list
> backhand-users@lists.backhand.org
> http://lists.backhand.org/mailman/listinfo/backhand-users

--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/
[mod_backhand-users] KeepAlive question [ In reply to ]
On Saturday, August 18, 2001, at 04:20 PM, Monte Ohrt wrote:
> So your recommendation is to definately turn of KeepAlives on the public
> side. So, MaxKeepAliveRequests should be at least the maximum number of
> simultaneous requests we expect to have, is that correct? And why the 5
> seconds on KeepAliveTimeout? Why not longer?

Many people argue. But it is my opinion that given the architecture of
Apache 1.3, keep alives should be turned off on any site that serves a
decent volume.

Set the MaxKeepAliveRequests high. The connections will be reused by
mod_backhand. Why 5 seconds? There is overhead in maintaining an open
connection the another server (the moderator must select on it). There
is also an overhead involved when establishing a connection to another
server. There is a balance. The idea that using an existing connection
is cheaper than establishing a new one makes sense if you plan on using
it. 5 seconds may be arbitrary, but I would wager you could justify an
even lower number. There is no sense in keeping around connections that
are not being used.

--
Theo Schlossnagle
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
[mod_backhand-users] KeepAlive question [ In reply to ]
I see, I was thinking that the connections could be used over and over
between the internal hosts across different client requests. Apparently
not.

Theo Schlossnagle wrote:
>
> On Saturday, August 18, 2001, at 04:20 PM, Monte Ohrt wrote:
> > So your recommendation is to definately turn of KeepAlives on the public
> > side. So, MaxKeepAliveRequests should be at least the maximum number of
> > simultaneous requests we expect to have, is that correct? And why the 5
> > seconds on KeepAliveTimeout? Why not longer?
>
> Many people argue. But it is my opinion that given the architecture of
> Apache 1.3, keep alives should be turned off on any site that serves a
> decent volume.
>
> Set the MaxKeepAliveRequests high. The connections will be reused by
> mod_backhand. Why 5 seconds? There is overhead in maintaining an open
> connection the another server (the moderator must select on it). There
> is also an overhead involved when establishing a connection to another
> server. There is a balance. The idea that using an existing connection
> is cheaper than establishing a new one makes sense if you plan on using
> it. 5 seconds may be arbitrary, but I would wager you could justify an
> even lower number. There is no sense in keeping around connections that
> are not being used.
>
> --
> Theo Schlossnagle
> 1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
> 2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
>
> _______________________________________________
> backhand-users mailing list
> backhand-users@lists.backhand.org
> http://lists.backhand.org/mailman/listinfo/backhand-users

--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/
[mod_backhand-users] KeepAlive question [ In reply to ]
On Monday, August 20, 2001, at 10:33 AM, Monte Ohrt wrote:
> I see, I was thinking that the connections could be used over and over
> between the internal hosts across different client requests. Apparently
> not.

No.. They absolutely _can_ be reused between internal hosts across
different client requests. That is the whole point.

The reason you want the keep alive timeout low is because you don't want
to keep connection to machines open and just sitting there. Sure, you
could use them later, but is it worth maintaining them on the chance
that you will use them?

The idea is that you want to be able to effectively reduce a pool of 50
connections from machine A -> B to a pool of 20 connection from A -> B.
If you have a timeout that is very high, mod_backhand will not
effectively be able to reduce the number of connections in the pool.

It is only useful to keep them around if you are actively using them. I
figure at least 1 request per second per connection. Otherwise, you
gain very little. Because mod_backhand can put requests from different
clients over the same pooled connection, it is feasible that you could
have 10s of clients connected and only one very active pooled connection
to another server. That's when it is "worth" having connection
pooling. Setting the timeout for keep alive requests low effectively
achieves that.

--
Theo Schlossnagle
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7