Filip Hanik - Dev Lists wrote:
I like the trick, it's smart, but I believe we could also achieve it
with keep alive request limits, ie, when thread count gets high, turn
off keep alive by mocking maxKeepAliveRequests="1"
ie, this way it doesn't affect the servlet and its usage of the stream.
It does it too.
int keepAliveLeft = maxKeepAliveRequests;
int soTimeout = socket.getSoTimeout();
int oldSoTimeout = soTimeout;
int threadRatio = (endpoint.getCurrentThreadsBusy() * 100)
/ endpoint.getMaxThreads();
if ((threadRatio > 33) && (threadRatio <= 66)) {
soTimeout = soTimeout / 2;
} else if ((threadRatio > 66) && (threadRatio <= 90)) {
soTimeout = soTimeout / 3;
keepAliveLeft = 1;
} else if (threadRatio > 90) {
soTimeout = soTimeout / 20;
keepAliveLeft = 1;
}
So:
- less than 33% of threads used: nothing
- less than 66%: timeout / 2
- less than 90%: no keepalive and timeout / 3
- more than 90%: no keepalive and really short timeout
Overall, I think the tricks may look cool on paper, but won't do
anything particularly useful in practice. I removed all of them after a
very short while in the APR connector.
I suppose some of it could be kept, and some could be removed (like the
timeout tweaking; however, since timeout with java.io doesn't work on
output, it won't do anything unless either a client messes with the
sending of the request header or is too slow uploading its data).
Rémy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]