限制NFS写进程的带宽??

转自:http://serverfault.com/questions/461618/limit-the-speed-of-writing-files-to-nfs

Q:limit the speed of writing files to NFS

NFS is mounted on the server for backup disk space.When the backup job started, it could reach 80MB/s and we really do not expectit took so much bandwidth. So i need to find a way to limit the speed ofwriting to NFS.

I tried rsync with --bwlimit=5000. However, it did limit the readingspeed, but the accumulated data still was written at 80MB/s, and no writingactivities for seconds.

Is there any way to limit the writing speed of NFS?

A:NFS does not supply a method to limit the bandwidthused by the client.

The behaviour you're seeing where data accumulates andis then written out at full speed is the dirty pages growing on the client andthen being flushed out to the NFS server. This is the expected way that IOworks.

On a Linux NFS client, you can use tc to match and controltraffic. This would be as simple as making a class with the NFS server's IPaddress as the destination, and ratelimiting that class.

This is covered in the Linux Advanced Routing &Traffic Control HOWTO, specifically in Chapter 9Queueing Disciplines for Bandwidth Management andwithin man tc.

Here is an example of the exact commands to use: http://iomem.com/archives/17-Rate-limiting-with-sch_htb.html

 

 

第二个链接:

http://iomem.com/archives/17-Rate-limiting-with-sch_htb.html

 

Ever had a user who uses up far too much bandwidth on yournetwork? The Linux AdvancedRouting and Traffic Control Guide givesa good example of rate-limiting a single machine on your network, using the sch_cbqmodule; however, I wanted to do this on a Linksys WRT54-GS router runningOpenWRT, and sch_cbq is not available on there.

Fortunately, sch_htb, the HierarchicalToken Bucket isavailable on OpenWRT, which can do the same thing, but it's a lot morecomplicated to configure.

The following script will rate limit the single IP address of 192.168.0.67 to128kbps. All other addresses on the network will remain unlimited. Set the nameof the inside interface on your Linux router in DEV,the IP address in IP, the maximum rate on your inside network in MAXRATE andthe limit that you want to apply in LIMIT.

#!/bin/sh

DEV="br-lan"
IP="192.168.0.67"
MAXRATE="100mbps"
LIMIT="128kbps"

tc qdisc add dev $DEV root handle 1: htb default 11

tc class add dev $DEV parent 1: classid 1:1 htb rate $MAXRATE ceil $MAXRATE
tc class add dev $DEV parent 1:1 classid 1:10 htb rate $LIMIT ceil $LIMIT
tc class add dev $DEV parent 1:1 classid 1:11 htb rate $MAXRATE ceil $MAXRATE

tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip dst $IPflowid 1:10

tc qdisc add dev $DEV parent 1:10 handle 20: pfifo limit 5
tc qdisc add dev $DEV parent 1:11 handle 30: sfq perturb 10

 

 http://unix.stackexchange.com/questions/34116/how-can-i-limit-the-bandwidth-used-by-a-process

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值