[
https://issues.apache.org/jira/browse/CASSANDRA-21536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18103196#comment-18103196
]
koo commented on CASSANDRA-21536:
---------------------------------
[~frankgh]
We're running Cassandra 5.0.8 in production and are seeing resource pressure,
so we'd really like to have this improvement available in a future 5.0.x
release. Would it be okay for me to open a PR against the cassandra-5.0 branch?
Also, while going through the patch, it looked like some of the tuning in
there could be applied to 5.0.x as well. Would you be open to including those
as part of the backport?
> Profile pollution in AbstractType.writeValue makes serialization slow for all
> column types
> ------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-21536
> URL: https://issues.apache.org/jira/browse/CASSANDRA-21536
> Project: Apache Cassandra
> Issue Type: Improvement
> Components: Local/Other
> Reporter: koo
> Assignee: koo
> Priority: Normal
> Fix For: 6.0-alpha2, 7.0
>
> Attachments: CASSANDRA-21536-cassandra-6.0-ci_summary.html,
> CASSANDRA-21536-trunk-ci_summary-1.html, CASSANDRA-21536-trunk-ci_summary.html
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> *Description:*
> AbstractType.writeValue() is one shared method. All column types use it.
> Inside writeValue(), it calls valueLengthIfFixed(). This is a virtual call.
> Many types override this method (Int32Type, LongType, UTF8Type, ...).
> In a real cluster, many column types pass through writeValue(). So the
> profile always sees lots types.
> Because of this, the JIT cannot inline the call. It stays as a vtable call.
> Also, the compiled body of writeValue() becomes big, so the JIT refuses to
> inline writeValue() itself ("already compiled into a big method").
> We also see the same itable/vtable stubs in async-profiler output from a real
> cluster, running with default production options and a normal workload.
> *How to solve:*
> Add a final int field to AbstractType. Set it in the constructor.
> writeValue() reads this field instead of calling valueLengthIfFixed().
> A field read needs no type profile. So profile pollution has no effect on it.
> The valueLengthIfFixed() method is not changed. Only the write path uses the
> field.
> *Result:*
> Production is always the polluted state, so this is the real-world comparison
> || || before || after ||
> | M ops/s | 185.0 | 210.4 |
> | improvement | | +13.7% |
> | valueLengthIfFixed frames in profiler | 5.9% | 0% |
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]