Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 25188 invoked from network); 15 Feb 2006 23:43:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Feb 2006 23:43:00 -0000 Received: (qmail 385 invoked by uid 500); 15 Feb 2006 23:42:41 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 261 invoked by uid 500); 15 Feb 2006 23:42:41 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 99987 invoked by uid 99); 15 Feb 2006 23:42:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 15:42:40 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of trustin@gmail.com designates 64.233.182.207 as permitted sender) Received: from [64.233.182.207] (HELO nproxy.gmail.com) (64.233.182.207) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2006 15:42:39 -0800 Received: by nproxy.gmail.com with SMTP id l23so20793nfc for ; Wed, 15 Feb 2006 15:42:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=M5QoGOGav1zXWuhatwkxzL7uljUpmYaHA8vvaxjQ5WEDs3kPBOCFKlWygTibZJ1Wls/lbfI6z5UdzTeesAm2110IDuZH/BTJshqv23hqFqqzzP8BlqBAWTX8CHhNlTwcNNBYFeuW+fm/2gpCwd1qiJ7P1wd49LIrjg+1xEAVCeQ= Received: by 10.49.80.12 with SMTP id h12mr40122nfl; Wed, 15 Feb 2006 15:42:18 -0800 (PST) Received: by 10.49.64.18 with HTTP; Wed, 15 Feb 2006 15:42:18 -0800 (PST) Message-ID: <768dcb2e0602151542g5e74902aw58f94ac33cbe0dd3@mail.gmail.com> Date: Thu, 16 Feb 2006 08:42:18 +0900 From: Trustin Lee To: Apache Directory Developers List Subject: Re: [mina] Socket IO processor, thread problem. In-Reply-To: <000501c63287$a7e5b220$0300a8c0@fedechiccowinxp> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9404_28409290.1140046938086" References: <510E6791-0FD2-49CB-9736-39261BBB367C@stain.org> <001901c6326d$0d252500$0300a8c0@fedechiccowinxp> <43F3A16E.7030203@trillian.se> <000501c63287$a7e5b220$0300a8c0@fedechiccowinxp> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_9404_28409290.1140046938086 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Fedechicco, On 2/16/06, fedechicco@gmail.com wrote: > > I tried to change mina.socket.processor property to a polite value of 10 > (on > a mono processor, for an average of 1000 sockets), and it was like I > hoped. > Actually it is useless to increase the mina.socket.processor, on my mono > CPU > obviously. > Now I tried to set false the SO_KEEP_ALIVE, I thought that on 1000 > sockets > it can be an enormouse series of little useless packets that make the > selector work. > But I don't think that this can be the right solution. I don't think so, either. I'm not sure that the selector is the cause of the CPU leak, I only see on > the profiler that the poll() method of selector take the 99% of the time, > but I think that my profiler do not analyze the time spent waiting for > data > from the time spent in other activities. > Said that I'm not sure that the fault is of selector, but all the other > classes take a ridiculus part of the cpu time ( less than 1% ). Why don't you count the calls? If the count of Selector.select() calls is exceptionally high, it means that the selector is behaving wrong. Can you reproduce this problem easily? I experienced this problem only in Windows very rarely. I found that Selector.selector() returns immediately returning '0' even though I didn't call any Selector.wakeup(); it was an apparent JDK bug. Please use the profiler to cound the number of calls. It will help us to debug the problem. If it's easy to reproduce it by myself with one or two commodity PCs, I can test it by myself and track down the problem. I'd like having a profiler that can distinguish between wait() and used > time, I'm using M10 integrated in NetBeans, somebody can advice me a > better > profiler? YourKit profiler is the best profiler I have ever used, but I think it also cannot distinguish it because the Selector implementation doesn't use Object.wait() at all. You have to count the calls anyway. Finally, I must to send many ( the usual number of 1000 ) little > pre-prepared bytebuffers, and I initially wrote them one-by-one, but my > tests went better (not good, but better) since I have done my own cicle > that > put all the little buffers in one big buffer, and then write() only the > big > bytebuffer. > So, the non-written bytebuffers are no more recollected in a single big > bytebuffer before to send them to the SocketChannel? What do you mean by 'recollected'? Does it mean 'pooled'? They (small buffers) are pooled if you call ByteBuffer.release() explicitly in case you didn't pass (write) them to MINA. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ PGP Key ID: 0xFE954E7E ------=_Part_9404_28409290.1140046938086 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Fedechicco,

On 2/16/06, fedechicco@gm= ail.com <fedechicco@gmai= l.com > wrote:
I tried to change mina.socket.processor property to a polite value of = 10 (on
a mono processor, for an average of 1000 sockets), and it was like I ho= ped.
Actually it is useless to increase the mina.socket.processor, on my= mono CPU
obviously.
Now I tried to set false the  SO_KEEP_= ALIVE, I thought that on 1000 sockets
it can be an enormouse series of little useless packets that make theselector work.
But I don't think that this can be the right solution.<= /blockquote>

I don't think so, either.

I'm not sure that the selector is the cause of the CPU leak, I only see on<= br>the profiler that the poll() method of selector take the 99% of the time= ,
but I think that my profiler do not analyze the time spent waiting for= data
from the time spent in other activities.
Said that I'm not sure that= the fault is of selector, but all the other
classes take a ridiculus pa= rt of the cpu time ( less than 1% ).

Why don't you cou= nt the calls?  If the count of=20 Selector.select() calls is exceptionally high, it means that the selector i= s behaving wrong.

Can you reproduce this problem easily?  I exp= erienced this problem only in Windows very rarely.  I found that Selec= tor.selector () returns immediately returning '0' even though I didn't call any Selector= .wakeup(); it was an apparent JDK bug.

Please use the profiler to co= und the number of calls.  It will help us to debug the problem.  = If it's easy to reproduce it by myself with one or two commodity PCs, I can= test it by myself and track down the problem.

I'd= like having a profiler that can distinguish between wait() and used
tim= e, I'm using M10 integrated in NetBeans, somebody can advice me a better
profiler?

YourKit profiler is the best profiler I = have ever used, but I think it also cannot distinguish it because the Selec= tor implementation doesn't use Object.wait() at all.  You have to coun= t the calls anyway.

Fin= ally, I must to send many ( the usual number of 1000 ) little
pre-prepar= ed bytebuffers, and I initially wrote them one-by-one, but my
tests went better (not good, but better) since I have done my own cicle= that
put all the little buffers in one big buffer, and then write() onl= y the big
bytebuffer.
So, the non-written bytebuffers are no more rec= ollected in a single big
bytebuffer before to send them to the SocketChannel?
<= br>What do you mean by 'recollected'?  Does it mean 'pooled'?  Th= ey (small buffers) are pooled if you call ByteBuffer.release() explicitly i= n case you didn't pass (write) them to MINA.

HTH,
Trustin
--
what we call human nature is = actually human habit
--
http://gle= amynode.net/
PGP Key ID: 0xFE954E7E ------=_Part_9404_28409290.1140046938086--