apoorvmittal10 commented on PR #17796:
URL: https://github.com/apache/kafka/pull/17796#issuecomment-2515825189

   > @apoorvmittal10 The listeners utilize a `CopyOnWriteArrayList`, meaning 
that both "add" and "remove" operations can trigger array copies. I am 
concerned that this could lead to performance issues when a partition becomes a 
follower, as it may result in `n * (n + 1) / 2` copies when listeners are 
removed one by one.
   
   @chia7712 Yes, you are right it's `CopyOnWriteArrayList`. I considered that 
initially and my thought process was that `listeners (CopyOnWriteArrayList)` is 
per Partition. Hence a partition listener can contain listeners at most to the 
number of share groups on a broker. Yes, if the number of groups in really huge 
then it might cause a bit delay. Do you think that is a concern?
   If yes, then I can have a single SharePartitionListener which keeps a 
mapping of `topicPartitions to set of sharePartitionKeys`.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to