List:General Discussion« Previous MessageNext Message »
From:Chris Wilson Date:March 30 1999 6:50am
Subject:Linux Threads and socket options
View as plain text  
Hi,

I don't really know who to ask on this one, because mysql is unsupported
(obviously, as free software), but maybe someone on this list can tell me,
or at least point me in the right direction.

MySQL has the option to set TCP_NODELAY on the server's listening socket,
however, this is only compiled in on FreeBSD:

#if defined(IPTOS_THROUGHPUT) && !defined(HAVE_LINUXTHREADS) /* For
FreeBSD */
  if (fd > 0)
  {
#ifndef __EMX__
    int tos = IPTOS_THROUGHPUT;
    if (!setsockopt(fd, IPPROTO_IP, IP_TOS, (void*) &tos, sizeof(tos)))
#endif
    {
      int nodelay = 1;
      if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*) &nodelay,
                     sizeof(nodelay)))
      {
        DBUG_PRINT("warning",("Couldn't set socket option for fast
send"));
      }
    }
  }
#endif

This appears to be deliberately excluding the use of TCP_NODELAY on Linux
(presumably because of the Linux Threads package). What I want to know is,
whether there is a really good reason for NOT using TCP_NODELAY on Linux?
I have a strong suspicion that we are suffering severe performance hits at
our site because of this option. 

I think this because running a query and sending the results to /dev/null
or a file takes 1.4 seconds. Sending the same query over the network
(100MBps) takes about 30 seconds and runs at 50k/s. tcpdump shows that
each packet sent by the server is immediately followed by an
acknowledgement (i.e. the server waits for acknowledgement before sending
another packet). TCP_NODELAY would seem to prevent this.

In any case I am about to remove the !defined(HAVE_LINUXTHREADS) condition
and run comparison benchmarks on the system (hopefully the benchmarks will
also pick up any possible data corruption). If anyone suspects that this
will cause data corruption, please could you let me know immediately
before I destroy all our company's data :-)

Cheers, Chris.
   ___ __     _  
 / __// / ,__(_)_  | Chris Wilson <Chris.Wilson@stripped> Unix+Net+RC5 |
/ (_ / ,\/ _/ /_ \ | Will Internet Spam become legal in Europe on March 29th |
\__//_/_/_//_/___/ | Vote against it at: http://www.politik-digital.de/spam/ |

Thread
Linux Threads and socket optionsChris Wilson30 Mar
  • Linux Threads and socket optionsMichael Widenius30 Mar
  • Support (Was: Linux Threads and socket options)Fred Read30 Mar
Re: Linux Threads and socket optionsEd Carp31 Mar
  • Re: Linux Threads and socket optionsMichael Widenius31 Mar