X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7C07B9DCD1F for ; Fri, 10 Feb 2006 10:14:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87979-09 for ; Fri, 10 Feb 2006 10:15:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 202189DCD16 for ; Fri, 10 Feb 2006 10:14:57 -0400 (AST) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1F7Z2Z-00064H-S1 for pgsql-odbc@postgresql.org; Fri, 10 Feb 2006 15:14:28 +0100 Received: from 83.145.96.118 ([83.145.96.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Feb 2006 15:14:27 +0100 Received: from Marc.Herbert by 83.145.96.118 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Feb 2006 15:14:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-odbc@postgresql.org From: Marc Herbert Subject: TCP_NO_DELAY & TcpAckFrequency (Re: Slow query through ODBC) Date: Fri, 10 Feb 2006 15:15:23 +0100 Lines: 44 Message-ID: References: <6BCB9D8A16AC4241919521715F4D8BCE6C7FD9@algol.sollentuna.se> <43EC712E.1060707@freesurf.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 83.145.96.118 User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Jumbo Shrimp, linux) Cancel-Lock: sha1:R/rC6nMR56OzVpBoe0bgcppISqM= X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.336 required=5 tests=[AWL=0.083, RCVD_NUMERIC_HELO=1.253] X-Spam-Score: 1.336 X-Spam-Level: * X-Archive-Number: 200602/62 X-Sequence-Number: 7191 Arnaud Lesauvage writes: > Magnus Hagander a écrit : >> Since it works with different speeds in different clients, it *probably* >> isn't on the server side. I'm far from sure on that though, there may be >> other paramters that are implicitly changed when ODBC is used. > > Yes, that was my first impression also. But the fact that the server > waits for an ACK from the client before it goes on sending packet is > quite strange, isn't it ? I don't think that's what happens. Those are two very different but unfortunately related things. 1) the Nagle algorithm (disabled by TCP_NO_DELAY) is an optimization when sending. It prevents sending many small packets, by waiting a little bit for them to become bigger. The price is a higher latency. 2) the half-ACK frequency is an similar optimization when receiving. It cuts the number of sent acknowledgements by two, by waiting a little bit to receive a 2nd packet, acknowledging the two packets using only one ACK. You can disable it with TcpAckFrequency in the registry. So far, those two have nothing in common. But the thing is, TCP _piggybacks_ acknowledgements packets of data flowing in one direction together with data packets flowing in the opposite direction. So, if you force TCP to send data more frequently with TCP_NO_DELAY, then it will also send ACKs (of the opposite communication) more frequently as a side effect. Once you decided to send a packet, then better put the maximum information in it! Same thing if you force TCP to send ACKs more frequently using TcpAckFrequency: then you'll get some TCP_NO_DELAY effect as a bonus. Once you decided to send an ACK, then better send the staging data in the same packet! So you see that TcpAckFrequency can (in some scenarios) play the role of TCP_NO_DELAY. And vice-versa. That's probably what you experienced.