[freetds] FreeTDS performance

Lowden, James K LowdenJK at bernstein.com
Fri May 16 12:48:29 EDT 2003

> From: ZIGLIO Frediano [mailto:Frediano.Ziglio at mail.vodafone.it]
> Sent: May 16, 2003 11:23 AM
> It seem that tsql is slower. I tried to increase tcp buffer 
> (with setsockopt) on login.c and seem better
> Query analyzer  tsql (CVS)  tsql (with 32kb of buffer)
> 12              60          41
> 13              56          45
> (time in seconds to get and print all rows)
> Before going deeply with profiling anyone have a hint on this 
> problem? Perhaps is cause I'm connected to Linux machine via 
> SSH too ? Machine are quite different (P2 400MHZ with 64Mb 
> and P3 1GHZ with 512Mb)... however network should be much 
> slower than display...

I cannot reproduce your results.  My tsql time:

time tsql -S ...
real    0m15.459s
user    0m8.404s
sys     0m1.036s

cpu: Intel Pentium II/Celeron (Deschutes), 349.20 MHz

Of the elapsed 15 seconds, 8 were FreeTDS.  That's with TDSDUMP defined!  

Encryption takes up bytes on the wire (I don't know the overhead), as well
as computation on both ends.  On our 100 Mb Ethernet, scp normally delivers
~5  MB/sec, something like 50% throughput.  I'm logged in via ssh to my tsql
host, too, though.  And (see below) we're nowhere near that data rate.  

A 100 Mb Ethernet is not your bottleneck, not substantially, IMHO.  I would
say server latency would be a much bigger factor.  

I wrote a little utility to derive the TDS bytestream from our log file.  On
my machine, the TDS stream for your query was 1031351 bytes, or ~67 KB/s.
Put another way, the whole conversation could have been transmitted in ~0.1
seconds on a 100 Mb link, two orders of magnitude faster.  

I've noticed in bcp that responding slowly to the server causes the server
to respond slowly to the client!  Something to do with their scheduler, is
my theory.  

I think you should get a faster printer, or use longer seconds.  ;-)

The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.

More information about the FreeTDS mailing list