tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darius D." <>
Subject Re: APR connector pollTime defaults are strange in tomcat6/7
Date Fri, 22 Jul 2011 12:49:06 GMT

Darius D. wrote:
> Does Tomcat APR really needs pollTime set so low by default? I thought
> timeout is meant for some sort of book keeping, where is all connections
> in FD set are "idle", no events come for timeout period - you force
> timeout and do bookkeeping - on a busy system you will get events anyway
> cause of socket traffic. Also connection timeout is 60s by default, so
> ending connection @ 2ms precision is not enhancing latency in any way.
> I think defaults should be increased to something reasonable like 100ms
> (pollTime ="100000") to avoid unneeded wakeups (and wakeups are bad, cause
> they cause context switch, and context switches pollute caches, TLB
> buffers and on modern servers burn electricity by forcing CPUs from low C
> states )

I guess there is no interest in efficiency and reducing overhead with APR
connectors? Overhead is quite substantial. Consider the following - on a
lightly loaded system we were seeing ~1.8k timer interrups and context
switches with Linux 2.6.39 kernel and latest Tomcat 7 + 1.20 TCNative + APR.
And its easy to see where from they are coming - 3 connector (AJP 8009,
HTTP, HTTPS) , all APR, all 2000 microseconds PollTime. So we were getting
~500x3 context switches from all those epoll_wait(...,2ms) calls. And they
were just burning CPU and polluting caches.

After switching to NIO connectors on same system and same load CS and
interrupts are down to ~600.
( note that to reproduce this you need a system with NO_HZ kernel and HPET
to actually get a epoll_wait timeout of 2000us instead of ~1/HZ (10ms on
100HZ kernel ) minimum on normal kernels )

I have attached screenshot from munin irq stats display. irqstats-week.png 

So results are pretty obviuos.
View this message in context:
Sent from the Tomcat - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message