Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7196410616 for ; Thu, 13 Mar 2014 21:04:27 +0000 (UTC) Received: (qmail 4524 invoked by uid 500); 13 Mar 2014 21:04:26 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 4480 invoked by uid 500); 13 Mar 2014 21:04:25 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 4472 invoked by uid 99); 13 Mar 2014 21:04:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2014 21:04:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Mar 2014 21:04:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 96CB123888FE; Thu, 13 Mar 2014 21:04:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1577319 - in /hadoop/common/trunk/hadoop-hdfs-project: hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java hadoop-hdfs/CHANGES.txt hadoop-hdfs/src/site/apt/HdfsNfsGateway.apt.vm Date: Thu, 13 Mar 2014 21:04:00 -0000 To: hdfs-commits@hadoop.apache.org From: brandonli@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140313210400.96CB123888FE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: brandonli Date: Thu Mar 13 21:03:59 2014 New Revision: 1577319 URL: http://svn.apache.org/r1577319 Log: HDFS-6080. Improve NFS gateway performance by making rtmax and wtmax configurable. Contributed by Abin Shahab Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsNfsGateway.apt.vm Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java?rev=1577319&r1=1577318&r2=1577319&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/RpcProgramNfs3.java Thu Mar 13 21:03:59 2014 @@ -142,9 +142,6 @@ public class RpcProgramNfs3 extends RpcP (short) DEFAULT_UMASK); static final Log LOG = LogFactory.getLog(RpcProgramNfs3.class); - private static final int MAX_READ_TRANSFER_SIZE = 64 * 1024; - private static final int MAX_WRITE_TRANSFER_SIZE = 64 * 1024; - private static final int MAX_READDIR_TRANSFER_SIZE = 64 * 1024; private final Configuration config = new Configuration(); private final WriteManager writeManager; @@ -553,7 +550,11 @@ public class RpcProgramNfs3 extends RpcP + handle.getFileId()); return new READLINK3Response(Nfs3Status.NFS3ERR_SERVERFAULT); } - if (MAX_READ_TRANSFER_SIZE < target.getBytes().length) { + int rtmax = config.getInt(Nfs3Constant.MAX_READ_TRANSFER_SIZE_KEY, + Nfs3Constant.MAX_READ_TRANSFER_SIZE_DEFAULT); + if (rtmax < target.getBytes().length) { + LOG.error("Link size: " + target.getBytes().length + + " is larger than max transfer size: " + rtmax); return new READLINK3Response(Nfs3Status.NFS3ERR_IO, postOpAttr, new byte[0]); } @@ -649,7 +650,9 @@ public class RpcProgramNfs3 extends RpcP } try { - int buffSize = Math.min(MAX_READ_TRANSFER_SIZE, count); + int rtmax = config.getInt(Nfs3Constant.MAX_READ_TRANSFER_SIZE_KEY, + Nfs3Constant.MAX_READ_TRANSFER_SIZE_DEFAULT); + int buffSize = Math.min(rtmax, count); byte[] readbuffer = new byte[buffSize]; int readCount = 0; @@ -1714,9 +1717,12 @@ public class RpcProgramNfs3 extends RpcP } try { - int rtmax = MAX_READ_TRANSFER_SIZE; - int wtmax = MAX_WRITE_TRANSFER_SIZE; - int dtperf = MAX_READDIR_TRANSFER_SIZE; + int rtmax = config.getInt(Nfs3Constant.MAX_READ_TRANSFER_SIZE_KEY, + Nfs3Constant.MAX_READ_TRANSFER_SIZE_DEFAULT); + int wtmax = config.getInt(Nfs3Constant.MAX_WRITE_TRANSFER_SIZE_KEY, + Nfs3Constant.MAX_WRITE_TRANSFER_SIZE_DEFAULT); + int dtperf = config.getInt(Nfs3Constant.MAX_READDIR_TRANSFER_SIZE_KEY, + Nfs3Constant.MAX_READDIR_TRANSFER_SIZE_DEFAULT); Nfs3FileAttributes attrs = Nfs3Utils.getFileAttr(dfsClient, Nfs3Utils.getFileIdPath(handle), iug); Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1577319&r1=1577318&r2=1577319&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Mar 13 21:03:59 2014 @@ -400,6 +400,9 @@ Release 2.4.0 - UNRELEASED HDFS-6072. Clean up dead code of FSImage. (wheat9) + HDFS-6080. Improve NFS gateway performance by making rtmax and wtmax + configurable. (Abin Shahab via brandonli) + OPTIMIZATIONS HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsNfsGateway.apt.vm URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsNfsGateway.apt.vm?rev=1577319&r1=1577318&r2=1577319&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsNfsGateway.apt.vm (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/site/apt/HdfsNfsGateway.apt.vm Thu Mar 13 21:03:59 2014 @@ -48,35 +48,48 @@ HDFS NFS Gateway The user running the NFS-gateway must be able to proxy all the users using the NFS mounts. For instance, if user 'nfsserver' is running the gateway, and users belonging to the groups 'nfs-users1' - and 'nfs-users2' use the NFS mounts, then in core-site.xml of the namenode, the following must be set: + and 'nfs-users2' use the NFS mounts, then in core-site.xml of the namenode, the following must be set + (NOTE: replace 'nfsserver' with the user name starting the gateway in your cluster): + ---- hadoop.proxyuser.nfsserver.groups nfs-users1,nfs-users2 - The 'nfsserver' user is allowed to proxy all members of the 'nfs-users1' and 'nfs-users2' groups. Set this to '*' to allow nfsserver user to proxy any group. + The 'nfsserver' user is allowed to proxy all members of the 'nfs-users1' and + 'nfs-users2' groups. Set this to '*' to allow nfsserver user to proxy any group. +---- + +---- hadoop.proxyuser.nfsserver.hosts nfs-client-host1.com - This is the host where the nfs gateway is running. Set this to '*' to allow requests from any hosts to be proxied. + This is the host where the nfs gateway is running. Set this to '*' to allow + requests from any hosts to be proxied. ---- + The above are the only required configuration for the NFS gateway in non-secure mode. For Kerberized hadoop clusters, the following configurations need to be added to hdfs-site.xml: + ---- - - dfs.nfsgateway.keytab.file - /etc/hadoop/conf/nfsserver.keytab - - - dfs.nfsgateway.kerberos.principal - nfsserver/_HOST@YOUR-REALM.COM - + + dfs.nfsgateway.keytab.file + /etc/hadoop/conf/nfsserver.keytab + +---- + +---- + + dfs.nfsgateway.kerberos.principal + nfsserver/_HOST@YOUR-REALM.COM + ---- + It's strongly recommended for the users to update a few configuration properties based on their use cases. All the related configuration properties can be added or updated in hdfs-site.xml. @@ -90,31 +103,61 @@ HDFS NFS Gateway dfs.namenode.accesstime.precision 3600000 - The access time for HDFS file is precise upto this value. + The access time for HDFS file is precise upto this value. The default value is 1 hour. Setting a value of 0 disables access times for HDFS. ---- - * Users are expected to update the file dump directory. NFS client often + * Users are expected to update the file dump directory. NFS client often reorders writes. Sequential writes can arrive at the NFS gateway at random order. This directory is used to temporarily save out-of-order writes - before writing to HDFS. For each file, the out-of-order writes are dumped after + before writing to HDFS. For each file, the out-of-order writes are dumped after they are accumulated to exceed certain threshold (e.g., 1MB) in memory. One needs to make sure the directory has enough - space. For example, if the application uploads 10 files with each having + space. For example, if the application uploads 10 files with each having 100MB, it is recommended for this directory to have roughly 1GB space in case if a - worst-case write reorder happens to every file. Only NFS gateway needs to restart after + worst-case write reorder happens to every file. Only NFS gateway needs to restart after this property is updated. ---- - dfs.nfs3.dump.dir + dfs.nfs3.dump.dir /tmp/.hdfs-nfs ---- + * For optimal performance, it is recommended that rtmax be updated to + 1MB. However, note that this 1MB is a per client allocation, and not + from a shared memory pool, and therefore a larger value may adversely + affect small reads, consuming a lot of memory. The maximum value of + this property is 1MB. + +---- + + dfs.nfs.rtmax + 1048576 + This is the maximum size in bytes of a READ request + supported by the NFS gateway. If you change this, make sure you + also update the nfs mount's rsize(add rsize= # of bytes to the + mount directive). + + +---- + +---- + + dfs.nfs.wtmax + 65536 + This is the maximum size in bytes of a WRITE request + supported by the NFS gateway. If you change this, make sure you + also update the nfs mount's wsize(add wsize= # of bytes to the + mount directive). + + +---- + * By default, the export can be mounted by any client. To better control the access, users can update the following property. The value string contains machine name and access privilege, separated by whitespace