Xen IO隔离方法及CPU调度脚本

本文介绍Xen虚拟化环境中磁盘I/O管理和CPU调度的方法,包括Virtualdisk I/O管理机制、基于令牌的VBD I/O QoS限制、dm-ioband工具使用及ionice进程优先级调整等。此外还探讨了不同调度器的选择与应用,例如credit2调度器,并给出了具体的配置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

IO: 


1. Virtual disk I/O management mechanism in Xen

2. Token-based-QoS-resource-limiting-for-VBD-I-O

3. dm-ioband

4. ionice
for blkpid in $( pgrep blkback ); do
    # 2nd lowest (6) prio in best-effort class (2)
    ionice -c 2 -n 6 -p $blkpid
done




CPU:


#!/bin/sh

# cpucap
# reschedule all running xen domUs to a medium-low cpu allocation
 
 
# scheduler notes:
    # if you wanna change this to support qos classes (i.e. if the customer can
    # chose a certain performance level, then look at the SEDF and credit2 
    # schedulers, or just play around with the weight.
    # I recommend using the weight for now.
    # also I think a 2-core cap + very heavy weight for dom0 should be looked
    # at when you see any io scalability issues.
 
# hyperthreading notes:
    #we might see hyperthreads so we'll assume 2 cores have a 
    #performance of 130 => and 1 core has 65!
    #this means we'll have to tweak xen vcpu allocation to ensure noone ever 
    #runs on a HT only?
    # potential solution for figuring out 
    # the best solution is using a extended cpu mask (url?) in the cpus= line
    # of the xen config. that, coupled with picking specific core types 
    # (url:  http://dag.wieers.com/blog/is-hyper-threading-enabled-on-a-linux-system), would work, but is extremely complex.
    #
    # I will focus on giving the users multiples of 1core+1ht and stick by the
    # 130 sum then...
 
get_vms()
    xm list | egrep -v 'Name|Domain-0' | awk '{print $1" "$2" "$4}'
}
 
 
set_perf()
{
   xm sched-credit -d domain-id -w weight =c cap 
}
 
# xen4.1 / sched-credit2 testers needed:
# the below command is disabled for safety reasons, can crash dom0
# i bet theres still no regression test for that.
# our first try, later we should give dom0 256 * cores * total_domUs
# or just pin it, if we got lotsa fast cores
 
default_weight=256
dom0_cores=$(grep -c ^proc /proc/cpuinfo)
dom0_weight=$(( $default_weight * $dom0_cores ))
#xm sched-credit2 -d 0 weight $dom0_weight
#we should employ capping for dom0 too, feel free to move to the main code.
#xm sched-credit2 -d 0 -c 400 
 
echo "$(get_vms)" | while read name domid vcpus ; do
    xm sched-credit -d $domid -c $(( $vcpus * 65  ))
done

本文转自feisky博客园博客,原文链接:http://www.cnblogs.com/feisky/archive/2011/11/12/2246634.html,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值