can I reuse NioEventLoopGroup?

385 views
Skip to first unread message

naijiang wang

unread,
Apr 17, 2013, 1:21:47 AM4/17/13
to netty
Hi netty,

I am using netty in the project, 
we need create 100 collectors( serversocket peer).

execute the following code in windows OS when create collector, 
serverBootstrap.group( new NioEventLoopGroup(), new NioEventLoopGroup() )
through cmd "netstat"
it will create 32 tcp connections.(caused in JAVA NIO,selector.open() will create a couple connecions)

so 100 collectors will create 3200 connections, it is too mcuh.

1, create 100 collectors is ok or not?
2,if it is ok, how can we reduce the tcp connections, can I write a NioEventLoopGroup factory, using singleton NioEventLoopGroup, instead of new NioEventLoopGroup().
for 100 collectors?

thank you very much.

"이희승 (Trustin Lee)"

unread,
Apr 17, 2013, 2:24:12 AM4/17/13
to ne...@googlegroups.com
Comments inline

On Wed 17 Apr 2013 02:21:47 PM KST, naijiang wang wrote:
> Hi netty,
>
> I am using netty in the project,
> we need create 100 collectors( serversocket peer).
>
> execute the following code in windows OS when create collector,
> serverBootstrap.group( new NioEventLoopGroup(), new NioEventLoopGroup() )
> through cmd "netstat"
> it will create 32 tcp connections.(caused in JAVA NIO,selector.open()
> will create a couple connecions)
>
> so 100 collectors will create 3200 connections, it is too mcuh.
>
> 1, create 100 collectors is ok or not?

OK

> 2,if it is ok, how can we reduce the tcp connections, can I write
> a NioEventLoopGroup factory, using singleton NioEventLoopGroup,
> instead of new NioEventLoopGroup().
> for 100 collectors?

Yes.


--
https://twitter.com/trustin
https://twitter.com/trustin_ko
https://twitter.com/netty_project
Reply all
Reply to author
Forward
0 new messages