Performance and scalability: TCP vs UDP

  1. TCP vs UDP (5 messages)

    It is often mentioned that UDP has less overhead as compared to TCP for data transmission. Does anyone knows how much less?

    Is there any merits in using UDP instead of TCP when transferring large objects across the network? I would have to implement my own retry/ordering mechanism in Java. Let's say I want to reimplement JRNP using UDP datagrams.


    Threaded Messages (5)

  2. TCP vs UDP[ Go to top ]

    when sending TCP packets, the sender will send a small number of packets to the client first and then wait for the reponse (the client will send back some signals showing that it has got the packets). At the time waiting, no packets would be sent to client. If the network connection is slow, the overhead will be large. But if the network connection is fast enough, the overhead may be very very small. Although there is overhead, data-critical packets should use TCP.

    Use UDP only when the packets are time-critical like video streaming. When the packets are lost, there is no effect to the system.

    Consider your case, if the objects is large and divided into 10000 packets. If you use UDP, and lose 1 packet only. You will need to resend 10000 packets. Why don't you use TCP? The overhead should be less than sending 10000 packets again and again (and no one can tell you that how many times you need to resend the objects).
  3. TCP vs UDP[ Go to top ]

    Besides, Java brings you more overhead than TCP. No one would use Java to handle such system-level problems as Java is too "thick".
  4. TCP vs UDP[ Go to top ]


    1. When network connection is good
      -- TCP overhead is small enough to ignored

    2. When network connection is bad
      -- TCP overhead can be seen
      -- at the same time, UDP packet loss problem is also serious. You will need to retry again and again and again ... The overhead must be more serious than using TCP.
  5. TCP vs UDP[ Go to top ]

    One point I didn't see mentioned: TCP has congestion control. Using TCP will likely be more network-friendly than your own UDP-based protocol.

  6. TCP vs UDP[ Go to top ]

    Have a loo at JavaGroups. This may help you....