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

C. Scott Andreas edited comment on CASSANDRA-21285 at 4/5/26 9:01 PM:
----------------------------------------------------------------------

Uploaded jfr-comparison.zip which includes a JFR capture from trunk and with 
this patch applied as of 1f5c87c in my fork.

Measurement methodology for attached captures: build project, launch instance 
via CCM, launch 5-minute test of linked workload above, perform JFR capture 
during test.

Specifically:

{{– ant realclean jar && ccm create && ccm populate -n 1 && ccm start; sleep 
10;}}
{{– }}{{bin/cassandra-easy-stress run GrowingPartitions --partitions 1000 
--duration 5m --readrate 0.8 --rate 5000}}
{{export PID=$(ps ax | grep CassandraDaemon | cut d ' ' -f 1 | head -n 1); 
}}{{– }}{{echo "Profiling $PID..."; jcmd $PID JFR.start name=profile 
settings=profile +jdk.ObjectAllocationInNewTLAB#enabled=true 
+jdk.ObjectAllocationOutsideTLAB#enabled=true 
+jdk.ObjectAllocationSample#enabled=true duration=300s 
filename=/tmp/cassandra-profile$PID.jfr; sleep 300; open 
/tmp/cassandra-profile-$PID.jfr}}


was (Author: cscotta):
Uploaded jfr-comparison.zip which includes a JFR capture from trunk and with 
this patch applied as of 1f5c87c in my fork.

Measurement methodology for attached captures: build project, launch instance 
via CCM, launch 5-minute test of linked workload above, perform JFR capture 
during test.

Specifically:

– `ant realclean jar && ccm create && ccm populate -n 1 && ccm start; sleep 10;`
– `bin/cassandra-easy-stress run GrowingPartitions --partitions 1000 --duration 
5m --readrate 0.8 --rate 5000`
– `export PID=$(ps ax | grep CassandraDaemon | cut -d ' ' -f 1 | head -n 1); 
echo "Profiling $PID..."; jcmd $PID JFR.start name=profile settings=profile 
+jdk.ObjectAllocationInNewTLAB#enabled=true 
+jdk.ObjectAllocationOutsideTLAB#enabled=true 
+jdk.ObjectAllocationSample#enabled=true duration=300s 
filename=/tmp/cassandra-profile-$PID.jfr; sleep 300; open 
/tmp/cassandra-profile-$PID.jfr`

> 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
>            Assignee: C. Scott Andreas
>            Priority: Low
>             Fix For: 6.x
>
>         Attachments: CASSANDRA-21285.diff, after.png, before.png, 
> buffer-false.allocs.txt, buffer-false.png, initial-patch.allocs.txt, 
> initial-patch.png, jfr-comparison.zip
>
>
> 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