C. Scott Andreas created CASSANDRA-21285:
--------------------------------------------

             Summary: 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
         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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to