List:General Discussion« Previous MessageNext Message »
From:Philip Brown Date:October 8 2001 11:57am
Subject:Preventing Nagle with mysql (was: Bizarre query performance)
View as plain text  
Hi Dan, many thanks for your help, having investigated the matter further
I now concur that the issue is Nagle.

> The only way to really verify this is to dump packets on the wire.
> It's almost impossible to get tcpdump running on SCO OpenServer, so
> I suggest downloading Ethereal for windows, and viewing the connection
> from there.  If you see
>
> 0.000 client -> server: query (150 bytes)
> 0.010 server -> client: result header (32 bytes)
> 0.210 server -> client: result records (100 bytes)
> 0.211 client -> server: ACK

Interesting. For a query that shows the problem:

SELECT * FROM X WHERE (PRIMARY KEY) = 100

I get:

0.000 client -> server: query (41 bytes)
0.000 server -> client: ACK
0.002 server -> client: result data (field names + record data) (1460 bytes)
0.130 client -> server: ACK
0.130 server -> client: (Login command? false positive) (actually contains
more record data) (132 bytes)
0.330 client -> server: ACK

The client reports that the mysql_query() time was 0ms, and the
mysql_store_result()
time was 130ms.

It also looks like I've got Nagle on the client side, as the last client ACK
was
200ms after the previous one. I think that I've also got Nagle on the server
side,
according to what you've told me.

Here are the results of a query that do NOT show the problem:

SELECT SomeField FROM X WHERE (PRIMARY KEY) = 100

0.000 client -> server: query (48 bytes)
0.000 server -> client: ACK
0.001 server -> client: result data (field names + record data) (56 bytes)
0.178 client -> server: ACK

So my next question is, how do I go about preventing Nagle at both ends?
I'm now running the standard binary of mysql 3.23.43 on the SCO OpenServer,
and I'm using the latest (3.23.43) libmysql.dll on the client side. My
test application calls the API routines in libmysql.dll directly, so there
should be no other layers like ODBC getting involved.

MSDN tells me that Win2000 implements Nagle, but that applications can
disable it using the TCP_NODELAY flag on the socket. Looking at the mysql
source, it looks like this is being requested in libmysql.dll, but I'm not
enough of a C/C++ expert to know if it is actually happening.

Many thanks for any further assistance or comments!

Philip Brown

Thread
Bizarre query performancePhilip Brown5 Oct
  • Re: Bizarre query performanceRussell Miller5 Oct
    • RE: Bizarre query performancePhilip Brown5 Oct
      • Re: Bizarre query performanceRussell Miller5 Oct
        • RE: Bizarre query performancePhilip Brown5 Oct
          • Re: Bizarre query performanceRussell Miller6 Oct
            • RE: Bizarre query performancePhilip Brown6 Oct
  • Re: Bizarre query performanceBoyd Lynn Gerber5 Oct
    • RE: Bizarre query performancePhilip Brown5 Oct
      • RE: Bizarre query performanceBoyd Lynn Gerber5 Oct
  • Re: Bizarre query performanceDan Nelson5 Oct
    • RE: Bizarre query performancePhilip Brown5 Oct
      • Re: Bizarre query performanceDan Nelson5 Oct
        • Re: Bizarre query performanceBoyd Lynn Gerber6 Oct
          • RE: Bizarre query performancePhilip Brown6 Oct
            • Re: Bizarre query performanceDan Nelson7 Oct
              • Preventing Nagle with mysql (was: Bizarre query performance)Philip Brown8 Oct
                • Re: Preventing Nagle with mysql (was: Bizarre query performance)Dan Nelson10 Oct
                  • Re: Preventing Nagle with mysql (was: Bizarre query performance)Sinisa Milivojevic10 Oct