cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Brown (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-13789) Reduce memory copies and object creations when acting on ByteBufs
Date Thu, 07 Sep 2017 20:02:00 GMT


Jason Brown commented on CASSANDRA-13789:

Pushed a fix here:


The problem was in [~norman]'s patch, in both {{CBUtil#writeString}} and {{CBUtil#writeLongString}}
he was bumping the writerIndex via {{ByteBuf#writerIndex(int)}}. The problem is that if the
new writerIndex value exceeds the capacity of the buffer it throws an {{IndexOutOfBoundsException}}.
Previously, we were calling {{ByteBuf#writeShort}} or {{ByteBuf#writeLong}}, which reallocates
the buffer if the new writerIndex is larger than the current size.

For now, I've reverted to calling {{ByteBuf#writeShort}} (or {{ByteBuf#writeLong}}), to restore
previous behavior (that passes!), and I've added a new {{CBUtilTest}}, as well.

As a further optimization, we can find out why the {{ByteBuf}} is being reallocated to begin
with, but that's for another jira.

> Reduce memory copies and object creations when acting on  ByteBufs
> ------------------------------------------------------------------
>                 Key: CASSANDRA-13789
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Norman Maurer
>            Assignee: Norman Maurer
>             Fix For: 4.0
>         Attachments: 0001-CBUtil.sizeOfLongString-encodes-String-to-byte-to-ca.patch,
> There are multiple "low-hanging-fruits" when it comes to reduce memory copies and object
allocations when acting on ByteBufs.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message