You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rémy Maucherat <re...@apache.org> on 2014/04/18 21:30:47 UTC

NIO buffering

Hi,

I am not convinced by the NIO buffering that is used on output. Due to
concurrent access issues I couldn't use it in NIO 2, but then I cannot see
either what it does to justify using a more complex structure over a
simpler array list.

If the idea was to reuse buffers (which it doesn't), there is no option
except using a static buffer pool. Was that the original general idea
around this deque structure ?

Then the upgrade buffering is even more basic, but is probably not a
performance issue, the current code is likely fast enough since it is so
lightweight.

Rémy

Re: NIO buffering

Posted by Rémy Maucherat <re...@apache.org>.
2014-04-23 18:30 GMT+02:00 Mark Thomas <ma...@apache.org>:

> I'd agree with that assessment.
>
> I do remember having to be very careful with some of that code to get
> things working correctly. If there is a cleaner solution then I'd be all
> for it as long as performance is no worse.
>
> Mark
>
> [1] http://svn.apache.org/viewvc?view=revision&revision=1358055
>

Well, it's fine, but I didn't see the point for me since the buffers were
throw away and I didn't need to track their flip state.

So the plan next for me would be to try a buffer pool for NIO2 [this is
appropriate for NIO2 since scatter/gather can be used to access them]. No
idea if it would actually be really faster.

Rémy

Re: NIO buffering

Posted by Mark Thomas <ma...@apache.org>.
On 23/04/2014 16:30, Filip Hanik wrote:
> Ok, Mark would know the exact details.

I'm not sure where you got that idea from, you introduced this code [1].

> It simply looks like a when a buffer
> has been flipped already, to simplify adding more bytes, add it to a new
> unflipped buffer, rather than append to existing one.
> So I don't think its about reuse, I think it may be to simplify the
> handling of buffer flipping.

I'd agree with that assessment.

I do remember having to be very careful with some of that code to get
things working correctly. If there is a cleaner solution then I'd be all
for it as long as performance is no worse.

Mark

[1] http://svn.apache.org/viewvc?view=revision&revision=1358055


> 
> 
> 
> 
> On Wed, Apr 23, 2014 at 9:01 AM, Rémy Maucherat <re...@apache.org> wrote:
> 
>> 2014-04-23 16:50 GMT+02:00 Filip Hanik <fi...@hanik.com>:
>>
>>>> I am not convinced by the NIO buffering that is used on output.
>>>
>>> what are you exactly referring to? Maybe I can shed some light on it.
>>>
>>
>> Ok, so more precisely I was talking about the
>> AbstractOutputBuffer.bufferedWrites field.
>>
>> Rémy
>>
>>
>>>
>>>
>>> On Fri, Apr 18, 2014 at 1:30 PM, Rémy Maucherat <re...@apache.org> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am not convinced by the NIO buffering that is used on output. Due to
>>>> concurrent access issues I couldn't use it in NIO 2, but then I cannot
>>> see
>>>> either what it does to justify using a more complex structure over a
>>>> simpler array list.
>>>>
>>>> If the idea was to reuse buffers (which it doesn't), there is no option
>>>> except using a static buffer pool. Was that the original general idea
>>>> around this deque structure ?
>>>>
>>>> Then the upgrade buffering is even more basic, but is probably not a
>>>> performance issue, the current code is likely fast enough since it is
>> so
>>>> lightweight.
>>>>
>>>> Rémy
>>>>
>>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: NIO buffering

Posted by Filip Hanik <fi...@hanik.com>.
Ok, Mark would know the exact details. It simply looks like a when a buffer
has been flipped already, to simplify adding more bytes, add it to a new
unflipped buffer, rather than append to existing one.
So I don't think its about reuse, I think it may be to simplify the
handling of buffer flipping.




On Wed, Apr 23, 2014 at 9:01 AM, Rémy Maucherat <re...@apache.org> wrote:

> 2014-04-23 16:50 GMT+02:00 Filip Hanik <fi...@hanik.com>:
>
> > >I am not convinced by the NIO buffering that is used on output.
> >
> > what are you exactly referring to? Maybe I can shed some light on it.
> >
>
> Ok, so more precisely I was talking about the
> AbstractOutputBuffer.bufferedWrites field.
>
> Rémy
>
>
> >
> >
> > On Fri, Apr 18, 2014 at 1:30 PM, Rémy Maucherat <re...@apache.org> wrote:
> >
> > > Hi,
> > >
> > > I am not convinced by the NIO buffering that is used on output. Due to
> > > concurrent access issues I couldn't use it in NIO 2, but then I cannot
> > see
> > > either what it does to justify using a more complex structure over a
> > > simpler array list.
> > >
> > > If the idea was to reuse buffers (which it doesn't), there is no option
> > > except using a static buffer pool. Was that the original general idea
> > > around this deque structure ?
> > >
> > > Then the upgrade buffering is even more basic, but is probably not a
> > > performance issue, the current code is likely fast enough since it is
> so
> > > lightweight.
> > >
> > > Rémy
> > >
> >
>

Re: NIO buffering

Posted by Rémy Maucherat <re...@apache.org>.
2014-04-23 16:50 GMT+02:00 Filip Hanik <fi...@hanik.com>:

> >I am not convinced by the NIO buffering that is used on output.
>
> what are you exactly referring to? Maybe I can shed some light on it.
>

Ok, so more precisely I was talking about the
AbstractOutputBuffer.bufferedWrites field.

Rémy


>
>
> On Fri, Apr 18, 2014 at 1:30 PM, Rémy Maucherat <re...@apache.org> wrote:
>
> > Hi,
> >
> > I am not convinced by the NIO buffering that is used on output. Due to
> > concurrent access issues I couldn't use it in NIO 2, but then I cannot
> see
> > either what it does to justify using a more complex structure over a
> > simpler array list.
> >
> > If the idea was to reuse buffers (which it doesn't), there is no option
> > except using a static buffer pool. Was that the original general idea
> > around this deque structure ?
> >
> > Then the upgrade buffering is even more basic, but is probably not a
> > performance issue, the current code is likely fast enough since it is so
> > lightweight.
> >
> > Rémy
> >
>

Re: NIO buffering

Posted by Filip Hanik <fi...@hanik.com>.
>I am not convinced by the NIO buffering that is used on output.

what are you exactly referring to? Maybe I can shed some light on it.


On Fri, Apr 18, 2014 at 1:30 PM, Rémy Maucherat <re...@apache.org> wrote:

> Hi,
>
> I am not convinced by the NIO buffering that is used on output. Due to
> concurrent access issues I couldn't use it in NIO 2, but then I cannot see
> either what it does to justify using a more complex structure over a
> simpler array list.
>
> If the idea was to reuse buffers (which it doesn't), there is no option
> except using a static buffer pool. Was that the original general idea
> around this deque structure ?
>
> Then the upgrade buffering is even more basic, but is probably not a
> performance issue, the current code is likely fast enough since it is so
> lightweight.
>
> Rémy
>