> 1) Netty has multiple worker threads which will decode the network message
> and send it to a player session. The sessions event dispatcher will take it
> and dispatch it to the appropriate event handler. If I use disruptor for
> event dispatch, then each worker thread becomes a producer. Are multiple
> producers allowed in disruptor? Are there any code samples showing multiple
> producers?
Multiple producers are allowed in the Disruptor. We have the
MultiThreadedClaimStrategy specifically for this purpose. This is the
default strategy, so you don't need to do anything special in order to
support multiple producers.
> 2) If multiple producers are an anti-pattern, does anybody know how to make
> it single for Netty? I really dont want to write my own nio code.
It's not an anti-pattern, however the SingleThreadedClaimStrategy does
performance better due to reduced contention. Unfortunately I don't
know enough about Netty in order to make it run with a single thread.
I'm currently working on some changes to improve the performance of
the multi producer case which should be included in the next release.
Mike.