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

简介:
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,如需转载请自行联系原作者

相关文章
|
1月前
|
并行计算 数据处理 Python
Python并发编程迷雾:IO密集型为何偏爱异步?CPU密集型又该如何应对?
在Python的并发编程世界中,没有万能的解决方案,只有最适合特定场景的方法。希望本文能够为你拨开迷雾,找到那条通往高效并发编程的光明大道。
38 2
|
2月前
|
开发框架 并行计算 算法
揭秘Python并发神器:IO密集型与CPU密集型任务的异步革命,你竟还傻傻分不清?
揭秘Python并发神器:IO密集型与CPU密集型任务的异步革命,你竟还傻傻分不清?
38 4
|
30天前
|
监控 并行计算 数据处理
构建高效Python应用:并发与异步编程的实战秘籍,IO与CPU密集型任务一网打尽!
在Python编程的征途中,面对日益增长的性能需求,如何构建高效的应用成为了每位开发者必须面对的课题。并发与异步编程作为提升程序性能的两大法宝,在处理IO密集型与CPU密集型任务时展现出了巨大的潜力。今天,我们将深入探讨这些技术的最佳实践,助你打造高效Python应用。
32 0
|
4天前
|
存储 关系型数据库 MySQL
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
90 1
|
25天前
|
存储 算法 固态存储
IO调度算法
【10月更文挑战第5天】IO调度算法
34 3
|
25天前
|
存储 算法 固态存储
IO调度算法
【10月更文挑战第5天】IO调度算法
33 2
|
1月前
|
开发框架 并行计算 .NET
脑洞大开!Python并发与异步编程的哲学思考:IO密集型与CPU密集型任务的智慧选择!
脑洞大开!Python并发与异步编程的哲学思考:IO密集型与CPU密集型任务的智慧选择!
27 1
|
2月前
|
存储 关系型数据库 MySQL
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
查询服务器CPU、内存、磁盘、网络IO、队列、数据库占用空间等等信息
110 5
|
2月前
|
开发框架 并行计算 .NET
燃烧吧,Python!异步编程如何点燃IO密集型任务,让CPU密集型任务也加速狂奔?
燃烧吧,Python!异步编程如何点燃IO密集型任务,让CPU密集型任务也加速狂奔?
21 2
|
2月前
|
存储 监控
【Azure Cloud Service】在Azure云服务中收集CPU监控指标和IIS进程的DUMP方法
在使用Cloud Service服务时,发现服务的CPU占用很高,在业务请求并不大的情况下,需要直到到底是什么进程占用了大量的CPU资源,已经如何获取IIS进程(w3wp.exe)的DUMP文件?