credit: Change default timeslice to 5ms
PATCH 1/1 credit: Change default timeslice to 5ms
The 30ms timeslice was chosen nearly a decade ago now, with cpu "burning" workloads in mind. In the mean time, processors have gotten faster and VMEXITs have gotten faster. A timeslice of 30ms has a major cost when running latency-sensitive workloads like network or audio streaming: getting caught behind just one or two other VMs can introduce a processing delay of up to 60ms, and the "round-robin" nature of the credit scheduler means this delay may be introduced every time the VM yields for periods of time.
The XenServer performance team at Citrix have done extensive testing with various timeslices, including 30ms, 10ms, 5ms, and 2ms. None of the workloads exhibited any performance degradation with a 5ms timeslice.
---
CC: Jan Beulich <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Keir Fraser <[email protected]>
CC: Dario Faggioli <[email protected]>
CC: Marcus Granado <[email protected]>
--- xen/common/sched_credit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/common/sched_credit.c +3 -3
@@ -29,9 +29,9 @@* Basic constants */ #define CSCHED_DEFAULT_WEIGHT 256 -#define CSCHED_TICKS_PER_TSLICE 3 -/* Default timeslice: 30ms */ -#define CSCHED_DEFAULT_TSLICE_MS 30 +#define CSCHED_TICKS_PER_TSLICE 1 +/* Default timeslice: 5ms */ +#define CSCHED_DEFAULT_TSLICE_MS 5#define CSCHED_CREDITS_PER_MSEC 10
Signature · 1 line
1.7.9.5
Quoted 14 lines · George Dunlap
The 30ms timeslice was chosen nearly a decade ago now, with cpu "burning" workloads in mind. In the mean time, processors have gotten faster and VMEXITs have gotten faster. A timeslice of 30ms has a major cost when running latency-sensitive workloads like network or audio streaming: getting caught behind just one or two other VMs can introduce a processing delay of up to 60ms, and the "round-robin" nature of the credit scheduler means this delay may be introduced every time the VM yields for periods of time.
The XenServer performance team at Citrix have done extensive testing with various timeslices, including 30ms, 10ms, 5ms, and 2ms. None of the workloads exhibited any performance degradation with a 5ms timeslice.
Quoted 9 lines
Signed-off-by George Dunlap <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Keir Fraser <[email protected]>
CC: Dario Faggioli <[email protected]>
CC: Marcus Granado <[email protected]>
---
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 13 lines · George Dunlap
The 30ms timeslice was chosen nearly a decade ago now, with cpu "burning" workloads in mind. In the mean time, processors have gotten faster and VMEXITs have gotten faster. A timeslice of 30ms has a major cost when running latency-sensitive workloads like network or audio streaming: getting caught behind just one or two other VMs can introduce a processing delay of up to 60ms, and the "round-robin" nature of the credit scheduler means this delay may be introduced every time the VM yields for periods of time.
The XenServer performance team at Citrix have done extensive testing with various timeslices, including 30ms, 10ms, 5ms, and 2ms. None of the workloads exhibited any performance degradation with a 5ms timeslice.
[...]
xen/common/sched_credit.c line 32
Quoted 10 lines
xen/common/sched_credit.c +1
-3@@ -29,9 +29,9 @@* Basic constants */ #define CSCHED_DEFAULT_WEIGHT 256 -#define CSCHED_TICKS_PER_TSLICE 3 -/* Default timeslice: 30ms */ -#define CSCHED_DEFAULT_TSLICE_MS 30 +#define CSCHED_TICKS_PER_TSLICE 1
The TICKS_PER_TSLICE change doubles the tick rate. Is this intentional?
It's not mentioned in the commit message.
xen/common/sched_credit.c line 35
Quoted 3 lines
xen/common/sched_credit.c +2
-0+/* Default timeslice: 5ms */ +#define CSCHED_DEFAULT_TSLICE_MS 5#define CSCHED_CREDITS_PER_MSEC 10
David
Quoted 16 lines · David Vrabel
xen/common/sched_credit.c line 32
Quoted 10 lines · George Dunlap
xen/common/sched_credit.c +1
-3@@ -29,9 +29,9 @@* Basic constants */ #define CSCHED_DEFAULT_WEIGHT 256 -#define CSCHED_TICKS_PER_TSLICE 3 -/* Default timeslice: 30ms */ -#define CSCHED_DEFAULT_TSLICE_MS 30 +#define CSCHED_TICKS_PER_TSLICE 1The
TICKS_PER_TSLICEchange doubles the tick rate. Is this intentional?
It's not mentioned in the commit message.
Well, I guess higher tick rate is exactly what you expect from reducing the timeslice... otherwise, you could not be able to enforce the timeslice boundaries precisely, could you?
It's unavoidable, I think: if you stick with a tick every 30ms/3=10ms, how can you enforce a timeslice of 5ms?
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 15 lines · David Vrabel
Quoted 13 lines · George Dunlap
The 30ms timeslice was chosen nearly a decade ago now, with cpu "burning" workloads in mind. In the mean time, processors have gotten faster and VMEXITs have gotten faster. A timeslice of 30ms has a major cost when running latency-sensitive workloads like network or audio streaming: getting caught behind just one or two other VMs can introduce a processing delay of up to 60ms, and the "round-robin" nature of the credit scheduler means this delay may be introduced every time the VM yields for periods of time.
The XenServer performance team at Citrix have done extensive testing with various timeslices, including 30ms, 10ms, 5ms, and 2ms. None of the workloads exhibited any performance degradation with a 5ms timeslice.
[...]
Quoted 12 lines
xen/common/sched_credit.c line 32
Quoted 10 lines
xen/common/sched_credit.c +1
-3@@ -29,9 +29,9 @@* Basic constants */ #define CSCHED_DEFAULT_WEIGHT 256 -#define CSCHED_TICKS_PER_TSLICE 3 -/* Default timeslice: 30ms */ -#define CSCHED_DEFAULT_TSLICE_MS 30 +#define CSCHED_TICKS_PER_TSLICE 1The
TICKS_PER_TSLICEchange doubles the tick rate. Is this intentional?
It's not mentioned in the commit message.
Hmm -- actually, I just realized that Marcus' test was done with 3 ticks per timeslice, so "5ms / 1 tick" has *not* been validated. And this is actually important, because the main purpose of the ticks is to give the scheduler an opportunity to switch VMs out of "BOOST" priority and into "UNDER" priority. Reducing the ticks per timeslice changes that dynamic, and would need to be tested separately.
Also, I just discovered a rather pathological case in general that seems to be in the scheduler, so for the time being let me retract this while I figure that out.
-George
Quoted 15 lines · George Dunlap
Quoted 13 lines · David Vrabel
xen/common/sched_credit.c line 32
Quoted 10 lines · George Dunlap
xen/common/sched_credit.c +1
-3@@ -29,9 +29,9 @@* Basic constants */ #define CSCHED_DEFAULT_WEIGHT 256 -#define CSCHED_TICKS_PER_TSLICE 3 -/* Default timeslice: 30ms */ -#define CSCHED_DEFAULT_TSLICE_MS 30 +#define CSCHED_TICKS_PER_TSLICE 1The
TICKS_PER_TSLICEchange doubles the tick rate. Is this intentional?
It's not mentioned in the commit message.
Quoted 7 lines
Hmm -- actually, I just realized that Marcus' test was done with 3 ticks per timeslice, so "5ms / 1 tick" has *not* been validated. And this is actually important, because the main purpose of the ticks is to give the scheduler an opportunity to switch VMs out of "BOOST" priority and into "UNDER" priority. Reducing the ticks per timeslice changes that dynamic, and would need to be tested separately.
Which is even higher tick frequency, isn't it? Anyway, you're right, we should go for the tested solution.
Quoted 4 lines
Also, I just discovered a rather pathological case in general that seems to be in the scheduler, so for the time being let me retract this while I figure that out.
Care to share some more details about this?
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 14 lines · George Dunlap
The 30ms timeslice was chosen nearly a decade ago now, with cpu "burning" workloads in mind. In the mean time, processors have gotten faster and VMEXITs have gotten faster. A timeslice of 30ms has a major cost when running latency-sensitive workloads like network or audio streaming: getting caught behind just one or two other VMs can introduce a processing delay of up to 60ms, and the "round-robin" nature of the credit scheduler means this delay may be introduced every time the VM yields for periods of time.
The XenServer performance team at Citrix have done extensive testing with various timeslices, including 30ms, 10ms, 5ms, and 2ms. None of the workloads exhibited any performance degradation with a 5ms timeslice.
Quoted 4 lines
Signed-off-by George Dunlap <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Tim Deegan <[email protected]>
Quoted 32 lines
CC Keir Fraser <[email protected]>CC Dario Faggioli <[email protected]>CC Marcus Granado <[email protected]>--- xen/common/sched_credit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)xen/common/sched_credit.c +3
-3@@ -29,9 +29,9 @@* Basic constants */ #define CSCHED_DEFAULT_WEIGHT 256 -#define CSCHED_TICKS_PER_TSLICE 3 -/* Default timeslice: 30ms */ -#define CSCHED_DEFAULT_TSLICE_MS 30 +#define CSCHED_TICKS_PER_TSLICE 1 +/* Default timeslice: 5ms */ +#define CSCHED_DEFAULT_TSLICE_MS 5#define CSCHED_CREDITS_PER_MSEC 10Signature · 7 lines
1.7.9.5 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel