From hdfs-issues-return-209725-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed Feb 7 21:35:07 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 6053118065B for ; Wed, 7 Feb 2018 21:35:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4F3EC160C3A; Wed, 7 Feb 2018 20:35:07 +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 6E00C160C5B for ; Wed, 7 Feb 2018 21:35:06 +0100 (CET) Received: (qmail 32397 invoked by uid 500); 7 Feb 2018 20:35:05 -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 32364 invoked by uid 99); 7 Feb 2018 20:35:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Feb 2018 20:35:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id E9B53C2F84 for ; Wed, 7 Feb 2018 20:35:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id BNq1iv29zWcX for ; Wed, 7 Feb 2018 20:35: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 C59525F125 for ; Wed, 7 Feb 2018 20:35: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 D0435E015F for ; Wed, 7 Feb 2018 20:35:00 +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 3CAF421E85 for ; Wed, 7 Feb 2018 20:35:00 +0000 (UTC) Date: Wed, 7 Feb 2018 20:35:00 +0000 (UTC) From: "Yongjun Zhang (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-12051) Reimplement NameCache in NameNode: Intern duplicate byte[] arrays (mainly those denoting file/directory names) to save memory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-12051?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1635= 6026#comment-16356026 ]=20 Yongjun Zhang commented on HDFS-12051: -------------------------------------- Thanks=C2=A0[~misha@cloudera.com]=C2=A0for the new revs and=C2=A0[~szetszwo= ]=C2=A0for the review. Hi Misha, Sorry I did not review your latest rev in time. One minor suggestion, the r= atio config is more intuitive to be a floating point, like other ratio kind= of config parameters in DFSConfigKeys.java. I noticed that the default val= ue in the code and in hdfs-default.xml is not the same. We need to make the= m same. Hi=C2=A0[~szetszwo], are you ok with setting the default cache ratio to 1/4= 00 (0.0025)?=C2=A0 Given that the existing cache is not working well for so= me cases we examined, would you agree to push this forward? Thanks. =C2=A0 > Reimplement NameCache in NameNode: Intern duplicate byte[] arrays (mainly= those denoting file/directory names) to save memory > -------------------------------------------------------------------------= ---------------------------------------------------- > > Key: HDFS-12051 > URL: https://issues.apache.org/jira/browse/HDFS-12051 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: Misha Dmitriev > Assignee: Misha Dmitriev > Priority: Major > Attachments: HDFS-12051-NameCache-Rewrite.pdf, HDFS-12051.01.patc= h, HDFS-12051.02.patch, HDFS-12051.03.patch, HDFS-12051.04.patch, HDFS-1205= 1.05.patch, HDFS-12051.06.patch, HDFS-12051.07.patch, HDFS-12051.08.patch, = HDFS-12051.09.patch, HDFS-12051.10.patch > > > When snapshot diff operation is performed in a NameNode that manages seve= ral million HDFS files/directories, NN needs a lot of memory. Analyzing one= heap dump with jxray (www.jxray.com), we observed that duplicate byte[] ar= rays result in 6.5% memory overhead, and most of these arrays are reference= d by {{org.apache.hadoop.hdfs.server.namenode.INodeFileAttributes$SnapshotC= opy.name}} and {{org.apache.hadoop.hdfs.server.namenode.INodeFile.name}}: > {code:java} > 19. DUPLICATE PRIMITIVE ARRAYS > Types of duplicate objects: > Ovhd Num objs Num unique objs Class name > 3,220,272K (6.5%) 104749528 25760871 byte[] > .... > 1,841,485K (3.7%), 53194037 dup arrays (13158094 unique) > 3510556 of byte[17](112, 97, 114, 116, 45, 109, 45, 48, 48, 48, ...), 222= 8255 of byte[8](48, 48, 48, 48, 48, 48, 95, 48), 357439 of byte[17](112, 97= , 114, 116, 45, 109, 45, 48, 48, 48, ...), 237395 of byte[8](48, 48, 48, 48= , 48, 49, 95, 48), 227853 of byte[17](112, 97, 114, 116, 45, 109, 45, 48, 4= 8, 48, ...), 179193 of byte[17](112, 97, 114, 116, 45, 109, 45, 48, 48, 48,= ...), 169487 of byte[8](48, 48, 48, 48, 48, 50, 95, 48), 145055 of byte[17= ](112, 97, 114, 116, 45, 109, 45, 48, 48, 48, ...), 128134 of byte[8](48, 4= 8, 48, 48, 48, 51, 95, 48), 108265 of byte[17](112, 97, 114, 116, 45, 109, = 45, 48, 48, 48, ...) > ... and 45902395 more arrays, of which 13158084 are unique > <-- org.apache.hadoop.hdfs.server.namenode.INodeFileAttributes$Snaps= hotCopy.name <-- org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiff.s= napshotINode <-- {j.u.ArrayList} <-- org.apache.hadoop.hdfs.server.namenod= e.snapshot.FileDiffList.diffs <-- org.apache.hadoop.hdfs.server.namenode.sn= apshot.FileWithSnapshotFeature.diffs <-- org.apache.hadoop.hdfs.server.name= node.INode$Feature[] <-- org.apache.hadoop.hdfs.server.namenode.INodeFile.f= eatures <-- org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo.bc <-- = ... (1 elements) ... <-- org.apache.hadoop.hdfs.server.blockmanagement.Bloc= ksMap$1.entries <-- org.apache.hadoop.hdfs.server.blockmanagement.BlocksMap= .blocks <-- org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.bloc= ksMap <-- org.apache.hadoop.hdfs.server.blockmanagement.BlockManager$BlockR= eportProcessingThread.this$0 <-- j.l.Thread[] <-- j.l.ThreadGroup.threads <= -- j.l.Thread.group <-- Java Static: org.apache.hadoop.fs.FileSystem$Statis= tics.STATS_DATA_CLEANER > 409,830K (0.8%), 13482787 dup arrays (13260241 unique) > 430 of byte[32](116, 97, 115, 107, 95, 49, 52, 57, 55, 48, ...), 353 of b= yte[32](116, 97, 115, 107, 95, 49, 52, 57, 55, 48, ...), 352 of byte[32](11= 6, 97, 115, 107, 95, 49, 52, 57, 55, 48, ...), 350 of byte[32](116, 97, 115= , 107, 95, 49, 52, 57, 55, 48, ...), 342 of byte[32](116, 97, 115, 107, 95,= 49, 52, 57, 55, 48, ...), 341 of byte[32](116, 97, 115, 107, 95, 49, 52, 5= 7, 55, 48, ...), 341 of byte[32](116, 97, 115, 107, 95, 49, 52, 57, 55, 48,= ...), 340 of byte[32](116, 97, 115, 107, 95, 49, 52, 57, 55, 48, ...), 337= of byte[32](116, 97, 115, 107, 95, 49, 52, 57, 55, 48, ...), 334 of byte[3= 2](116, 97, 115, 107, 95, 49, 52, 57, 55, 48, ...) > ... and 13479257 more arrays, of which 13260231 are unique > <-- org.apache.hadoop.hdfs.server.namenode.INodeFile.name <-- org.ap= ache.hadoop.hdfs.server.blockmanagement.BlockInfo.bc <-- org.apache.hadoop.= util.LightWeightGSet$LinkedElement[] <-- org.apache.hadoop.hdfs.server.bloc= kmanagement.BlocksMap$1.entries <-- org.apache.hadoop.hdfs.server.blockmana= gement.BlocksMap.blocks <-- org.apache.hadoop.hdfs.server.blockmanagement.B= lockManager.blocksMap <-- org.apache.hadoop.hdfs.server.blockmanagement.Blo= ckManager$BlockReportProcessingThread.this$0 <-- j.l.Thread[] <-- org.apach= e.hadoop.hdfs.server.blockmanagement.BlocksMap$1.entries <-- org.apache.had= oop.hdfs.server.blockmanagement.BlocksMap.blocks <-- org.apache.hadoop.hdfs= .server.blockmanagement.BlockManager.blocksMap <-- org.apache.hadoop.hdfs.s= erver.blockmanagement.BlockManager$BlockReportProcessingThread.this$0 <-- j= .l.Thread[] <-- j.l.ThreadGroup.threads <-- j.l.Thread.group <-- Java Stati= c: org.apache.hadoop.fs.FileSystem$Statistics.STATS_DATA_CLEANER > .... > {code} > There are several other places in NameNode code which also produce duplic= ate {{byte[]}} arrays. > To eliminate this duplication and reclaim memory, we will need to write a= small class similar to StringInterner, but designed specifically for byte[= ] arrays. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org