Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] NIO inefficiency?

Hi,

On Fri, Aug 9, 2013 at 1:39 PM, Viktor Szathmary <phraktle@xxxxxxxxx> wrote:
> I did give this async sampler a shot previously, but it's a bit tricky to
> manage (far from the comfortable profiling tools :). I couldn't obtain Sun
> Studio Analyzer.

Free Download from
http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html.

> In any case, it didn't seem to indicate NativeThread.currentThread, but the
> NIO writes were clearly a hotspot, for example:
> sun.nio.ch.FileDispatcherImpl.write0 and
> sun.nio.ch.FileDispatcherImpl.writev0
>
> What certainly seems to be clear and agreed on by all profiling methods is
> that the org.eclipse.jetty.io.AbstractEndPoint.write (triggered by the flush
> / close operations) is expensive and that it spends most of its time in
> native code somewhere – NativeThread.current or FileDispatcherImpl.write*,
> depending on how much you believe profilers ;)

Sure, it is writing the bytes (note also that we're talking the 2% of
your CPU time here - any improvement here will probably have little
effect on the total time).

> At this level profiling tools at my disposal make it difficult to trace this
> further down accurately – but in any case, this is all within the realm of
> the JDK/pthreads/kernel, so can't really optimize that directly (though it
> would be nice to understand what's actually happening :).
>
> Thus my question is more along the lines if there's a way in Jetty to reduce
> the number of these calls. I'm not familiar enough with the codebase to tell
> – but it would seem reasonable to combine the last flush and the close
> operations for example…

We already try our best to use gather writes and write buffering to
reduce the number of calls to SocketChannel.write().
Sure we can improve in certain spots, but I am not sure what you refer
to with "combine the last flush and the close operations".
Can you expand ?

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.


Back to the top