Re: Internal TCP/IP send buffer?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Alun Jones [MSFT] (alunj_at_online.microsoft.com)
Date: 10/22/04


Date: Fri, 22 Oct 2004 14:14:34 -0700


"Marton Anka" <marton@03am.com> wrote in message
news:e8CCHxFuEHA.3860@TK2MSFTNGP09.phx.gbl...
> No - Nagle can be both a blessing and a curse. That's why there's an
> option to disable it. It's simply there to help with bandwidth efficiency
> when throughput is preferred over latency. In this case I need to minimize
> latency.

IMHO, it's a rare application that truly needs to use TCP and disable Nagle.

> I'm not trying to work around them. If the buffer I'm talking about is
> indeed the TCP window, then how do I go about adjusting its size for the
> current connection?

It's a part of the negotiation between server and client - I don't know that
it's something you can successfully control directly. There are some
registry entries for changing the window on a system-wide basis, but I doubt
that this is the only application you'll be running.

> Actually, it will solve my problem. If you can show me where UDP
> guarantees delivery, orders packets and controls data flow then yes, it
> would be better

But you're specifically asking to _not_ guarantee delivery. You're asking
that, if a piece of data cannot reach its destination in a small time, it
should be discarded as 'outdated'. Ordering packets is dead easy, you
simply attach a sequence number to each packet - but then again, all you
appear to be asking for is the ability to take the most recent data,
discarding the old stuff. For this, a time-stamp is more useful than a
sequence number. Just add it to the data structure that embodies your data.

> to use it. At this point however it seems like I'm asking for this
> non-existent UDP to behave more like TCP. So I might as well use TCP the
> way it was intended to be used, but how can I control that pesky buffer?

Given a choice between trying to get TCP to drop some features, or trying to
add features to UDP, it's usual to find that the former is not something
that you're given the tools to do, so you have to do the latter.

"That pesky buffer" is an intrinsic part of TCP's operation.

> Client is connected to Proxy over the internet, possibly with a very slow
> connection. Server is connected to Proxy over gigabit ethernet. Server is
> sending small chunks of data to Proxy that gets forwarded to Client. TCP
> buffering between Proxy and Server is causing problems with the data being
> out of date by the time it is recv()-d by Proxy. Proxy has no knowledge of
> the protocol used between Client and Server, and even if it did it could
> not do anything with it as the data is encrypted.

You still haven't outlined specifically what you plan on doing with data
that is "out of date".

If you intend to discard it in favour of more recent data, then TCP is a
clear loss, and UDP is a clear win. That's because UDP allows you (by
requiring you to write your own retransmission algorithm) to choose not to
retransmit older data. It also has the advantage (in your case) that
individual packets of data travel on their own, without being crammed in
with other packets to form a larger IP packet.

Yes, it's a bit of work to write your own retransmission routine, and
another bit of work to add timestamps / sequencing information in your data,
but TCP is tuned for a scenario that doesn't include you. Go with UDP, is
my advice. To achieve what you're trying to do, using published APIs, you'd
pretty much have to write your own TCP layer in NDIS. Now that's really
hard work.

Alun.
~~~~



Relevant Pages

  • Re: UPD better than TCP in streaming video/audio ?
    ... > UDP gains speed over TCP because it carries no information that would ... it doesn't even know that packets were lost. ... which is perfect for UDP. ... > Finally, there's the possibility of multicast data - for instance, a live ...
    (microsoft.public.win32.programmer.networks)
  • Re: Update: UDP 770 Potential Worm
    ... > the network immediately after the 'attack', ... were no packets indicating some form of replication. ... I noticed that the UDP ... > of the UDP datagrams is the IP address of the proxy? ...
    (Incidents)
  • Re: NTP and Firewall help needed.
    ... >>port 123 for udp and tcp. ... The action here is applied for packets that fall off ... > - ACCEPT any and all traffic coming from the localhost interface ...
    (comp.os.linux.setup)
  • Re: Old SUN NFS performance papers.
    ... > also just generally a good idea, since UDP frags act as a fixed ... > you may be copying all your packets over again ), ... With TCP, you ... >> FreeBSD NFS servers, and therefore always looking for tweaks and nobs ...
    (freebsd-performance)
  • Re: NTP and Firewall help needed.
    ... >port 123 for udp and tcp. ... Also the idea of combining rules for packets arriving at the local machine ... ACCEPT any and all traffic coming from the localhost interface ...
    (comp.os.linux.setup)