Networking and Disruptor

276 views
Skip to first unread message

Rajiv Kurian

unread,
Apr 30, 2013, 6:40:40 PM4/30/13
to lmax-di...@googlegroups.com
I am new to the Disruptor framework and discovered it through a talk by Martin and Michael. The talk covered how the network was a single producer, with multiple consumers in a custom topology. I could not quite understand how the network could be a single producer given multiple clients, connections etc. 

What kind of a topology do people use when connecting Disruptor to a traditional JVM networking solution like Netty where there are multiple producers?

Michael Barker

unread,
Apr 30, 2013, 6:55:45 PM4/30/13
to lmax-di...@googlegroups.com
> I am new to the Disruptor framework and discovered it through a talk by
> Martin and Michael. The talk covered how the network was a single producer,
> with multiple consumers in a custom topology. I could not quite understand
> how the network could be a single producer given multiple clients,
> connections etc.

All of the data for those connections will come through a single
point. The network interface. So it is not strictly true that you
will have a single producer for your network traffic, but
possibly/probably one per network interface.

> What kind of a topology do people use when connecting Disruptor to a
> traditional JVM networking solution like Netty where there are multiple
> producers?

We have a thread per network interface. We recently reduced the
number of network buses that we receive messages on from 2 to 1 to
allow us to move to a strict single producer model. Other may do it
differently.

Mike.

Rajiv Kurian

unread,
Apr 30, 2013, 8:05:53 PM4/30/13
to lmax-di...@googlegroups.com
I see. So a thread that blocks if there is nothing on the wire?

Thanks,
Rajiv

Rajiv Kurian

unread,
Apr 30, 2013, 10:19:47 PM4/30/13
to lmax-di...@googlegroups.com
I am still not sure what you mean by a thread per network interface. If two different clients connect to your server, wouldn't you have two threads and thus two producers?

Thanks,
Rajiv

On Tuesday, April 30, 2013 3:55:45 PM UTC-7, mikeb01 wrote:

Michael Barker

unread,
Apr 30, 2013, 10:33:41 PM4/30/13
to lmax-di...@googlegroups.com
It depends on how you set up your networking. You can multiplex
multiple connections into a single server thread using non-blocking
I/O. This is how the messaging framework we use for the majority of
network communications is set up. If you are using a thread per
connection model, then you could run with a Disruptor per thread or
have multiple threads accessing a single Disruptor (in which case you
would have multiple producers).

There are advantages and disadvantages to each approach.

Mike.
> --
> You received this message because you are subscribed to the Google Groups
> "Disruptor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to lmax-disrupto...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Rajiv Kurian

unread,
Apr 30, 2013, 11:47:10 PM4/30/13
to lmax-di...@googlegroups.com
Thank you Mike.
Reply all
Reply to author
Forward
0 new messages