O'Reilly - Java Message Service
O'Reilly - Java Message Service
O'Reilly - Java Message Service
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Java</strong> <strong>Message</strong> <strong>Service</strong><br />
that your memory requirements are growing (possibly the result of a memory leak), which<br />
is a good start.<br />
7.2 To Multicast or Not to Multicast<br />
An increasing number of vendors are releasing products based on IP multicasting. To<br />
understand the tradeoffs involved in these products, you need a basic understanding of<br />
how the TCP/IP protocol family works, and how multicasting fits into the bigger picture. [2]<br />
We won't discuss any particular JMS implementations, or suggest that one vendor might<br />
be better than another; our goal is to give you the tools that you need to ask intelligent<br />
questions, evaluate different products, and map out a deployment strategy.<br />
[2] This is not the place for a comprehensive discussion of TCP/IP networking. If you want detailed<br />
treatment of these protocols, see Internet Core Protocols, by Eric Hall (<strong>O'Reilly</strong>). If you're interested<br />
in network programming in <strong>Java</strong>, see <strong>Java</strong> Network Programming, by Elliotte Rusty Harold<br />
(<strong>O'Reilly</strong>).<br />
7.2.1 TCP/IP<br />
TCP/IP is the name for a family of protocols that includes TCP (Transmission Control<br />
Protocol), UDP (User Datagram Protocol), and IP (Internet Protocol). The protocols are<br />
layered: IP provides low-level services; both TCP and UDP sit "on top of " IP.<br />
TCP is a reliable, connection-oriented protocol. A process wishing to establish<br />
communication with one or more processes across a network creates a connection to each<br />
of the other processes and sends and receives data using those connections. The network<br />
software, rather than the application, is responsible for making sure that all the data<br />
arrives, and that it arrives in the correct order. It takes care of acknowledging that data has<br />
been received, automatically discards duplicate data, and performs many other services for<br />
the application. If something happens with the connection, the process on either side of the<br />
connection will know almost immediately that the connection has been permanently<br />
broken. [3]<br />
[3] If a connection is not sending or receiving any data, it could take a while before the owning<br />
process is signaled about a problem, depending on the network settings.<br />
Most high-level network protocols (and most JMS implementations) are built on top of<br />
TCP, for obvious reasons: it's a lot easier to use a protocol that takes care of reliability for<br />
you. However, reliability comes with a cost: a lot of work is involved in setting up and<br />
tearing down connections, and additional overhead is required to acknowledge data that's<br />
sent and received. Therefore, TCP is slower than its unreliable relative, UDP.<br />
7.2.2 UDP<br />
UDP (User Datagram Protocol) is an unreliable protocol: you send data to a destination,<br />
but there's no guarantee that the data will arrive. If it doesn't arrive, you'll never find out;<br />
furthermore, the process receiving the data will never know that you sent anything.<br />
This sounds like a bad basis for reliable software, but it really only means that applications<br />
using UDP have to take reliability into their own hands: they need to come up with their<br />
own mechanism for verifying that data was received, and for retransmitting data that went<br />
112