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 3FFF5200D14 for ; Tue, 19 Sep 2017 06:45:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3E7EE1609DE; Tue, 19 Sep 2017 04:45:13 +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 84E391609DB for ; Tue, 19 Sep 2017 06:45:12 +0200 (CEST) Received: (qmail 21355 invoked by uid 500); 19 Sep 2017 04:45:11 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 21346 invoked by uid 99); 19 Sep 2017 04:45:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Sep 2017 04:45:11 +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 F33921A31FF for ; Tue, 19 Sep 2017 04:45:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.001 X-Spam-Level: X-Spam-Status: No, score=-100.001 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Z2vNZw-eY_M6 for ; Tue, 19 Sep 2017 04:45:09 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 6EDCC5F3CF for ; Tue, 19 Sep 2017 04:45:08 +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 F3513E0F2B for ; Tue, 19 Sep 2017 04:45:05 +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 547FF2416E for ; Tue, 19 Sep 2017 04:45:03 +0000 (UTC) Date: Tue, 19 Sep 2017 04:45:03 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-7394) Implement basic InputChannel for credit-based logic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 19 Sep 2017 04:45:13 -0000 [ https://issues.apache.org/jira/browse/FLINK-7394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16171114#comment-16171114 ] ASF GitHub Bot commented on FLINK-7394: --------------------------------------- Github user zhijiangW commented on a diff in the pull request: https://github.com/apache/flink/pull/4499#discussion_r139596400 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java --- @@ -183,18 +214,40 @@ void notifySubpartitionConsumed() { } /** - * Releases all received buffers and closes the partition request client. + * Releases all received and available buffers, closes the partition request client. */ @Override void releaseAllResources() throws IOException { if (isReleased.compareAndSet(false, true)) { + + final List recyclingSegments = new ArrayList<>(); + synchronized (receivedBuffers) { Buffer buffer; while ((buffer = receivedBuffers.poll()) != null) { - buffer.recycle(); + if (buffer.getRecycler() == this) { + recyclingSegments.add(buffer.getMemorySegment()); --- End diff -- I also considered this issue when implementation. The current way seems more verbose than directly calling `recycle()`, but there are two advantages: 1. Exclusive buffers are recycled in batch which may be more performant as you mentioned above. 2. If calling `recycle()` directly, it should add extra check `isReleased` process outside the synchronized in `RemoteInputChannel#recycle` method. It seems not elegant to do so. What do you think of this issue? > Implement basic InputChannel for credit-based logic > --------------------------------------------------- > > Key: FLINK-7394 > URL: https://issues.apache.org/jira/browse/FLINK-7394 > Project: Flink > Issue Type: Sub-task > Components: Core > Reporter: zhijiang > Assignee: zhijiang > Fix For: 1.4.0 > > > This is a part of work for credit-based network flow control. > The basic works are: > * Propose the {{BufferListener}} interface for notifying buffer availability and buffer destroyed. > * {{RemoteInputChannel}} implements {{BufferRecycler}} interface to manage the exclusive buffers itself. > * {{RemoteInputChannel}} implements {{BufferListener}} interface to be notified repeatedly . > * {{RemoteInputChannel}} maintains and notifies of unannounced credit. > * {{RemoteInputChannel}} maintains current sender backlog to trigger requests of floating buffers. -- This message was sent by Atlassian JIRA (v6.4.14#64029)