[JDEV] UDP vs TCP
Benjamin Kahn
xkahn at cybersites.com
Fri Sep 1 08:53:27 CDT 2000
I haven't been paying close enough attention to this list to
figure out WHY people are suddenly arguing UDP vs. TCP. BUT! It seems
common that people want to discuss this.
The IETF's discussion on this problem is here:
http://www.imppwg.org/cgi-bin/ml_search.cgi?query_exp=UDP
As a usage note, I believe that ICQ runs over (or used to run
over; I haven't looked recently) UDP, whereas most other IM systems use
TCP.
The advantages of TCP are:
Simple to tell if a user is really there. (They are connected)
Messages arrive in order they were sent in.
Lost messages get re-sent automatically.
Large messages are easy to handle.
TCP stacks are getting better and better, and it's hard to do
better than they can in an application.
Less code in the server means less code to test and have bugs.
Persistant state means that security is easier to impliment.
"" "" "" "" authorization "" "" ""
The advantages of UDP are:
Lower overhead.
Umm... Anything else?
Honestly, you can make a fairly decent IM system with
UDP. Messages can't be > 64k. (Unless you are willing to play
fragmentation games with the packets.) Messages may get lost, but that
might be okay. Only a few people really care about security
ANYWAY. Messages may come out of order, but that probably doesn't matter
in this case. And presence can be determined by pinging. (Ping every 5
seconds, If the server hasn't heard from you in 12 seconds, you're
offline.)
But why are we discussing this? Jabber is quite firmly TCP at
this point. It would be a MAJOR overhaul to change, and the benefits
just aren't really there.
On Fri, 1 Sep 2000, Peter Donald wrote:
> At 08:19 31/8/00 -0500, you wrote:
> >UDP gets its performance boost because it doesn't care if its
> >packets get there or not.
>
> partially. It also is a lot less memory usage as memory beffers are done in
> application space and can be much much more efficiently managed - including
> size and content wise. It also gets a speed up because it doesn't have to
> maintain ordering. Is order that important in sub-second range for IM ? I
> would say nay except for a single conversation between 2 parties.
>
> UDP is a much more rawer - you get to do all management facilities and is
> thus potentially much faster and more memory efficient.
>
> >IM doesn't fall into either one of those categories. You do need to
> >make sure that all of the packets got there and in the proper order.
>
> do you ? I would only say that they have to be ordered in a single
> conversation ? How often do 2 messages from same conversation end up being
> co-located on server ???? Very rarely I would say.
>
> >While you could indeed add this capability to your IM application,
> >in the end, you'll just end up re-implementing TCP and probably
> >poorly.
>
> unlikely - you need a very small subset of TC that TCP contains
>
> >Also there's no gurantee of the sequence of packets sent via UDP,
> >you have a very hard time implementing standard security
> >mechanisms such as SSL.
>
> true. UDP encryption/signing is more difficult to implement.
>
> >That's why most people stick to TCP instead of UDP. If UDP
> >provided more bang for the buck, it would be used. But it doesn't
> >so, we stick with TCP.
>
> People stick with TCP because it is easier and most use cases of TCP/IP is
> consistent with design choices. IM has different demands IMO - sequencing
> is different as is frequency and type of data transmitted.
>
> Using IM of TCP ends up with lots of small fragmented IP packets, excessive
> buffering and potentially long timeout times.
>
> >I"m not saying you shouldn't try your system. It might be useful for
> >local IM where the network is a lot more reliable than over the
> >general Internet.
>
> gee thanks.
>
> TCP is not a magic bullet. I do know the differences between the way you
> design applications. TCP is a lot easier and requires a lot less developer
> thought. UDP is a lot different, harder and requires more management code
> but can potentially be faster given the usage requirements of IM.
>
> It wont be as easy as TCP server nor can I safely saY I will be successful
> but if I am it is much more likely to be scalable than TCP. There is a
> reaons that many other protocols are UDP, scalability is one of them
>
>
> Cheers,
>
> Pete
>
> *------------------------------------------------------*
> | "Nearly all men can stand adversity, but if you want |
> | to test a man's character, give him power." |
> | -Abraham Lincoln |
> *------------------------------------------------------*
>
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> http://mailman.jabber.org/listinfo/jdev
>
-Ben
------------------------------------ |\ _,,,--,,_ ,) ----------
Benjamin Kahn /,`.-'`' -, ;-;;'
(212) 924 - 2220 ext 201 |,4- ) )-,_ ) /\
ben at cybersites.com --------------- '---''(_/--' (_/-' ---------------
I just want to make the world a better place for me to live in.
-Lucy in a Peanuts comic
More information about the JDev
mailing list