From dev-return-203846-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Wed Nov 27 17:07:55 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9E5E7180648 for ; Wed, 27 Nov 2019 18:07:54 +0100 (CET) Received: (qmail 43492 invoked by uid 500); 27 Nov 2019 17:07:53 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 43482 invoked by uid 99); 27 Nov 2019 17:07:53 -0000 Received: from Unknown (HELO mailrelay1-lw-us.apache.org) (10.10.3.42) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2019 17:07:53 +0000 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) by mailrelay1-lw-us.apache.org (ASF Mail Server at mailrelay1-lw-us.apache.org) with ESMTPSA id 51C544FB4 for ; Wed, 27 Nov 2019 17:07:53 +0000 (UTC) Received: by mail-yb1-f171.google.com with SMTP id h23so9265544ybg.2 for ; Wed, 27 Nov 2019 09:07:53 -0800 (PST) X-Gm-Message-State: APjAAAV+YFD3eT/HMMpK8MqWADwqUJxcYZp4IVInn2nBr5cybxfQMKph cIKXApJO2FiThltJeTMPCOgME2bbsazpUEAcBZI= X-Google-Smtp-Source: APXvYqzYYf2EzN7QTR8lpua7d171vLEOf7dIRiwYrVKi+lhX7OkBt7GrsSQ4cWgxNxXv28g8hIAYjXsP/C8O+3C/Wmk= X-Received: by 2002:a25:bc13:: with SMTP id i19mr31426752ybh.488.1574874472906; Wed, 27 Nov 2019 09:07:52 -0800 (PST) MIME-Version: 1.0 References: <092f3a47-1027-ee96-2c48-09211efcf2cb@apache.org> <6c187238-9519-c91e-cf93-3c3a81557898@apache.org> In-Reply-To: From: =?UTF-8?Q?R=C3=A9my_Maucherat?= Date: Wed, 27 Nov 2019 18:07:42 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Drop SocketWrapperBase.write(Non)BlockingDirect methods To: Tomcat Developers List Content-Type: multipart/alternative; boundary="00000000000086060c0598570942" --00000000000086060c0598570942 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 27, 2019 at 5:35 PM Mark Thomas wrote: > On 27/11/2019 15:59, R=C3=A9my Maucherat wrote: > > On Wed, Nov 27, 2019 at 4:51 PM Mark Thomas > > wrote: > > > > I've been looking at the 9.0.x changes. > > > > What is clearer now (I think the differences were always there - ju= st > > harder to see with the more complex code) is that there are some > minor > > differences in behaviour when all of the following are true: > > - the source buffer is emptied when it is copied to the socket buff= er > > - the socket buffer is full after the source buffer has been copied > > > > In some cases there will be an immediate write to the network. In > other > > cases the network write will wait until the next write to the socke= t > > buffer or the next explicit flush. > > > > I think I prefer an immediate write in this scenario. WDYT to > updating > > (very carefully) all of the write methods to behave that way? > > > > > > Ah personally I did prefer not writing that full buffer (unless the > > source still has data, of course) on purpose since I considered not > > doing IO reduced the likelihood to block on IO (or write 0 for non > > blocking and having to use the poller). That's possible though if you > > like it better. > > My preference for writing earlier is only a slight one. I'm more > concerned that different methods take a different approach. Taking a > closer look at that is on my TODO list but it isn't a priority for me at > the moment. > I'll double check the inconsistency :) writeBlocking writes after. writeNonBlockingInternal has that "&& !socketBufferHandler.isWriteBufferWritable()" in the while loop that makes the thing inconsistent, it is a leftover from the old code. For now I'll fix that. R=C3=A9my --00000000000086060c0598570942 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Nov 27, 2019 at 5:35 PM Mark Thomas <markt@apache.org> wrote:
=
On 27/11/2019 15:59, R=C3= =A9my Maucherat wrote:
> On Wed, Nov 27, 2019 at 4:51 PM Mark Thomas <markt@apache.org
> <mailto:markt= @apache.org>> wrote:
>
>=C2=A0 =C2=A0 =C2=A0I've been looking at the 9.0.x changes.
>
>=C2=A0 =C2=A0 =C2=A0What is clearer now (I think the differences were a= lways there - just
>=C2=A0 =C2=A0 =C2=A0harder to see with the more complex code) is that t= here are some minor
>=C2=A0 =C2=A0 =C2=A0differences in behaviour when all of the following = are true:
>=C2=A0 =C2=A0 =C2=A0- the source buffer is emptied when it is copied to= the socket buffer
>=C2=A0 =C2=A0 =C2=A0- the socket buffer is full after the source buffer= has been copied
>
>=C2=A0 =C2=A0 =C2=A0In some cases there will be an immediate write to t= he network. In other
>=C2=A0 =C2=A0 =C2=A0cases the network write will wait until the next wr= ite to the socket
>=C2=A0 =C2=A0 =C2=A0buffer or the next explicit flush.
>
>=C2=A0 =C2=A0 =C2=A0I think I prefer an immediate write in this scenari= o. WDYT to updating
>=C2=A0 =C2=A0 =C2=A0(very carefully) all of the write methods to behave= that way?
>
>
> Ah personally I did prefer not writing that full buffer (unless the > source still has data, of course) on purpose since I considered not > doing IO reduced the likelihood to block on IO (or write 0 for non
> blocking and having to use the poller). That's possible though if = you
> like it better.

My preference for writing earlier is only a slight one. I'm more
concerned that different methods take a different approach. Taking a
closer look at that is on my TODO list but it isn't a priority for me a= t
the moment.

I'll double check the i= nconsistency :)

writeBlocking writes after.
<= div>writeNonBlockingInternal has that=C2=A0 "&& !socketBufferH= andler.isWriteBufferWritable()" in the while loop that makes the thing= inconsistent, it is a leftover from the old code.
For now I'= ll fix that.

R=C3=A9my

--00000000000086060c0598570942--