From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-03.nifty.com (conssluserg-03.nifty.com [210.131.2.82]) by sourceware.org (Postfix) with ESMTPS id 71DDE3858423 for ; Sat, 28 Aug 2021 03:03:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71DDE3858423 Received: from Express5800-S70 (z221123.dynamic.ppp.asahi-net.or.jp [110.4.221.123]) (authenticated) by conssluserg-03.nifty.com with ESMTP id 17S332Fa030080 for ; Sat, 28 Aug 2021 12:03:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com 17S332Fa030080 X-Nifty-SrcIP: [110.4.221.123] Date: Sat, 28 Aug 2021 12:03:12 +0900 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: cygrunsrv + sshd + rsync = 20 times too slow -- throttled? Message-Id: <20210828120312.ff2f26a8412c3c434f23e21b@nifty.ne.jp> In-Reply-To: <20210828110024.be88ac6dec1ade52199ed811@nifty.ne.jp> References: <41A583E1-C8E7-42AB-9F24-EEC33A41EC60@house.org> <20210825201845.07b6400b79dc5558a7761efe@nifty.ne.jp> <20210826062934.54f2f2216021c095bb7ba13b@nifty.ne.jp> <3b560051-ab27-f392-ca4b-d1fd9b5733b0@cornell.edu> <20210827202440.47706fc2fc07c5e9a1bc0047@nifty.ne.jp> <4f2cb5f3-ce9c-c617-f65f-841a5eca096e@cornell.edu> <20210828022111.91ef5b4ff24f6da9fadb489e@nifty.ne.jp> <20210828110024.be88ac6dec1ade52199ed811@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2021 03:03:29 -0000 On Sat, 28 Aug 2021 11:00:24 +0900 Takashi Yano wrote: > On Sat, 28 Aug 2021 02:21:11 +0900 > Takashi Yano wrote: > > > On Fri, 27 Aug 2021 12:00:50 -0400 > > Ken Brown wrote: > > > > > On 8/27/2021 7:24 AM, Takashi Yano wrote: > > > > On Thu, 26 Aug 2021 18:18:29 -0400 > > > > Ken Brown wrote: > > > >> On 8/26/2021 11:56 AM, Ken Brown via Cygwin wrote: > > > [...] > > > >> In case you want to try out my proposed change, I've just rebased the patches to > > > >> the current master and pushed them to a new topic/pipe branch. > > > > > > > > Hi Ken, > > > > > > > > Thanks much! I tested topic/pipe branch. > > > > > > > > [yano@cygwin-PC ~]$ scp test.dat yano@linux-server:. > > > > yano@linux-server's password: > > > > test.dat 100% 100MB 95.9MB/s 00:01 > > > > [yano@cygwin-PC ~]$ scp yano@linux-server:test.dat . > > > > yano@linux-server's password: > > > > test.dat 100% 100MB 8.0MB/s 00:12 > > > > > > > > yano@linux-server:~$ scp yano@cygwin-PC:test.dat . > > > > yano@cygwin-PC's password: > > > > test.dat 100% 100MB 109.7MB/s 00:00 > > > > yano@linux-server:~$ scp test.dat yano@cygwin-PC:. > > > > yano@cygwin-PC's password: > > > > test.dat 100% 100MB 31.4MB/s 00:03 > > > > > > > > As shown above, outgoing transfer-rate has been improved upto near > > > > theoretical limit. However, incoming transfer-rate is not improved > > > > much. > > > > > > > > I digged further and found the first patch attached solves the issue > > > > as follows. > > > > > > > > [yano@cygwin-PC ~]$ scp yano@linux-server:test.dat . > > > > yano@linux-server's password: > > > > test.dat 100% 100MB 112.8MB/s 00:00 > > > > > > > > yano@linux-server2:~$ scp test.dat yano@cygwin-PC:. > > > > yano@cygwin-PC's password: > > > > test.dat 100% 100MB 102.5MB/s 00:00 > > > > > > Great! > > > > > > > I also tested the case: > > > >>>> https://cygwin.com/pipermail/cygwin/2021-March/247987.html > > > >>>> which seems to be the same issue with > > > >>>> https://stackoverflow.com/questions/10385424/good-alternatives-to-cygwin-cygwin-doesnt-support-natively-support-win32-app > > > > > > > > Unfortunately, topic/pipe does not help. > > > > > > > > I confirmed that applying the second patch attached, which reverts > > > > to create() rather than nt_create(), and setting CYGWIN=pipe_byte > > > > fixes the problem. > > > > > > > > What do you think of this alternative implementation which does > > > > not use nt_create()? > > > > > > Two years ago I thought I needed nt_create to avoid problems when calling > > > set_pipe_non_blocking. Are you saying that's not an issue? Is > > > set_pipe_non_blocking unnecessary? Is that the point of your modification to > > > raw_read? > > > > Yes. Instead of making windows read function itself non-blocking, > > it is possible to check if the pipe can be read before read using > > PeekNamedPipe(). If the pipe cannot be read right now, EAGAIN is > > returned. > > As for writint to pipe, set_pipe_non_blocking seems to take effect > and be necessary. So, the following patch seems to be appropriate. diff --git a/winsup/cygwin/fhandler_pipe.cc b/winsup/cygwin/fhandler_pipe.cc index b3af4a0a0..82f5de3f4 100644 --- a/winsup/cygwin/fhandler_pipe.cc +++ b/winsup/cygwin/fhandler_pipe.cc @@ -48,6 +48,8 @@ fhandler_pipe::set_pipe_non_blocking (bool nonblocking) IO_STATUS_BLOCK io; FILE_PIPE_INFORMATION fpi; + if ((openflags & O_ACCMODE) == O_RDONLY) + return; /* Do nothing for read pipe */ fpi.ReadMode = FILE_PIPE_BYTE_STREAM_MODE; fpi.CompletionMode = nonblocking ? FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION; -- Takashi Yano