delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/08/27/23:04:01

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC4593857C7E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1630119839;
bh=KoGYK1eOtFGiDNBMDB1mfcasjiXVmMdThi5JpOuzP5k=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=phChUnPFTCjIWGyuwlWkyAoJOhvlm/f8V0Ga0pnYVl3WUiera+0BJFttYFf/KWJkE
qWvR2241o1jCSfsE0HubTD5OIzUHqhpO0icfyuSF2WKPU83C/c9oplr3rzR1dMC4uS
HDHm5PJiwM6DrcZzqLW0rnjfiDgI1p1x/UM3x2fY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71DDE3858423
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
To: cygwin AT cygwin DOT 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 AT house DOT org>
<20210825201845 DOT 07b6400b79dc5558a7761efe AT nifty DOT ne DOT jp>
<f8106fe7-a2b8-d106-3061-4d888124f4b0 AT cornell DOT edu>
<20210826062934 DOT 54f2f2216021c095bb7ba13b AT nifty DOT ne DOT jp>
<d0a8c57d-1ed1-6b4f-c6e7-cbe0e2ec8a1c AT cornell DOT edu>
<3b560051-ab27-f392-ca4b-d1fd9b5733b0 AT cornell DOT edu>
<20210827202440 DOT 47706fc2fc07c5e9a1bc0047 AT nifty DOT ne DOT jp>
<4f2cb5f3-ce9c-c617-f65f-841a5eca096e AT cornell DOT edu>
<20210828022111 DOT 91ef5b4ff24f6da9fadb489e AT nifty DOT ne DOT jp>
<20210828110024 DOT be88ac6dec1ade52199ed811 AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

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 AT cygwin-PC ~]$ scp test.dat yano AT linux-server:.
> > > > yano AT linux-server's password:
> > > > test.dat                                      100%  100MB  95.9MB/s   00:01
> > > > [yano AT cygwin-PC ~]$ scp yano AT linux-server:test.dat .
> > > > yano AT linux-server's password:
> > > > test.dat                                      100%  100MB   8.0MB/s   00:12
> > > > 
> > > > yano AT linux-server:~$ scp yano AT cygwin-PC:test.dat .
> > > > yano AT cygwin-PC's password:
> > > > test.dat                                      100%  100MB 109.7MB/s   00:00
> > > > yano AT linux-server:~$ scp test.dat yano AT cygwin-PC:.
> > > > yano AT 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 AT cygwin-PC ~]$ scp yano AT linux-server:test.dat .
> > > > yano AT linux-server's password:
> > > > test.dat                                      100%  100MB 112.8MB/s   00:00
> > > > 
> > > > yano AT linux-server2:~$ scp test.dat yano AT cygwin-PC:.
> > > > yano AT 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 <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019