Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9DEB1200D18 for ; Wed, 11 Oct 2017 12:56:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 930AE1609E4; Wed, 11 Oct 2017 10:56:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 43E7A1609CA for ; Wed, 11 Oct 2017 12:56:56 +0200 (CEST) Received: (qmail 71893 invoked by uid 500); 11 Oct 2017 10:56:54 -0000 Mailing-List: contact jira-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@kafka.apache.org Delivered-To: mailing list jira@kafka.apache.org Received: (qmail 71882 invoked by uid 99); 11 Oct 2017 10:56:54 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Oct 2017 10:56:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 463BA1A572A for ; Wed, 11 Oct 2017 10:45:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id iwrG5dtWsIfq for ; Wed, 11 Oct 2017 10:45:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id B082260DFE for ; Wed, 11 Oct 2017 10:45:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 40E66E0F2F for ; Wed, 11 Oct 2017 10:45:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id BCF6025399 for ; Wed, 11 Oct 2017 10:45:00 +0000 (UTC) Date: Wed, 11 Oct 2017 10:45:00 +0000 (UTC) From: "Maytee Chinavanichkit (JIRA)" To: jira@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Issue Comment Deleted] (KAFKA-6051) ReplicaFetcherThread should close the ReplicaFetcherBlockingSend earlier on shutdown MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 11 Oct 2017 10:56:57 -0000 [ https://issues.apache.org/jira/browse/KAFKA-6051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Maytee Chinavanichkit updated KAFKA-6051: ----------------------------------------- Comment: was deleted (was: https://github.com/apache/kafka/pull/4056) > ReplicaFetcherThread should close the ReplicaFetcherBlockingSend earlier on shutdown > ------------------------------------------------------------------------------------ > > Key: KAFKA-6051 > URL: https://issues.apache.org/jira/browse/KAFKA-6051 > Project: Kafka > Issue Type: Bug > Reporter: Maytee Chinavanichkit > > The ReplicaFetcherBlockingSend works as designed and will blocks until it is able to get data. This becomes a problem when we are gracefully shutting down a broker. The controller will attempt to shutdown the fetchers and elect new leaders. When the last fetch of partition is removed, as part of the {replicaManager.becomeLeaderOrFollower} call will proceed to shut down any idle ReplicaFetcherThread. The shutdown process here can block up to until the last fetch request completes. This blocking delay is a big problem because the {replicaStateChangeLock}, and {mapLock} in {AbstractFetcherManager} is still locked causing latency spikes on multiple brokers. > At this point in time, we do not need the last response as the fetcher is shutting down. We should close the leaderEndpoint early during {initiateShutdown()} instead of after {super.shutdown()}. > For example we see here the shutdown blocked the broker from processing more replica changes for ~500 ms > {code} > [2017-09-01 18:11:42,879] INFO [ReplicaFetcherThread-0-2], Shutting down (kafka.server.ReplicaFetcherThread) > [2017-09-01 18:11:43,314] INFO [ReplicaFetcherThread-0-2], Stopped (kafka.server.ReplicaFetcherThread) > [2017-09-01 18:11:43,314] INFO [ReplicaFetcherThread-0-2], Shutdown completed (kafka.server.ReplicaFetcherThread) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)