cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Stupp (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-11870) Consider allocating direct buffers bypassing ByteBuffer.allocateDirect
Date Mon, 30 May 2016 10:24:12 GMT


Robert Stupp commented on CASSANDRA-11870:

As outlined in CASSANDRA-11818, it is beneficial for stability and performance to introduce

To achieve that, Netty 4.1 with that patch plus code changes to work around {{Bits.reserveMemory}}+{{Cleaner}}
are required.

> Consider allocating direct buffers bypassing ByteBuffer.allocateDirect
> ----------------------------------------------------------------------
>                 Key: CASSANDRA-11870
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Robert Stupp
>            Priority: Minor
>             Fix For: 3.x
> As outlined in CASSANDRA-11818, {{ByteBuffer.allocateDirect}} uses {{Bits.reserveMemory}},
which is there to respect the JVM setting {{-XX:MaxDirectMemorySize=...}}.
> {{Bits.reserveMemory}} first tries an "optimistic" {{tryReserveMemory}} and exits immediately
on success. However, if that somehow doesn't succeed, it triggers a {{System.gc()}}, which
is bad IMO (however, kind of how direct buffers work in Java). After that GC it sleeps and
tries to reserve the memory up to 9 times - up to 511 ms - and then throws {{OutOfMemoryError("Direct
buffer memory")}}.
> This is unnecessary for us since we always immediately "free" direct buffers as soon
as we no longer need them.
> Proposal: Manage direct-memory reservations in our own code and skip {{Bits.reserveMemory}}
that way.
> (However, Netty direct buffers are not under our control.)

This message was sent by Atlassian JIRA

View raw message