[ 
https://issues.apache.org/jira/browse/KAFKA-18071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lianet Magrans updated KAFKA-18071:
-----------------------------------
    Description: 
With the new consumer, the poll loop currently generates an 
UpdatePatternSubscriptionEvent on each poll iteration, that is processed in the 
background to re-eval the subscription regex against the latest metadata (if 
there is new metadata).
 
If the consumer is not subscribed to a pattern, we still generate this event, 
and early return in the background thread if !hasSubscriptionPattern. We should 
consider short-circuiting this on the app thread, to avoid generating the event 
and blocking on it's processing if not needed.
 
Note that checking subscription.hasSubscriptionPattern in the app thread should 
be safe given that it changes only triggered from the app thread, when calling 
subscribe/assign, which all block until the subscription state is updated.

  was:
With the new consumer, the poll loop currently generates an 
UpdatePatternSubscriptionEvent on each poll iteration, that is processed in the 
background to re-eval the subscription regex against the latest metadata (if 
there is new metadata).
 
If the consumer is not subscribed to a pattern, we still generate this event, 
and early return in the background thread if !hasSubscriptionPattern. We should 
consider short-circuiting this on the app thread, to avoid generating the event 
and blocking on it's processing if not needed.
 
Note that checking subscription.hasSubscriptionPattern in the app thread should 
be safe given that it changes only triggered from the app thread, when calling 
subscribe(Pattern), which blocks until the subscription state is updated.


> Avoid unneeded background event to refresh regex if no subscription pattern 
> in use
> ----------------------------------------------------------------------------------
>
>                 Key: KAFKA-18071
>                 URL: https://issues.apache.org/jira/browse/KAFKA-18071
>             Project: Kafka
>          Issue Type: Improvement
>          Components: clients, consumer
>            Reporter: Lianet Magrans
>            Assignee: Lianet Magrans
>            Priority: Minor
>              Labels: consumer-threading-refactor
>             Fix For: 4.0.0
>
>
> With the new consumer, the poll loop currently generates an 
> UpdatePatternSubscriptionEvent on each poll iteration, that is processed in 
> the background to re-eval the subscription regex against the latest metadata 
> (if there is new metadata).
>  
> If the consumer is not subscribed to a pattern, we still generate this event, 
> and early return in the background thread if !hasSubscriptionPattern. We 
> should consider short-circuiting this on the app thread, to avoid generating 
> the event and blocking on it's processing if not needed.
>  
> Note that checking subscription.hasSubscriptionPattern in the app thread 
> should be safe given that it changes only triggered from the app thread, when 
> calling subscribe/assign, which all block until the subscription state is 
> updated.



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

Reply via email to