Linux IO/NFS tunning:

IO Test
=======
dd 测试读性能的命令
# time dd if=/nfsfolder/testfile of=/dev/null bs=1k
dd 测试写性能的命令
time -p dd if=/dev/zero of=test.file bs=1k count=100000

[1]Write
 time -p dd if=/dev/zero of=test.file bs=1k count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 25.2433 s, 4.1 MB/s
real 25.24
user 0.03
sys 1.49

time -p dd if=/dev/zero of=test.file bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.477919 s, 219 MB/s
real 0.48
user 0.00
sys 0.11

[2] read file
time dd if=./test.file of=/dev/null bs=1k
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 14.1445 s, 7.2 MB/s

real    0m14.150s
user    0m0.054s
sys    0m1.929s

time dd if=./test.file of=/dev/null bs=1024k
97+1 records in
97+1 records out
102400000 bytes (102 MB) copied, 0.0465829 s, 2.2 GB/s

real    0m0.052s
user    0m0.000s
sys    0m0.037s

time rm -rf test.file

real    0m0.093s
user    0m0.000s
sys    0m0.091s

time rm -rf test.file

real    0m0.101s
user    0m0.000s
sys    0m0.098s

Tools:
======

sar -b 1 10

-b     Report I/O and transfer rate statistics.  The following values are displayed:

              tps
                     Total  number of transfers per second that were issued to physical devices.  A
                     transfer is an I/O request to a physical device. Multiple logical requests can
                     be  combined  into a single I/O request to the device.  A transfer is of inde\u2010
                     terminate size.

              rtps
                     Total number of read requests per second issued to physical devices.

              wtps
                     Total number of write requests per second issued to physical devices.

              bread/s
                     Total amount of data read from the devices in blocks per second.   Blocks  are
                     equivalent to sectors and therefore have a size of 512 bytes.

              bwrtn/s
                     Total amount of data written to devices in blocks per second.

注:每1秒 显示 1次 显示 10次

sar -d -p 3 10  //3s 10 times.

Monitor NFS
1 second interval to monitor nfsstat
nfsstat -cn -Z1

Client nfs v3:
null         getattr      setattr      lookup       access       readlink     
0         0% 777      58% 0         0% 0         0% 111       8% 0         0%
read         write        create       mkdir        symlink      mknod        
0         0% 432      32% 0         0% 0         0% 0         0% 0         0%
remove       rmdir        rename       link         readdir      readdirplus  
0         0% 0         0% 0         0% 0         0% 0         0% 0         0%
fsstat       fsinfo       pathconf     commit       
0         0% 0         0% 0         0% 0         0%

nfsstat -rc
Client rpc stats:
calls      retrans    authrefrsh
66906770   5          66907434

If retrans value is quite high, meaning that retransmissions were often necessary since the last reboot. This is a clear indication that the number of available NFS kernel threads on the server is insufficient to handle the requests from this client. The default number of threads for rpc.nfsd to start is typically eight threads.

To tell rpc.nfsd to use more kernel threads, the number of threads must be passed as an argument to it. Typically, most distributions will have a file such as /etc/sysconfig/nfs to configure this;

NFS server side:

nfsstat --all

dstat用来监控cpu,disk,network等, 类似vmstat.如下,比较直观.
[root@LMG3ADFBE2  ~] # dstat
----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw
  1   1  98   0   0   0| 244B   66k|   0     0 |   0     0 |2139  2048
  0   3  97   0   0   0|   0     0 | 195B  838B|   0     0 |2865  8355
  0   1  99   0   0   0|   0     0 |1038B  628B|   0     0 | 723   537
  0   2  98   0   0   0|   0     0 |  66B  358B|   0     0 |1884  1000
dstat常用的选项有:
        -c     显示cpu使用情况
        -d     显示磁盘使用情况
       -g,     显示页面数据  
        -i      启用中断数据
        -l      平均负载统计(1分钟,5分钟,15分钟)
        -m     显示内存使用信息
        -n     显示网络信息
        -p      enable process stats (runnable,uninterruptible, new)
       -r       enable I/O request stats(read, write requests)
       -s       显示交换分区使用信息
       -t       启用时间/日期输出
       -y       系统统计(中断上下文切换)
       --aio    显示异步io统计数据
       --ipc     ipc相关的信息
       --raw:    raw socket
       --tcp     tcp socket
       --udp    udp socket
       --socket  raw, tcp, udp
       --unix    unix sock
       --top-cpu 显示最占用CPU的进程
       --top-bio 显示最占用block IO的进程
       --top-mem: 显示最耗费内存的进程
       --top-io   最占用IO的进程

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

关于NFS ac/noac 和nocto

cto / nocto    Selects  whether  to  use close-to-open cache coherence semantics.
                      If neither option is specified  (or  if  cto  is  specified),  the
                      client  uses close-to-open cache coherence semantics. If the nocto
                      option is specified, the client uses a non-standard  heuristic  to
                      determine when files on the server have changed.

                      Using  the  nocto  option  may  improve  performance for read-only
                      mounts, but should be used only if the data on the server  changes
                      only  occasionally.   The DATA AND METADATA COHERENCE section dis-
                      cusses the behavior of this option in more detail.

设置这个参数如nocto后, 行为表现为.

Server A and Server B mount the same storage via NFS.

Server B nocto, ac, 当A写入一行到一个文件, 在B上看不到A写的内容。知道触发ac的timeout, 即actimo

ac/noac

ac / noac      Selects  whether  the client may cache file attributes. If neither
                      option is specified (or if ac is  specified),  the  client  caches
                      file attributes.

                      To  improve  performance, NFS clients cache file attributes. Every
                      few seconds, an NFS client checks the  server\u2019s  version  of  each
                      file\u2019s  attributes  for updates.  Changes that occur on the server
                      in those small intervals remain undetected until the client checks
                      the  server  again.  The noac option prevents clients from caching
                      file attributes so that applications can more quickly detect  file
                      changes on the server.

                      In addition to preventing the client from caching file attributes,
                      the noac option forces application writes to become synchronous so
                      that  local changes to a file become visible on the server immedi-
                      ately.  That way, other clients can quickly detect  recent  writes
                      when they check the file\u2019s attributes.

                      Using  the  noac option provides greater cache coherence among NFS
                      clients accessing the same files, but it  extracts  a  significant
                      performance  penalty.   As  such, judicious use of file locking is
                      encouraged instead.  The DATA AND METADATA COHERENCE section  con-
                      tains a detailed discussion of these trade-offs.

如果ac enable, 则文件属性及目录属性会在本地cache中(metadata cache), 可以touch一个新文件来强制刷新这些cache。

如果server A with ac, server B with noac, 在A上向文件写入一行, 则B上可以看到最新的内容。当然如果B上设置了nocto,则看不到。

- Shall noac option on server B trigger the sync operation on server A? Yes. When the client mounted with noac option reads a file from the server, It will always fetch the most recent copy from the NFS server. If the NFS server thinks that a lock has been acquired for the same file by another client (clients acquire locks before performing write), then the NFS server asks that client to forcefully write the data, then the updated copy is provided to the client mounted with noac option.

Linux IO/NFS tunning 性能优化及检测的更多相关文章

  1. 降低磁盘IO使Oracle性能优化(转)

    文章转自:http://blog.chinaunix.net/uid-26813519-id-3207996.html 硬件方面虽然只占Oracle性能优化的一个方面(另一方面是软件),但是仍不可忽视 ...

  2. 《嵌入式Linux内存使用与性能优化》笔记

    这本书有两个关切点:系统内存(用户层)和性能优化. 这本书和Brendan Gregg的<Systems Performance>相比,无论是技术层次还是更高的理论都有较大差距.但是这不影 ...

  3. redmine在linux上的mysql性能优化方法与问题排查方案

    iredmine的linux服务器mysql性能优化方法与问题排查方案     问题定位:   客户端工具: 1. 浏览器inspect-tool的network timing工具分析   2. 浏览 ...

  4. Linux内核协议栈 NAT性能优化之FAST NAT

    各位看官非常对不起,本文是用因为写的,如果多有不便敬请见谅 代码是在商业公司编写的,在商业产品中也不能开源,再次抱歉   This presentation will highlight our ef ...

  5. Linux性能优化从入门到实战:16 文件系统篇:总结磁盘I/O指标/工具、问题定位和调优

    (1)磁盘 I/O 性能指标 文件系统和磁盘 I/O 指标对应的工具 文件系统和磁盘 I/O 工具对应的指标 (2)磁盘 I/O 问题定位分析思路 (3)I/O 性能优化思路 Step 1:首先采用 ...

  6. 生产场景NFS共享存储优化及实战

    生产场景NFS共享存储优化: 1.硬件:sas/ssd磁盘,买多块,raid0/raid10,网卡好 2.NFS服务器端优化加all_squash,async /backup/NFS 192.168. ...

  7. 转 Linux 性能优化之 IO 子系统

    本文介绍了对 Linux IO 子系统性能进行优化时需要考虑的因素,以及一些 IO 性能检测工具. 本文的大部分内容来自 IBM Redbook - Linux Performance and Tun ...

  8. Linux 性能优化之 IO 子系统

    本文介绍了对 Linux IO 子系统性能进行优化时需要考虑的因素,以及一些 IO 性能检测工具. 本文的大部分内容来自 IBM Redbook - Linux Performance and Tun ...

  9. Linux 性能优化之 IO 子系统 系列 图

    http://blog.sina.com.cn/s/articlelist_1029388674_11_1.html Linux 性能优化之 IO 子系统(一) 本文介绍了对 Linux IO 子系统 ...

随机推荐

  1. 如何使用iMindMap的组织图表视图?

    除了常规的发散型思维导图外,iMindMap思维导图软件还提供了辐射导图.灵感导图.组织图表等多种导图形式,供用户更好地展现事项间的层级关系,而其中的组织图表更有助于展现上下级层级关系. 组织图表可以 ...

  2. 如何用CorelDRAW画箭头?

    CorelDRAW,简称为cdr,是一款专业的矢量绘图软件,在设计界也是常用的专业设计之一,在日常的设计工作中,我们常常需要绘制一些特殊的图形,比如箭头.很多对cdr不是特别熟练的小伙伴不知道如何用c ...

  3. PDF文档工具:pdfFactory快照功能详解

    pdfFactory的快照功能,是通过一种类似截图的方式,将文档中的内容,如标题.图片.段落.文字等进行剪切的功能.剪切后的内容会转化为文本框的形式,我们可以对其进行加边框.旋转等编辑处理,但不能对其 ...

  4. C语言讲义——函数递归

    函数直接或间接调用自身 每次调用必须获得一些进展,进一步靠近目标 达到目标就不再调用自身 阅读递归函数不要纠缠于执行过程,而是相信递归函数会顺利完成任务 例:阶乘 0! =1(0 的阶乘定为1) 1! ...

  5. TCP/IP网络协议基础入门及实验

    TCP/IP简介 提到网络协议栈结构,最著名的当属 OSI 七层模型,但是 TCP/IP 协议族的结构则稍有不同,它们之间的层次结构有如图对应关系: 可见 TCP/IP 被分为 4 层,每层承担的任务 ...

  6. 【mq读书笔记】mq消息发送

    钩子的注册: DefaultMQProducerImpl#registerSendMessageHook注册钩子处理类,可注册多个. public SendResult sendMessage( fi ...

  7. 2020天梯赛总决赛L2-3 完全二叉树的层序遍历 (25分)

    题目:一个二叉树,如果每一个层的结点数都达到最大值,则这个二叉树就是完美二叉树.对于深度为 D 的,有 N 个结点的二叉树,若其结点对应于相同深度完美二叉树的层序遍历的前 N 个结点,这样的树就是完全 ...

  8. python - os.sep用法

    python是跨平台的.在Windows上,文件的路径分隔符是'\',在Linux上是'/'.为了让代码在不同的平台上都能运行,那么路径应该写'\'还是'/'呢?使用os.sep的话,就不用考虑这个了 ...

  9. UPX使用教程

    UPX是一个通用可执行文件压缩器,由于其具有: 压缩率高:压缩效果优于zip/gzip: 解压速度快:在奔腾133上即可达到大约10MB/秒: 压缩的可执行文件没有额外的内存开销: 安全:可以列表,检 ...

  10. MySQL——一致性非锁定读(快照读)&MVCC

    MySQL--一致性非锁定读(快照读) MySQL数据库中读分为一致性非锁定读.一致性锁定读 一致性非锁定读(快照读),普通的SELECT,通过多版本并发控制(MVCC)实现. 一致性锁定读(当前读) ...