Return-Path: Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: (qmail 4257 invoked from network); 5 Jun 2010 00:18:25 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Jun 2010 00:18:25 -0000 Received: (qmail 72092 invoked by uid 500); 5 Jun 2010 00:18:25 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 72060 invoked by uid 500); 5 Jun 2010 00:18:25 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 72052 invoked by uid 99); 5 Jun 2010 00:18:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jun 2010 00:18:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jun 2010 00:18:23 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o550I18a018698 for ; Sat, 5 Jun 2010 00:18:01 GMT Message-ID: <5947984.193711275697081463.JavaMail.jira@thor> Date: Fri, 4 Jun 2010 20:18:01 -0400 (EDT) From: "Konstantin Shvachko (JIRA)" To: hdfs-issues@hadoop.apache.org Subject: [jira] Commented: (HDFS-1110) Namenode heap optimization - reuse objects for commonly used file names In-Reply-To: <26851282.14551272307412975.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HDFS-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875805#action_12875805 ] Konstantin Shvachko commented on HDFS-1110: ------------------------------------------- # variable {{cache}} should read {{nameCache}} # comment for it should be transformed to JavaDoc comments. # {{FSDirectory.cache}} should be initialized in the constructor rather than during declaration. And 10 should be declared as a constant. # I would consider using NameCache instead of NameCache. You get less objects and conversions, if of course I didn't miss anything here. # Introduce {{FSDirectory.cache(INode)}} method, which calls NameCache.put(). # In NameCache some comments need clarification #- "This class has two phases" Probably something else has 2 phases. #- "This class must be synchronized externally" #- Member inline comments should be transformed into javadoc. # NameCache.cache should be initialized in the constructor rather than during declaration. # {{UseCount}} should probably be a private inner (rather than static) class, and should use the same parameter K with which NameCache is parametrized. {code} private class UseCount { int count; // Number of times a name occurs final K value; // Internal value for the name UseCount(final K value) { this.value = value; } } {code} # {{UseCount.count}} should be initialized in the constructor. It is better to have increment() and get() methods rather than accessing count directly from the outside. I like the idea of using the useThreshold to determine names that should be promoted to the nameCache. My main concern is, that the threshold is 10. This means there will a lot of names in the cache. And all these names are in a HashTable, which has a huge overhead, as we know from another jira. We still save space, but for names that occur only 10 times the savings are probably negligible. I would imagine that only 5% or 10% of the most frequently used names get promoted. It is fine with me to use this simple promoting scheme as a starting point, with an intention to optimize it later. But I would increase the useThreshold to 1000 or so. Should we make it configurable? Could be useful for testing. > Namenode heap optimization - reuse objects for commonly used file names > ----------------------------------------------------------------------- > > Key: HDFS-1110 > URL: https://issues.apache.org/jira/browse/HDFS-1110 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: Suresh Srinivas > Assignee: Suresh Srinivas > Fix For: 0.22.0 > > Attachments: hdfs-1110.2.patch, hdfs-1110.3.patch, hdfs-1110.4.patch, hdfs-1110.patch > > > There are a lot of common file names used in HDFS, mainly created by mapreduce, such as file names starting with "part". Reusing byte[] corresponding to these recurring file names will save significant heap space used for storing the file names in millions of INodeFile objects. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.