I'm trying to figure out how best to configure nio so that my comet
timeout events get generated in a timely manner. I have the comet
events set to generate a timeout every 50 seconds. Works fine with
few users. Under a moderate but reasonable load the timeout gets
generated on average every 113 seconds. My configuration tweaks
haven't yielded any noticeable changes (see below).
Test results...
Background:
- using JMeter
- 300 threads executing normal http requests, averaging ~9.8 requests/second.
- 300 threads executing comet requests that simply wait for the server
to close the connection every 50 seconds, averaging ~2.6
requests/second.
- server is ubuntu 8.10 running tomcat 6.0.18.
- server is not cpu constrained, averaging about 8-12% cpu
- server doesn't seem to be memory constrained. top shows 80% of
memory after hours of test (machine has 512MB physical memory and
tomcat has a max heap set to 384MB)
- network latency isn't a problem
I ran 2 tests with different configurations for the nio connector: 1
test with bare-bones settings, and 1 test with everything that seemed
like it might make a difference.
<Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol"
redirectPort="8443"
enableLookups="false" />
Ran for 3+ hours.
8-12% cpu.
12.4 requests/second.
comet requests: average response time 112 secs, min 21 secs, max 179 secs
<Connector port="80" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="1000"
minSpareThreads="200"
acceptorThreadCount="20"
acceptorThreadPriority="10"
pollerThreadCount="20"
pollerThreadPriority="10"
redirectPort="8443"
enableLookups="false" />
Ran for 1 1/2 hours.
8-12% cpu.
12.2 requests/second.
comet requests: average response time 113 secs, min 50 secs, max 133 secs
So how can I get my comet timeouts generated at close to 50 secs under load?
I thought maybe the poller thread priority was too low (does the
poller thread generate the timeouts?), but setting its priority to max
didn't change anything.
Just to make sure I wasn't doing anything dumb in my client code, I
replaced my event() method with the one below and still got the same
disparity in comet timeouts, ranging from 50 to 120 secs:
public void event(CometEvent event) throws IOException, ServletException {
HttpServletRequest request = event.getHttpServletRequest();
if (event.getEventType() == CometEvent.EventType.BEGIN) {
event.setTimeout(50000);
} else if (event.getEventType() == CometEvent.EventType.ERROR) {
event.close();
} else if (event.getEventType() == CometEvent.EventType.END) {
event.close();
} else if (event.getEventType() == CometEvent.EventType.READ) {
InputStream is = request.getInputStream();
byte[] buf = new byte[512];
do {
is.read(buf); // can throw an IOException
} while (is.available() > 0);
}
}
I just checked the priority of the thread issuing the comet timeout
event and its priority is 5. I have both the acceptor and poller
thread priorities set to 10. How can I bump up the priority of the
thread that issues the timeout events (in this case named
"http-80-exec-1")?
Thanks for any ideas,
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]