You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "C. Scott Andreas (Jira)" <ji...@apache.org> on 2026/04/05 00:35:00 UTC

[jira] [Commented] (CASSANDRA-21285) Reduce allocations + copies due to rebuffering in LocalDataResponse row serialization

    [ https://issues.apache.org/jira/browse/CASSANDRA-21285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18071121#comment-18071121 ] 

C. Scott Andreas commented on CASSANDRA-21285:
----------------------------------------------

Branch: [https://github.com/cscotta/cassandra/tree/CASSANDRA-21285]

> Reduce allocations + copies due to rebuffering in LocalDataResponse row serialization
> -------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-21285
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21285
>             Project: Apache Cassandra
>          Issue Type: Task
>          Components: Messaging/Client
>            Reporter: C. Scott Andreas
>            Priority: Normal
>         Attachments: CASSANDRA-21285.diff, after.png, before.png
>
>
> This patch reduces allocations due to rebuffering in LocalDataResponse row serialization.
> Today, LocalDataResponse#build serializes row responses without providing a size estimate when initializing a DataOutputBuffer. Read responses that exceed the initial size of 128 bytes incur progressive size doubling, allocation, and buffer copying until the result fits.
> This patch maintains a lightweight moving average of read response sizes and uses this to size the initial response.
> In a read-heavy workload dominated by resultset paging, this change reduces memory allocations/copies by about 9%. [1]
> The change is most visible in the Native-Transport-Requests threadpool.
> *Trunk:*
> {{Thread Pool                                         Threads       Allocated        Count   % of Total}}
> {{----------------------------------------------------------------------------------------------------}}
> {{Native-Transport-Requests                                10       68.45 GiB      348,724       74.02%}}
> *Trunk + Patch:*
> {{Thread Pool                                         Threads       Allocated        Count   % of Total}}
> {{----------------------------------------------------------------------------------------------------}}
> {{Native-Transport-Requests                                11       62.52 GiB      324,523       74.13%}}
> ---
> [1] Workload example: [https://gist.github.com/cscotta/580378387c73b49822f287910771d14f]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org