If you want to use UDP multicast to distribute data between nodes in a network from for example your Java program it is important to notice that unless you have a Layer 2 switch with support for IGMP snooping the data will be sent to all ports on the switch. This will naturally affect the performance of the multicast stream and also the available bandwidth on the network.
A Layer 2 switch with support for IGMP snooping will do the expected, which is to only send the multicast data sent to a multicast group to the ports which have joined the same multicast group.
IGMP snooping is a process whereby a Layer-2 switch passively listens (or “snoops”) the Layer-3 IGMP traffic to determine which ports are interested in receiving certain multicast traffic. The switch listens for IGMP Query, Report and Leave protocol messages. If desired, IGMP snooping can be configured on a per-VLAN basis. Traffic will be dynamically forwarded only to those ports that want to receive the multicast transmission. This can significantly reduce the amount of multicast traffic passing through a Layer-2 network, thus better utilizing the available bandwidth.
If you see poor performance in your UDP multicast tests, take a look at your switch. You might find the reason right there.