关闭

An introduction to the credit scheduler in Xen

标签: Xenscheduler
424人阅读 评论(0) 收藏 举报
分类:

An introduction to the credit scheduler in Xen

Credit scheduler provides automatic load balancing of virtual CPUs across physical CPUs on an SMP host. The scheduler awards credit to each VM periodically and charges each VM to run on the CPU.

To be specific, there are four main components: a virtual CPU pool, a physical CPU pool, a credit calculator and a credit scheduler (illustrated in the figure). The credit calculator calculates and updates the credit for every domain per 10ms. The scheduler dispatches the vCPU to a pCPU every 30ms according to their states, i.e., priorities.
这里写图片描述

There are 3 priorities:

  • over state joining at the tail of the scheduling queue.
  • under state allowed to run before any that are out of credit.
  • boost state to give mostly idle vCPUs a chance to run without accumulating too much credit.

In all, the scheduling queue is ordered: BOOST, UNDER, OVER from head to tail.

Credit1
It contains 2 key parameters weight and cap:

  • weight represents the signi cance of a vCPU. I.e., the higher weight a vCPU has, the more pCPU it can consume.
  • cap representsthe maximum amount of pCPU a domain will be able to consume. (Caution: it use an integrity to illustrate percentage. E.g., 100 = 1 pCPU)

Risks for credit1:

  • Too much overhead of context switch for a vCPU running IO-intensive applications. it is because that these vCPU spends much time on IO while a little time computing.
  • Malicious accumulation of credit. In another words, a malicious vCPU can accumulate plenty of credit through staying in idle for a period and then occupy most of the computing resource with purpose of holding back the victim.

Credit2
Credit2 can solve the problems of credit1. It adds 3 extra mechanisms:

  • ratelimite combats this problem by de ning the minimum number of microseconds a VM would be allowed to run uninterrupted before being context switched with the default being 1ms.
  • timeslice allows for tweaking the scheduler. I.e., it can change the scheduling time, which is 30ms by default.
  • a new credit reset condition prevents any VM from accumulating too much credit.

ratelimit and timeslice can be configured with tool xl sched_credit [option]

1
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:7487次
    • 积分:276
    • 等级:
    • 排名:千里之外
    • 原创:19篇
    • 转载:1篇
    • 译文:1篇
    • 评论:4条
    文章分类
    最新评论