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 8596C200B3C for ; Wed, 13 Jul 2016 09:39:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8422D160A81; Wed, 13 Jul 2016 07:39:22 +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 CD09A160A57 for ; Wed, 13 Jul 2016 09:39:21 +0200 (CEST) Received: (qmail 91396 invoked by uid 500); 13 Jul 2016 07:39:21 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 91341 invoked by uid 99); 13 Jul 2016 07:39:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2016 07:39:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id C94EC2C02A7 for ; Wed, 13 Jul 2016 07:39:20 +0000 (UTC) Date: Wed, 13 Jul 2016 07:39:20 +0000 (UTC) From: "Ravikumar (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-3051) A zero-copy ScatterGatherRead api from FSDataInputStream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 13 Jul 2016 07:39:22 -0000 [ https://issues.apache.org/jira/browse/HDFS-3051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15374535#comment-15374535 ] Ravikumar commented on HDFS-3051: --------------------------------- How about returning the MappedByteBuffers of all blocks for a file in local. If there are non-local blocks, this method can simply return empty. public List readFullyScatterGatherLocal(EnumSet options) throws IOException { return ((PositionedReadable)in).readFullyScatterGather(options); } A quick sample-impl can be like public List readFullyScatterGatherLocal(EnumSet) throws IOException { List blockRange = getBlockRange(0, getFileLength()); if(!allBlocksInLocal(blockRange)) { return; } List retval = new LinkedList(); for(LocatedBlock blk:blockRange) { blkReader = fetchBlockReader(blk, localDNAddrPair); ClientMmap mmap = blkReader.getClientMmap(readOptions); mmap.setunmap(false); //Instruction to cache-eviction to avoid unmapping this. Slots, streams & all other resources will be closed result.add(mmap.getMappedByteBuffer()); closeBlockReader(blkReader); } return retval } Apps opening InputStreams only once (Hbase??) can call this method & use the zero-copy buffers for reads, if file is local. If not available, they can fall back to regular DFSInputStream. Reads can eliminate sync overheads & get same perf as a local filesystem. But I don't know if "leaking" MappedByteBuffers to calling code can have nasty side-effects. > A zero-copy ScatterGatherRead api from FSDataInputStream > -------------------------------------------------------- > > Key: HDFS-3051 > URL: https://issues.apache.org/jira/browse/HDFS-3051 > Project: Hadoop HDFS > Issue Type: Improvement > Components: hdfs-client, performance > Reporter: dhruba borthakur > Assignee: dhruba borthakur > > It will be nice if we can get a new API from FSDtaInputStream that allows for zero-copy read for hdfs readers. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org