You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/07/14 21:54:56 UTC

[GitHub] [kafka] vvcephei commented on pull request #9020: KAFKA-10271 Performance degradation while fetching a key from a single partition

vvcephei commented on pull request #9020:
URL: https://github.com/apache/kafka/pull/9020#issuecomment-658432973


   Hi @dima5rr , thanks for the PR! I was looking into the context of this ticket and noticed that we're essentially just duplicating here the logic in `org.apache.kafka.streams.state.internals.QueryableStoreProvider#getStore`, which also loops over all stores of all providers as a sanity check before even returning the WrappingStoreProvider, which will loop over all stores of all providers _again_ before returning any results.
   
   Anecdotally, I think that most people would actually just query immediately and then discard their store reference, for example like `value = kafkaStreams.store("storeName", partition=2).get("key")`. In that case, this double-iteration is pretty expensive, and the up-front sanity check doesn't seem to provide any value.
   
   What do you think about removing the loop https://github.com/apache/kafka/blob/f699bd98c14e31f07c5a3f6ba9ce2c4b441e7fdb/streams/src/main/java/org/apache/kafka/streams/state/internals/QueryableStoreProvider.java#L59-L77 in favor of the one in here?
   
   Of course, the short-circuit you're providing here is valuable in any case.
   
   Thanks!
   -John


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org