Skip to Content.
Sympa Menu

freetds - RE: [freetds] FreeBSD 5.0 performance problems with TCP_NOPUSH

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] FreeBSD 5.0 performance problems with TCP_NOPUSH
  • Date: Tue, 15 Mar 2005 17:16:08 +0100

> >
> > > > You tested that TCP_NOPUSH under FreeBSD 5.0 do not work
> > > correctly so
> > > > would be so kind to try with
> > >
> > > > /* Try to use TCP_CORK on *BSD */
> > > > #elif (defined(__FreeBSD__) || defined(__GNU_FreeBSD__) ||
> > > > defined(__OpenBSD__)) && defined(TCP_CORK)
> > > > #define USE_CORK 1
> > >
> > > Hi Freddy,
> > >
> > > That works fine on my FreeBSD 5.0 system.
> > >
> > > FWIW here are the avaliable options from tcp.h
> > >
> > > #define TCP_NODELAY 0x01 /* don't delay send to
> > > coalesce packets */
> > > #if __BSD_VISIBLE
> > > #define TCP_MAXSEG 0x02 /* set maximum segment size */
> > > #define TCP_NOPUSH 0x04 /* don't push last block
> of write */
> > > #define TCP_NOOPT 0x08 /* don't use TCP options */
> > > #endif
> > >
> >
> > So I think is working using NODELAY option... do you know a way to
> > "emulate" linux CORK behavior, that is coalesce packets and
> flush them
> > when needed ??
>
> This might be helpful: http://dotat.at/writing/nopush.html.
> http://www.kegel.com/c10k.html#writev recommends writev(2) over
> TCP_CORK.
>

In this case we can't use writev.

> I have a basic question: Why are we doing this? It's the TCP stack's
> job to decide when to flush packets. Why should we worry about such
> low-level, implementation-dependent, nonstandard details? Unless the
> timeout is very long, the advantage of coalescing frames ISTM is very
> small, particularly in light of portability issues.
>
> I can see the advantage of TCP_NODELAY, given how often TDS
> sends small
> packets. I don't see the advantage in using less widely implemented
> options.
>
> Is there a measurable difference with tsql or freebcp?
>

Using TCP_CORK you can see a reduction of about 20% in the number of
packets. Using Sybase (that use a default of 512 bytes per packet) you
can measure much greater gain. This reduce traffic and bandwidth to
server. At the end the difference in time is usually very short however
as you can see changes in code are not so wise... A more portable way to
implement all this stuff would require to use NODELAY and to send
multiple packets at a time (like samba or other projects do...).

The strange things is that patch you report
(http://dotat.at/writing/nopush.html) was committed in FreeBSD 4.3 so I
don't understand why FreeBSD 5 do not include this patch !!! From
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp_usrreq.c?rev=1
.84&content-type=text/x-cvsweb-markup you can see that patch is still
here... however removing check for *BSD would solve all problems.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page