Optimizing Netty for fast socket accept/creation

Carl Byström cgbystrom at gmail.com
Thu Jul 9 11:32:54 EDT 2009


Hi again!

On Wed, Jul 8, 2009 at 9:47 AM, "이희승 (Trustin Lee)" <trustin at gmail.com>wrote:

>
> I increased the number of acceptor threads like the following:
>
>    for (int i = 0; i < 2; i ++) {
>        bossExecutor.execute(new IoWorkerRunnable(
>                new ThreadRenamingRunnable(
>                        new Boss(channel),
>                        "New I/O server boss #" + id + '-' + i +
>                        " (channelId: " + channel.getId() +
>                        ", " + channel.getLocalAddress() + ')')));
>    }
>

Did I miss something obvious here? But how would I make two threads
(processes) bind to the same address?


>
> and was indeed able to get much better result.  However, increasing the
> number of acceptor threads to 3 or 4 did not help much.  Do you have the
> same experience with your workaround?  Could you apply this modification
> to see how the modified Netty performs comparing to your workaround?
>

Yeah, tried listening on two ports and using the example HTTP server.
Ran two tests simultaneously with ApacheBench, yielding the same results in
both processes (in terms of req/s and response time).
I essentially doubled the performance by doing this.
However, increasing it to 3 ports the response time started dropping.
Perhaps have something to do with that accept lock in Java NIO? Another
thing worth noticing was that I was unable to saturate my CPUs fully.
Tried this on RHEL5 (8 cores) and Mac OS X (2 cores).

- Carl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090709/535e29a8/attachment.html 


More information about the netty-users mailing list