Very high client CPU usage

"Trustin Lee (이희승)" trustin at gmail.com
Mon Mar 8 04:37:51 EST 2010


Hi David,

David Alves wrote:
> Hi again 
> 
> Forgot to say that the average cpu consumption (normalized) for two
> clients and one server is 75% fo each client and 60% for the server. I
> suppose the other 25% percent of the time in clients must be being spent
> waiting for the TCP stack to to flush, no?

Maybe, but I'm not 100% sure since there's not enough information.

> On Feb 25, 2010, at 12:04 PM, David Alves wrote:
> 
>> Hi
>>
>> I'm having some trouble. While doing some large scale testing I'm
>> finding out that I require 2 or 3 clients to overload a server. All
>> the machines are the same.
>> I't seems that frame decoding is much more efficient than encoding.
>> I've been profiling and here are the hotspots:
>>
>>     * 15.4% - 797 s org.jboss.netty.buffer.ChannelBufferOutputStream.
>>       (line\: 49) 16.9% - 898 s
>>       org.jboss.netty.buffer.ChannelBuffers.dynamicBuffer (line\: 49) 
>>     * 15.8% - 896 s org.jboss.netty.channel.Channels.write (line\: 70) 
>>     * 18.6% - 1,083 s
>>       java.util.concurrent.ThreadPoolExecutor$Worker.runTask (line\: 908)
>>
>> I've changed my code so that I don't use executors for better
>> profiling (they got mixed up with netty's). While the last two are
>> expected, is it really necessary to spend so much time on buffer
>> creation? I'm I doing something wrong?

Dynamic buffer creation doesn't take much longer than simple byte array
creation.  Maybe the profiler is showing wrong numbers or the
application is fast enough already.  If buffer creation is really a
problem, you will have to find a way to pool buffers efficiently.

>> All in all 76.2% of the time is spent creating the buffer and 23.7% on
>> the actual NIOWorker + Boss, actual write (5% spent in Unsafe). Of
>> those first 76.2% my own code (object creation, lists and sych blocks)
>> is accountable for about 30%.
>> I show the frame encoder at the end of the email. My questions are:
>> what can I do to speed things up? What am I doing wrong? Is it really
>> normal to have a two or three to one resource consumption ratio
>> between writers and readers?

Although it's not always true, it is often encoding that takes more time
than decoding from my experience.  However, if encoder is optimized very
carefully, the ratio should get close to 1:1.

HTH,
Trustin

-- 
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/20100308/30cc5e97/attachment.bin 


More information about the netty-users mailing list