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

Ken Huang updated KAFKA-20854:
------------------------------
    Description: 
AsyncKafkaConsumer wakes up the background thread to process the poll request:
{code:java}
        if (inflightPoll == null) {
            inflightPoll = new AsyncPollEvent(calculateDeadlineMs(timer), 
time.milliseconds());
            newlySubmittedEvent = true;
            log.trace("Inflight event {} submitted", inflightPoll);
            applicationEventHandler.add(inflightPoll);
        }
{code}
And `FetchRequestManager` wakes up the main thread if there are no requests to 
send:
{code:java}
            if (fetchRequests.isEmpty()) {
                // If there's nothing to fetch, wake up the FetchBuffer so it 
doesn't needlessly wait for a wakeup
                // that won't come until the data in the fetch buffer is 
consumed.
                fetchBuffer.wakeup();
                pendingFetchRequestFuture.complete(null);
                return PollResult.EMPTY;
            }
{code}
This is an existing issue, and it has become more obvious after KIP-909, since 
we moved DNS resolution into the poll phase. This means no requests can be sent 
until DNS resolution completes..

  was:
AsyncKafkaConsumer wakes up the background thread to process the poll request:

{code:java}
        if (inflightPoll == null) {
            inflightPoll = new AsyncPollEvent(calculateDeadlineMs(timer), 
time.milliseconds());
            newlySubmittedEvent = true;
            log.trace("Inflight event {} submitted", inflightPoll);
            applicationEventHandler.add(inflightPoll);
        }
{code}

And `FetchRequestManager` wakes up the main thread if there are no requests to 
send: 
{code:java}
            if (fetchRequests.isEmpty()) {
                // If there's nothing to fetch, wake up the FetchBuffer so it 
doesn't needlessly wait for a wakeup
                // that won't come until the data in the fetch buffer is 
consumed.
                fetchBuffer.wakeup();
                pendingFetchRequestFuture.complete(null);
                return PollResult.EMPTY;
            }
{code}

This is an existing issue, and it has become more obvious after KIP-919, since 
we moved DNS resolution into the poll phase. This means no requests can be sent 
until DNS resolution completes..



> A more obvious busy loop due to KIP-909
> ---------------------------------------
>
>                 Key: KAFKA-20854
>                 URL: https://issues.apache.org/jira/browse/KAFKA-20854
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Chia-Ping Tsai
>            Assignee: Ken Huang
>            Priority: Critical
>
> AsyncKafkaConsumer wakes up the background thread to process the poll request:
> {code:java}
>         if (inflightPoll == null) {
>             inflightPoll = new AsyncPollEvent(calculateDeadlineMs(timer), 
> time.milliseconds());
>             newlySubmittedEvent = true;
>             log.trace("Inflight event {} submitted", inflightPoll);
>             applicationEventHandler.add(inflightPoll);
>         }
> {code}
> And `FetchRequestManager` wakes up the main thread if there are no requests 
> to send:
> {code:java}
>             if (fetchRequests.isEmpty()) {
>                 // If there's nothing to fetch, wake up the FetchBuffer so it 
> doesn't needlessly wait for a wakeup
>                 // that won't come until the data in the fetch buffer is 
> consumed.
>                 fetchBuffer.wakeup();
>                 pendingFetchRequestFuture.complete(null);
>                 return PollResult.EMPTY;
>             }
> {code}
> This is an existing issue, and it has become more obvious after KIP-909, 
> since we moved DNS resolution into the poll phase. This means no requests can 
> be sent until DNS resolution completes..



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

Reply via email to