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

Andres de la Peña commented on CASSANDRA-18248:
-----------------------------------------------

Yep, the purpose of the list was just showing that we commonly use streams when 
building a query. I think the status quo is that we only systematically avoid 
streams on things that are run for every column, and perhaps for every row.

The number of calls to streams used for building a query should in theory be 
some orders of magnitude lesser than in the per-row or per-column things. So 
their performance impact should be significantly lesser, even if there weren't 
any prepared statements. I suspect that the performance impact is negligible, 
and it probably worths any readability/maintainability benefits. But I don't 
have any proof of this.

I understand that the purpose of this ticket is measuring what performance 
impact those streams have in the broader context of a query, and then evaluate 
whether we should remove them or not. That should also allow us to establish a 
clear policy on when streams should be avoided. Maybe the title of the ticket 
should be something more impartial about the conclusions of that analysis, and 
perhaps with a limited scope. Something such as "Evaluate the performance of 
streams on query building" or "Consider avoiding streams on query building". 
wdyt?

Regarding the contents of the list, I compiled it quite quickly so it's 
probably not complete and might contain some errors. I tried to exclude streams 
that didn't seem to be used on every {{{}SELECT{}}}/{{{}INSERT{}}}. I didn't 
search for streams outside of the CQL package that might be involved in 
{{{}SELECT{}}}/{{{}INSERT{}}} queries, although there could be some of them. 
For example, we seem to have a bunch of streams on the authentication package. 
Some of them might also be used on every query.

> Avoid streams usage in potential hot paths
> ------------------------------------------
>
>                 Key: CASSANDRA-18248
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18248
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Berenguer Blasi
>            Priority: Normal
>              Labels: low-hanging-fruit
>
> During the review of CASSANDRA-18068 it was discussed whether preparing 
> queries might be considered a hot path or not. Seen in isolation it isn't. 
> But given multi-tenancy setups i.e. and coming from the experience of seeing 
> how prepare is used by some customers as per some bug reports this might not 
> be 100% true
> Let's discuss here if removing streams would make any sense. Most rewrites I 
> expect wouldn't impact readability. [~adelapena] took a first stab and 
> compiled a first list of candidates:
>  * 
> [o.a.c.cql3/CQL3Type.java#L840|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/CQL3Type.java#L840]
>  * 
> [o.a.c.cql3/CQL3Type.java#L876|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/CQL3Type.java#L876]
>  * 
> [o.a.c.cql3/Lists.java#L133|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/Lists.java#L133]
>  * 
> [o.a.c.cql3/Sets.java#L123|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/Sets.java#L123]
>  * 
> [o.a.c.cql3/MultiColumnRelation.java#L225|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/MultiColumnRelation.java#L225]
>  * 
> [o.a.c.cql3/QueryProcessor.java#L481|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/QueryProcessor.java#L481]
>  * 
> [o.a.c.cql3/TokenRelation.java#L138|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/TokenRelation.java#L138]
>  * 
> [o.a.c.cql3/conditions/ColumnConditions.java#L75|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/conditions/ColumnConditions.java#L75]
>  * 
> [o.a.c.cql3/functions/AbstractFunction.java#L69|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/functions/AbstractFunction.java#L69]
>  * 
> [o.a.c.cql3/functions/FunctionResolver.java#L203|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/functions/FunctionResolver.java#L203]
>  * 
> [o.a.c.cql3/functions/UDAggregate.java#L97|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/functions/UDAggregate.java#L97]
>  * 
> [o.a.c.cql3/restrictions/StatementRestrictions.java#L380|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/restrictions/StatementRestrictions.java#L380]
>  * 
> [o.a.c.cql3/selection/AbstractFunctionSelector.java#L72|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/AbstractFunctionSelector.java#L72]
>  * 
> [o.a.c.cql3/selection/MapSelector.java#L113|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/MapSelector.java#L113]
>  * 
> [o.a.c.cql3/selection/Selectable.java#L708|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/Selectable.java#L708]
>  * 
> [o.a.c.cql3/selection/Selectable.java#L793|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/Selectable.java#L793]
>  * 
> [o.a.c.cql3/selection/Selectable.java#L886|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/Selectable.java#L886]
>  * 
> [o.a.c.cql3/selection/Selectable.java#L954|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/Selectable.java#L954]
>  * 
> [o.a.c.cql3/selection/Selectable.java#L1024|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/selection/Selectable.java#L1024]
>  * 
> [o.a.c.cql3/statements/SelectStatement.java#L1278|https://github.com/apache/cassandra/blob/cassandra-4.1.0/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java#L1278]



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

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

Reply via email to