The problem is, that with my initial tests the direct buffers were quicker, but more memory consuming. Does it make sense to find out initially, under which circumstances which behaviour occurs? I would support you with additional tests too. Robert, have you eventually a test application for use, so that we can make the tests with the same code and conditions? Is there a possibility to decrease the memory consumption from direct buffers without decreasing their performance?

Regards
Michael



Trustin Lee wrote:
On 5/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:



Out of curiosity, why do you not use -server?

One serious issue with direct buffers is that you can declare a lot of
them, throw away the reference and the memory will not be reclaimed until
the GC kicks in. This may not be for some time since it depends what is in the heap. Even if you allocate huge direct buffers it isn't going to make GC happen any more quickly. I think it would have been better if ByteBuffer had
a dispose() method.

Since you find that heap buffers offer better performance for you, is the
greater memory footprint with direct buffers really an issue for you?


This thread definitely raises very interesting performance issues as you
mentioned initially.  Most modern JVMs are showing that heap buffers show
better performance and memory utilization than direct buffers do.  The
buffer pooling was originally to save time to allocate direct buffers
because it usually takes a lot of time comparing to the time taken while
heap buffers are allocated. If heap buffers are much better choice for most
cases, then we need to adjust our default allocation behavior.

If we change the default buffer type to 'heap', we'll also have to change
the default allocator to SimpleByteBufferAllocator.  WDYT?

Trustin

Reply via email to