From: Michael Palmeter Subject: Re: Xen credit scheduler question Date: Thu, 15 Nov 2012 13:07:47 -0800 (PST) Message-ID: References: <50A53479.5050901@eu.citrix.com> <27449f60-0433-4e5f-b1fb-06914b84c6f1@default> <50A54815.9010402@eu.citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="__1353013668404174285abhmt114.oracle.com" Return-path: In-Reply-To: <50A54815.9010402@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: xen-devel@lists.xen.org, Dario Faggioli , Ashok Aletty List-Id: xen-devel@lists.xenproject.org --__1353013668404174285abhmt114.oracle.com Content-Type: multipart/alternative; boundary="__1353013668404174286abhmt114.oracle.com" --__1353013668404174286abhmt114.oracle.com Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Thanks very much George.=A0 Very helpful indeed. =A0 - Mike HYPERLINK "http://www.oracle.com/" \nOracle Michael Palmeter | Sr. Director of Product Management, Oracle Exalogic Elas= tic Cloud Phone: HYPERLINK "tel:+14153736497"+14153736497 | Mobile: HYPERLINK "tel:+1= 4156949573"+14156949573 | VOIP: HYPERLINK "tel:+14154027422"+14154027422=20 Oracle Exalogic Development 200 Oracle Parkway | Redwood Shores, California 94065=20 HYPERLINK "http://www.oracle.com/commitment" \nGreen Oracle Oracle is committed to developing practices and products that help protect = the environment =A0 HYPERLINK "http://www.oracle.com/pls/ebn/swf_viewer.load?p_shows_id=3D12641= 667&p_referred=3D0&p_width=3D1000&p_height=3D675"Watch the Exalogic 5-minut= e Demo at http://www.oracle.com/pls/ebn/swf_viewer.load?p_shows_id=3D126416= 67 =A0 From: George Dunlap [mailto:george.dunlap@eu.citrix.com]=20 Sent: November 15, 2012 11:53 AM To: Michael Palmeter Cc: Ashok Aletty; Dario Faggioli; xen-devel@lists.xen.org Subject: Re: [Xen-devel] Xen credit scheduler question =A0 On 15/11/12 19:03, Michael Palmeter wrote: Thank you for your answer, George. =A0 The origin of my question is more of a business concern than a technical on= e.=A0 Many software products are licensed based on a cost per processor cor= e.=A0 It is desirable to sometimes allow customers to pay a fraction of sof= tware license costs in exchange for running that software using only a comm= ensurate fraction of available compute power (capacity sub-licensing).=A0 I= f the cap is a means of making a vCPU more-or-less deterministic (in terms = of its effective computational capacity) then that would be useful as a pro= grammatic means of enabling capacity sub-licensing.=A0 My example below was= based on a case where I have a customer that would like to use 'cap' to co= nstrain their single vCPU VM to only =BD of a core worth of compute capacit= y (logically 1/32 of the compute power) in exchange for only paying 1/32 of= the license cost for the physical server. Right -- I've seen the "limit cpu power for licensing purposes" thing befor= e, but I think that only went down to cores, not sub-core. =A0 Below you answered: =A0 "You can use 'cap' to make the VM in question get 50% of logical vcpu time,= which on an idle system will give it 0.5 of the capacity of a physical cor= e (if we don't consider Intel's Turbo Boost technology).=A0 But if the syst= em becomes busy, it will get less than 0.5 of the processing capacity of a = physical core." =A0 Are you saying that cap would be able to CONSTRAIN a vCPU to an effective c= ompute capacity equal to 50% of a physical core, but it does not GUARANTEE = effective compute capacity equal to 50% of a physical core?=20 Theoretically, a cap at 50 will give your single-vcpu VM 50% of the time of= one hyperthread. So if C is "typicall throughput of a single non-hyperthreaded core running = at standard requency", and we factor out Turbo Boost, then there are two ca= ses to consider: * Other thread is idle.=A0 In that case, the VM will get 0.5C. * The other thread is busy.=A0 In this case, assuming a 0.7 factor, the VM = will get 0.5 * (0.7 * C), or about 0.35C So the total computing power available to the VM should be <=3D 0.5C (satis= fying the licensing requirements), but on a busy system it may be significa= ntly less than 0.5C (perhaps not so satisfying to the owner of the VM). I don't think it should be terribly difficult to put a simple "shared hyper= thread" multiplier on the credit burned -- if someone at Oracle wanted to h= elp implement this, we'd be happy to point you in the right direction. :-) If you have Turbo Boost, then (as I understand it) the CPU can raise the cl= ock speed of the processor when threads or cores are idle; the wikipedia ar= ticle seems to think some processors can increase the clock speed up to 1.6= x over the baseline frequency.=A0 That would throw a bit of a wrench in the= works, as you might end up with 0.5 * 1.6 * C =3D 0.8 C > 0.5 C; however, = looking at Intel's website, it looks like only 2- and 4-core processors hav= e TurboBoost, so maybe on 8-core processors we can punt on that thorny issu= e for a little while yet. :-) Can you offer any guidance regarding real-world scheduler overhead (when ca= p>0 is used) and precision (how variable is actual compute power for a vCPU= with a cap of 100%, for example)? I have not done extensive testing with the cap; I mainly know the mechanism= by which it works.=A0 There is no extra accounting done in the scheduler f= or having a cap: all vcpus are assigned credit every 30ms according to thei= r weight and cap.=A0 The difference is that if a non-capped vcpu uses up it= s credits, it is allowed to go negative; whereas a capped vcpu will be paus= ed until it receives more credits.=A0 So there should be no extra hyperviso= r overhead from using a cap. The cap fundamentally works by locking out a vcpu for very small amounts of= time within the 30ms accounting window.=A0 But this same effect might happ= en just by having other VMs competing for the cpu; so in theory shouldn't b= e any riskier than virtualizing in the first place. Executive summary: Factoring out Turbo Boost, "cap" should be able to set a= sub-core upper-bound on processing power.=A0 But on a busy system, it may = result in the VM getting less than its upper-bound in processing power. However, scheduling is a very complex and dynamic system, and like economic= s, very simple changes can have unpredictable results.=A0 So it's probably = a good idea to do some testing before recommending it to customers. :-) BTW, are you familiar with Xen's cpupool functionality?=A0 The guys at Fuji= tsu wrote it so that a customer could rent a fixed number of cores to a cus= tomer, who could then run as many VMs on those cores as they wanted.=A0 I t= hink licensing restrictions had something to do with that as well.=A0 More = about that here, if you're interested: =A0http://blog.xen.org/index.php/2012/04/23/xen-4-2-cpupools/ =A0-George --__1353013668404174286abhmt114.oracle.com Content-Type: multipart/related; boundary="__1353013668404174287abhmt114.oracle.com" --__1353013668404174287abhmt114.oracle.com Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable

= Thanks very much George.=A0 Very helpful inde= ed.

 

- Mike

3DOracle
Michael Palmeter= | Sr. Director of Product Management, Oracle Exalogic Elastic Cloud
Pho= ne: +14153736497 | Mobile: +14156949573 | VOIP: +14154027422
Oracle= Exalogic Development
200 Oracle Parkway | Redwood Shores, California 94= 065

3D"Green

Oracle is comm= itted to developing practices and products that help protect the environmen= t

 

Watch the Exalogic 5-mi= nute Demo at http://www.oracle.= com/pls/ebn/swf_viewer.load?p_shows_id=3D12641667

=

 =

From: George Dunlap [mailto:george.dunlap@eu.citrix.com]
Sent: Novem= ber 15, 2012 11:53 AM
To: Michael Palmeter
Cc: Ashok Al= etty; Dario Faggioli; xen-devel@lists.xen.org
Subject: Re: [Xen-d= evel] Xen credit scheduler question

 

On 15/11/12 1= 9:03, Michael Palmeter wrote:

Thank you for your answer, George.

 

The origin of my question is= more of a business concern than a technical one.  Many software produ= cts are licensed based on a cost per processor core.  It is desirable = to sometimes allow customers to pay a fraction of software license costs in= exchange for running that software using only a commensurate fraction of a= vailable compute power (capacity sub-licensing).  If the cap is a mean= s of making a vCPU more-or-less deterministic (in terms of its effective co= mputational capacity) then that would be useful as a programmatic means of = enabling capacity sub-licensing.  My example below was based on a case= where I have a customer that would like to use ‘cap’ to constr= ain their single vCPU VM to only =BD of a core worth of compute capacity (l= ogically 1/32 of the compute power) in exchange for only paying 1/32 of the= license cost for the physical server.


Right -- I've seen the "limit cpu power for licensi= ng purposes" thing before, but I think that only went down to cores, n= ot sub-core.


 

Below you answered:

 

“You can use ‘ca= p’ to make the VM in question get 50% of logical vcpu time, which on = an idle system will give it 0.5 of the capacity of a physical core (if we d= on't consider Intel's Turbo Boost technology).  But if the system beco= mes busy, it will get less than 0.5 of the processing capacity of a physica= l core.”

 

Are you saying that cap would be able to CONSTRAIN a vCPU t= o an effective compute capacity equal to 50% of a physical core, but it doe= s not GUARANTEE effective compute capacity equal to 50% of a physical core?=


Theoretically, a cap at 50 will= give your single-vcpu VM 50% of the time of one hyperthread.

So if = C is "typicall throughput of a single non-hyperthreaded core running a= t standard requency", and we factor out Turbo Boost, then there are tw= o cases to consider:

* Other thread is idle.  In that case, the= VM will get 0.5C.
* The other thread is busy.  In this case, assum= ing a 0.7 factor, the VM will get 0.5 * (0.7 * C), or about 0.35C

So= the total computing power available to the VM should be <=3D 0.5C (sati= sfying the licensing requirements), but on a busy system it may be signific= antly less than 0.5C (perhaps not so satisfying to the owner of the VM).
I don't think it should be terribly difficult to put a simple "sh= ared hyperthread" multiplier on the credit burned -- if someone at Ora= cle wanted to help implement this, we'd be happy to point you in the right = direction. :-)

If you have Turbo Boost, then (as I understand it) th= e CPU can raise the clock speed of the processor when threads or cores are = idle; the wikipedia article seems to think some processors can increase the= clock speed up to 1.6x over the baseline frequency.  That would throw= a bit of a wrench in the works, as you might end up with 0.5 * 1.6 * C =3D= 0.8 C > 0.5 C; however, looking at Intel's website, it looks like only = 2- and 4-core processors have TurboBoost, so maybe on 8-core processors we = can punt on that thorny issue for a little while yet. :-)


<= /o:p>

Can you = offer any guidance regarding real-world scheduler overhead (when cap>0 i= s used) and precision (how variable is actual compute power for a vCPU with= a cap of 100%, for example)?


I h= ave not done extensive testing with the cap; I mainly know the mechanism by= which it works.  There is no extra accounting done in the scheduler f= or having a cap: all vcpus are assigned credit every 30ms according to thei= r weight and cap.  The difference is that if a non-capped vcpu uses up= its credits, it is allowed to go negative; whereas a capped vcpu will be p= aused until it receives more credits.  So there should be no extra hyp= ervisor overhead from using a cap.

The cap fundamentally works by lo= cking out a vcpu for very small amounts of time within the 30ms accounting = window.  But this same effect might happen just by having other VMs co= mpeting for the cpu; so in theory shouldn't be any riskier than virtualizin= g in the first place.

Executive summary: Factoring out Turbo Boost, = "cap" should be able to set a sub-core upper-bound on processing = power.  But on a busy system, it may result in the VM getting less tha= n its upper-bound in processing power.

However, scheduling is a very= complex and dynamic system, and like economics, very simple changes can ha= ve unpredictable results.  So it's probably a good idea to do some tes= ting before recommending it to customers. :-)

BTW, are you familiar = with Xen's cpupool functionality?  The guys at Fujitsu wrote it so tha= t a customer could rent a fixed number of cores to a customer, who could th= en run as many VMs on those cores as they wanted.  I think licensing r= estrictions had something to do with that as well.  More about that he= re, if you're interested:
 http://blog.xen.org/index.php/2012/04/23/xen= -4-2-cpupools/

 -George

<= /html> --__1353013668404174287abhmt114.oracle.com Content-Type: image/gif; name="image001.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="image001.gif" Content-ID: R0lGODlhcgAaAMQAAP8QEP/w8P/Q0P/g4P8wMP9gYP8gIP+goP9QUP+QkP+wsP9wcP+AgP9AQP/A wP8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAA AAAALAAAAAByABoAAAX/ICSOZGmeaKqubOu+cCzPdC0GCqPvvBKUDp5wp1gFdIPVIDfcOQa6A8yR aO4gweQoUHh4v2Bw4SdihM9egyBF8ALIpkEXDR44vA2XwkD/IgYGAAZbbX1nBGRmhl8AWiUJYicC AIsPDFh4LXOGjQ4NAAhrEIUPBQcOqKmoB5sEZV4JqqoHhQVxlGAOJQG4AAunsqg/dw95KwdfBgzB qKIEBMaQDwCiKpOwEIq6KANuJg14igZwEHPULMTGKbxetjF8D1ItxK7aKl8lCl8DAfALW1+2rUi3 QtqgGN2mwYCXzYvAON624LoEQZ9DEfRcEFSBIE2DjyBDfnyIqRgMcA8a/z5AZQWXOxEdHxwUgfIg sX/zMqlAWclVCQFefLpAqdJBAFJn3owgtpJEQkslEWjUmYLnomokcDlS4s0eFzQNqvXDEyzmAwFP yaXYmGJBuxlzELWIacueiE0AFGyF4HbaNTquUEpFRxUFUC9YXQzARYAkEJSNipKQ9kDu0i9SKKNZ 9iXswMIoYgI4oJYFskpgzkkmcdrviELqmPVt1HpRAaaLqCE1lBgjvEpqRtgl8Tevygd7TcCuiKvP m8OVEkAIYLYPThSsRIpEQJr1x94QBIT09FH6QJC6AiRAoB1kEb7tRb4MvyB+AwSlbejfz7+///8A BijggAQWaOCBCCao4A+CDDbo4IMQRijhhBQKGAIAOw== --__1353013668404174287abhmt114.oracle.com Content-Type: image/gif; name="image002.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="image002.gif" Content-ID: R0lGODlhLAAcAMQAAP///0x9RHmec9Pf0aa+oleFULHGrmKNW+nv6I+uivT39N7n3W6VZ7zPuZu2 lsjXxYSmfwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAA AAAALAAAAAAsABwAQAXhICCOZGmeaDoaReC+sKAMR7GopIA6boIvLgPAVSAgALxjSYdrOp/Q6NPg YqIEPkTBV2taTwgGbEw+PAZo3FfKbqMQQfeJ8DoY0Hg0wxhAKBgHCl5XLgMqDwFCAAIFPIYDgidr OUQGkSh0cQMJAQyXOXKhoqOkpaanI2aoIwMErq+uCY0BMlANKpxkYwQGBH82TpMicD0pAgQACToD AchqhAG3KQ4HIlQNnErG0IYqB9EAiEQvwEsozC43hy0CAeXMwsLDLS8MAvf497ruCZ+gOA0gfNt3 AIK0J/JWKVzIsEQIADs= --__1353013668404174287abhmt114.oracle.com-- --__1353013668404174286abhmt114.oracle.com-- --__1353013668404174285abhmt114.oracle.com Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --__1353013668404174285abhmt114.oracle.com--