加载中…
个人资料
旁观者
旁观者
  • 博客等级:
  • 博客积分:0
  • 博客访问:3,009
  • 关注人气:6
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

NFS I/O 性能优化笔记

(2015-01-06 16:27:27)
标签:

it

分类: 网络技术

 

参考链接:

http://nfs.sourceforge.net/nfs-howto/ar01s05.html

http://www.softpanorama.org/Net/Application_layer/NFS/nfs_performance_tuning.shtml

 

1. NFS I/O性能测试工具

1.1 dd

dd 只能测试连续读写性能

 

dd 测试写性能的命令(连续写16384个16KB的块到nfs目录下的testfile文件)

# time dd if=/dev/zero of=/nfsfolder/testfile bs=16k count=16384

 

dd 测试读性能的命令

# time dd if=/nfsfolder/testfile of=/dev/null bs=16k

1.2 nfsstat

 

在NFS客户端运行

nfsstat -4 --all     (对于NFSv4)

Client packet stats:
packets    udp        tcp        tcpconn
                                

Client rpc stats:
calls      retrans    authrefrsh
24932703                 

Client nfs v4:
null         read         write        commit       open         open_conf   
        0% 19359418 77% 513478    2% 513295    2% 1880475   7% 9         0%
open_noat    open_dgrd    close        setattr      fsinfo       renew       
        0% 0         0% 1209733   4% 0         0% 4         0% 0         0%
setclntid    confirm      lock         lockt        locku        access      
        0% 7         0% 0         0% 0         0% 0         0% 305360    1%
getattr      lookup       lookup_root  remove       rename       link        
881574    3% 267948    1% 2         0% 0         0% 0         0% 0         0%
symlink      create       pathconf     statfs       readlink     readdir     
        0% 0         0% 2         0% 2659      0% 0         0% 404       0%
server_caps  delegreturn  getacl       setacl       fs_locations exchange_id 
        0% 0         0% 0         0% 0         0% 0         0% 0         0%
create_ses   destroy_ses  sequence     get_lease_t  layoutget    layoutcommit
        0% 0         0% 0         0% 0         0% 0         0% 0         0%
layoutreturn getdevlist   getdevinfo   ds_write     ds_commit   
        0% 0         0% 0         0% 0         0% 0         0%

 

在NFS服务器端运行

# nfsstat --all
Server packet stats:
packets    udp        tcp        tcpconn
171175445            171147948   13     

Server rpc stats:
calls      badcalls   badauth    badclnt    xdrcall
170930602                                   

Server reply cache:
hits       misses     nocache
                  170718860

Server file handle cache:
lookup     anon       ncachedir  ncachedir  stale
                                         

Server nfs v4:
null         compound    
        0% 170935498 99%

Server nfs v4 operations:
op0-unused   op1-unused   op2-future   access       close        commit      
        0% 0         0% 0         0% 730000    0% 13960911  2% 51863971  9%
create       delegpurge   delegreturn  getattr      getfh        link        
        0% 0         0% 0         0% 152090452 28% 14469063  2% 0         0%
lock         lockt        locku        lookup       lookup_root  nverify     
        0% 0         0% 0         0% 509243    0% 0         0% 0         0%
open         openattr     open_conf    open_dgrd    putfh        putpubfh    
14887499  2% 0         0% 340567    0% 0         0% 170109922 31% 0         0%
putrootfh    read         readdir      readlink     remove       rename      
24        0% 30077993  5% 676       0% 0         0% 0         0% 0         0%
renew        restorefh    savefh       secinfo      setattr      setcltid    
        0% 13960755  2% 14885721  2% 0         0% 1         0% 20        0%
setcltidconf verify       write        rellockowner bc_ctl       bind_conn   
20        0% 0         0% 56911268 10% 0         0% 0         0% 0         0%
exchange_id  create_ses   destroy_ses  free_stateid getdirdeleg  getdevinfo  
        0% 0         0% 0         0% 0         0% 0         0% 0         0%
getdevlist   layoutcommit layoutget    layoutreturn secinfononam sequence    
        0% 0         0% 0         0% 0         0% 0         0% 0         0%
set_ssv      test_stateid want_deleg   destroy_clid reclaim_comp
        0% 0         0% 0         0% 0         0% 0         0%

 

1.3 查看 nfs 的mount参数

cat /proc/mounts
fe80::63%vlan6:/ /nfsfolder nfs4 rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=fe80::82c1:6eff:fe76:6921,minorversion=0,local_lock=none,addr=fe80:0:0:0:0:0:0:63 0 0

 

2. NFS 调优

mount -v -t nfs4 -o rsize=1048576,wsize=1048576 [fe80::63%vlan6]:/ /nfsfolder/ 

  • nfsv4 或nfsv3 比nfsv2具有更好的性能
  • 如果系统支持,尽量使用更大的rsize和wsize。根据测试wsize为1MB时的连续写性能可以比wsize为1kB时提高2倍
  • 提高nfsd的线程数(SUSE linux /etc/sysconfig/nfs文件中的USE_KERNEL_NFSD_NUMBER,一个CPU内核至少设置一个线程,根据经验一个CPU内核设置4~8个线程更好)
  • 提高输入队列的内存限制,注意多个nfsd线程共享这些内存。NSF Client有很高的读负载,NFS Server有很高的写负载时,提高内存限制有重要的作用。

      # echo 262144 > /proc/sys/net/core/rmem_default
      # echo 262144 > /proc/sys/net/core/rmem_max

    

      # echo 262144 > /proc/sys/net/core/wmem_default
      # echo 262144 > /proc/sys/net/core/wmem_max

     

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有