Improve http performance?

"Trustin Lee (이희승)" trustin at gmail.com
Mon Mar 29 10:19:24 EDT 2010


Hi Jiming,

In non-keepalive connections, most time is spent on establishing and
closing connections, so I don't think there will be much difference in
performance.

In keepalive connections, Netty is much faster than Tomcat according to
your test result, although I'm not sure what's your definition of 'much
faster.'

I think there's enough room for even further performance improvement in
Netty's HTTP codec as you said though.  Please feel free to post some
patches if you found some hot spot and got a fix.

Thanks,
Trustin

Jiming Liu wrote:
> Hi Tee,
> 
> I tried to test the performance of Netty(3.2alpha3) and Tomcat, and
> dispointedly found that Netty is not much faster than tomcat as I expected.
> 
> The result is here,
> http://jiming.javaeye.com/blog/618026
> 
> Today, I profiled the netty example by JProfiler and found that it is
> possible to improve the performance.
> following is partial result of JProfiler, wish could be useful.
> 
> StackTrace of havest method one:
>   37.7% - 37,486 ms - 10,001 inv.
> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream
>   37.7% - 37,435 ms - 10,001 inv.
> org.jboss.netty.example.http.snoop.HttpRequestHandler.messageReceived
>   36.8% - 36,538 ms - 10,001 inv.
> org.jboss.netty.example.http.snoop.HttpRequestHandler.writeResponse
>   20.4% - 20,253 ms - 10,001 inv.
> org.jboss.netty.channel.AbstractChannel.write
>   20.3% - 20,198 ms - 10,001 inv. org.jboss.netty.channel.Channels.write
>   20.3% - 20,156 ms - 10,001 inv. org.jboss.netty.channel.Channels.write
>   19.9% - 19,733 ms - 10,001 inv.
> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream
>   19.7% - 19,546 ms - 10,001 inv.
> org.jboss.netty.channel.DefaultChannelPipeline.sendDownstream
>   19.6% - 19,453 ms - 10,001 inv.
> org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream
>   11.7% - 11,595 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageEncoder.encode
>   3.7% - 3,667 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpResponseEncoder.encodeInitialLine
>   3.4% - 3,337 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageEncoder.encodeHeaders
>   2.3% - 2,311 ms - 10,001 inv.
> org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer
>   0.7% - 738 ms - 20,002 inv.
> org.jboss.netty.buffer.DynamicChannelBuffer.writeByte
>   0.7% - 662 ms - 10,001 inv.
> org.jboss.netty.buffer.ChannelBuffers.dynamicBuffer
>   0.3% - 273 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpCodecUtil.isTransferEncodingChunked
>   7.6% - 7,560 ms - 10,001 inv. org.jboss.netty.channel.Channels.write
>   12.1% - 11,971 ms - 10,001 inv.
> org.jboss.netty.channel.DefaultChannelFuture.addListener
>   1.7% - 1,665 ms - 10,001 inv.
> org.jboss.netty.buffer.ChannelBuffers.copiedBuffer
>   0.7% - 662 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.DefaultHttpMessage.setHeader
>   0.6% - 557 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.DefaultHttpMessage.setContent
>   0.5% - 506 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpHeaders.isKeepAlive
>   0.4% - 349 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.DefaultHttpMessage.getHeader
>   0.3% - 257 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.DefaultHttpResponse.<init>
> 
> StackTrace of havest method two:
>   34.9% - 34,613 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode
>   34.8% - 34,562 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode
>   26.0% - 25,807 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeaders
>   21.2% - 21,087 ms - 40,004 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.readHeader
>   19.2% - 19,087 ms - 770,077 inv.
> org.jboss.netty.handler.codec.replay.ReplayingDecoderBuffer.readByte
>   8.8% - 8,718 ms - 770,077 inv.
> org.jboss.netty.buffer.AbstractChannelBuffer.readByte
>   5.4% - 5,318 ms - 770,077 inv.
> org.jboss.netty.buffer.DynamicChannelBuffer.getByte
>   1.8% - 1,797 ms - 770,077 inv.
> org.jboss.netty.buffer.HeapChannelBuffer.getByte
>   5.1% - 5,102 ms - 770,077 inv.
> org.jboss.netty.handler.codec.replay.ReplayingDecoderBuffer.checkReadableBytes
>   2.0% - 1,991 ms - 30,003 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.splitHeader
>   1.6% - 1,569 ms - 30,003 inv.
> org.jboss.netty.handler.codec.http.DefaultHttpMessage.addHeader
>   0.3% - 343 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpHeaders.getContentLength
>   0.3% - 293 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.DefaultHttpMessage.isChunked
>   4.4% - 4,378 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.readLine
>   0.9% - 885 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.splitInitialLine
>   0.8% - 796 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage
>   0.7% - 738 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.skipControlCharacters
>   0.7% - 696 ms - 30,003 inv.
> org.jboss.netty.handler.codec.replay.ReplayingDecoder.checkpoint(java.lang.Enum)
>   0.4% - 417 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpMessageDecoder.reset
>   0.3% - 286 ms - 10,001 inv.
> org.jboss.netty.handler.codec.http.HttpHeaders.getContentLength
> 
> 
> 
> 
> 谢谢
> 
> 刘继明
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100329/73d603d9/attachment-0001.bin 


More information about the netty-users mailing list