dev@grizzly.java.net

Re: Grizzly 2.0 TCPNIOTransportFilter

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 15 Dec 2008 10:17:45 -0500

Salut,

Oleksiy Stashok wrote:
> Hi John,
>
>>
>> does a flag in TCPNIOTransportFilter indicating that Grizzly should
>> always request a new BufferWrapper
>> from MemoryManager make sense?
>>
>> I am asking because I know that I will be handing ByteBuffer to a
>> different Thread and also
>> be using SlabMemoryManager which anyway tries to reuse ByteBuffers....
>>
>> Or should we have another TransportFilter?
> So in other words, you want to remove code, from TCPNIOTransportFilter,
> which tries to retrieve Buffer from WorkerThread, but use MemoryManager
> (Allocator) all the time, right?
> So this should be removed:
>
> (1)
> --------------- REMOVE BLOCK START -----------------------
> if (buffer == null) {
>
> WorkerThread thread = (WorkerThread) Thread.currentThread();
> AttributeHolder workerThreadAttributes =
> thread.obtainAttributes();
> buffer = threadAssociatedBuffer.get(workerThreadAttributes);
>
> if (buffer == null) {
> buffer = transport.getMemoryManager().
> allocate(defaultBufferSize);
>
> threadAssociatedBuffer.set(workerThreadAttributes, buffer);
> }
> }
> -------------- REMOVE BLOCK END -----------------------------
>
> and remain just this:
> (2)
> buffer = transport.getMemoryManager().
> allocate(defaultBufferSize);
>
> Actually, once SlabMemoryManager will be more or less tested - it could
> be good to make this manager default.
> So, basically, we can make (2) default behavior for
> TCPNIOTransportFilter. And memory manager will be responsible for
> caching buffers.
>
> What do you think?

+1 from my side. I think all the buffer management should be centralized
and we might get rid of the WorkerThread's style of managing attribute
if and only if we can get the same performance (might be difficult as
right now we don't have any sync/switch when setting them).

A+

-- Jeanfrancois




>
> WBR,
> Alexey.
>
>>
>>
>> Many Greetings
>> John
>> --
>> Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL
>> für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
>> <mailto:dev-unsubscribe_at_grizzly.dev.java.net>
>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>> <mailto:dev-help_at_grizzly.dev.java.net>
>>
>