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

Dmitry Konstantinov commented on CASSANDRA-21359:
-------------------------------------------------

Thank you for the review

6.0 CI run, failed tests:
{code}
Tests / jvm-dtest jdk17 4/16 / 
org.apache.cassandra.distributed.test.accord.AccordMigrationTest.testPaxosToAccordCAS-_jdk17_x86_64
Tests / jvm-dtest jdk17 4/16 / 
org.apache.cassandra.distributed.test.accord.AccordMigrationTest.testPaxosToAccordSerialRead-_jdk17_x86_64
Tests / dtest-latest jdk17 7/64 / 
dtest-latest.bootstrap_test.TestBootstrap.test_consistent_range_movement_false_with_rf1_should_succeed
Tests / dtest-latest jdk17 6/64 / 
dtest-latest.bootstrap_test.TestBootstrap.test_consistent_range_movement_true_with_rf1_should_fail
Tests / dtest-latest jdk17 34/64 / 
dtest-latest.client_request_metrics_test.TestClientRequestMetrics.test_client_request_metrics
Tests / dtest-latest jdk17 23/64 / 
dtest-latest.replace_address_test.TestReplaceAddress.test_replace_with_insufficient_replicas
Tests / dtest-latest jdk17 23/64 / 
dtest-latest.replace_address_test.TestReplaceAddress.test_replace_with_insufficient_replicas
Tests / dtest-latest jdk17 23/64 / 
dtest-latest.replace_address_test.TestReplaceAddress.test_replace_with_insufficient_replicas
{code}
all are known issues and not related to the change.

> Reduce allocation in row merge logic
> ------------------------------------
>
>                 Key: CASSANDRA-21359
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21359
>             Project: Apache Cassandra
>          Issue Type: Improvement
>          Components: Local/Other
>            Reporter: Dmitry Konstantinov
>            Assignee: Dmitry Konstantinov
>            Priority: Normal
>             Fix For: 6.x, 7.x
>
>         Attachments: image-2026-05-09-15-14-10-274.png, 
> image-2026-05-09-15-26-52-036.png
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> background: 10 rows partition read test, CASSANDRA-21354 change applied
> Suggestions (~2% reduction):
> * org.apache.cassandra.utils.MergeIterator.Candidate - has Comparator field 
> which is the same for all Candidates  under an MergeIterator instance, we can 
> move the field to MergeIterator level. Candidate is 4.8% of all allocations 
> and we can save 20% (~1% of all allocations) of it for JDK 21 with compressed 
> references on.
> {code}
> org.apache.cassandra.utils.MergeIterator$Candidate object internals:
> OFF  SZ                   TYPE DESCRIPTION               VALUE
>   0   8                        (object header: mark)     N/A
>   8   4                        (object header: class)    N/A
>  12   4                    int Candidate.idx             N/A
>  16   1                boolean Candidate.equalParent     N/A
>  17   3                        (alignment/padding gap)   
>  20   4     java.util.Iterator Candidate.iter            N/A
>  24   4   java.util.Comparator Candidate.comp            N/A
>  28   4       java.lang.Object Candidate.item            N/A
>  32   4       java.lang.Object Candidate.lowerBound      N/A
>  36   4                        (object alignment gap)    
> Instance size: 40 bytes
> {code}
> without comp we dropped to 32 bytes, so 20% less object size
> {code}
> OFF  SZ                 TYPE DESCRIPTION               VALUE
>   0   8                      (object header: mark)     N/A
>   8   4                      (object header: class)    N/A
>  12   4                  int Candidate.idx             N/A
>  16   1              boolean Candidate.equalParent     N/A
>  17   3                      (alignment/padding gap)   
>  20   4   java.util.Iterator Candidate.iter            N/A
>  24   4     java.lang.Object Candidate.item            N/A
>  28   4     java.lang.Object Candidate.lowerBound      N/A
> Instance size: 32 bytes
> {code}
> If compressed refs are disabled then the size: 56 vs 48 bytes
>  !image-2026-05-09-15-14-10-274.png|width=400! 
> * we can switch from ArrayList to array in 
> org.apache.cassandra.db.rows.Row.Merger 
> The ArrayList iterator costs 0.72% and BulkIterator.Adapter costs 0.35%. So, 
> in total we can save here ~1% of total allocations.
>  !image-2026-05-09-15-26-52-036.png|width=400! 



--
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