Hi list, I have a machine with Intel Xeon E5420 quad core processor and I''m now wondering how to divide the CPU between all Xen instances. I am running one qmail based mail server and several LAMP web servers. The server OS is CentOS Linux. What I''ve learnt from the archives is that dom0 should have its own dedicated core. But what about the rest, the mail server needs most CPU time, so I could dedicate a core for it too. Would id benefit from having access to the "pool" of the remaining cores too? And what about VCPUs. Would a dom0 or domU benefit having say 2 VCPUs and running an SMP kernel while in reality it is running only on 1 physical core? Regards, Peter _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
The "right answer" depends on what you want to optimize for. Your webserver has human users for whom a 500ms delay has a measurable impact. How important are those users compared to snappy email? If a vm has to wait, which vm should it be? What workload, normal and peak, do you anticipate for each vm? My prejudice, as someone who works with website performance is to maximize user experience, but only you know your business context. I think that it''s best to start simple and approach CPU tuning with a "trust but verify" mindset. I''d probably only dedicate a CPU for dom0, and Sent from my iPhone On Jul 6, 2009, at 8:48 AM, Peter Peltonen <peter.peltonen@gmail.com> wrote:> Hi list, > > I have a machine with Intel Xeon E5420 quad core processor and I''m > now wondering how to divide the CPU between all Xen instances. > > I am running one qmail based mail server and several LAMP web servers. > The server OS is CentOS Linux. > > What I''ve learnt from the archives is that dom0 should have its own > dedicated core. > > But what about the rest, the mail server needs most CPU time, so I > could dedicate a core for it too. Would id benefit from having access > to the "pool" of the remaining cores too? > > And what about VCPUs. Would a dom0 or domU benefit having say 2 VCPUs > and running an SMP kernel while in reality it is running only on 1 > physical core? > > Regards, > Peter > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hi and thanks for your reply, On Mon, Jul 6, 2009 at 4:47 PM, Siddharth Wagh<siddharth.wagh@gmail.com> wrote:> The Xen document specifies that upto 32 VCPUs may be allocated to a single > domU. But it is recommended that one allocates the same number of VCPUs or > less than the number of logical CPUs on your machine, for optimum > performance. Since, you have a quad-core processor, the maximum number of > VCPUs you could allot to each domU w/o compromising on performance is 4.But what is the benefit of having more VCPUs in a logical CPU? In what kind of cirumstances does a domU perform better with a 4 VCPUs than with 1 VCPU? I don''t undrestand the difference, as in the end there is just one logical CPU doing all the work. Regards, Peter _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
multiple VCPU can''t use more than one CPU ? Olivier Peter Peltonen a écrit :> Hi and thanks for your reply, > > On Mon, Jul 6, 2009 at 4:47 PM, Siddharth Wagh<siddharth.wagh@gmail.com> wrote: > >> The Xen document specifies that upto 32 VCPUs may be allocated to a single >> domU. But it is recommended that one allocates the same number of VCPUs or >> less than the number of logical CPUs on your machine, for optimum >> performance. Since, you have a quad-core processor, the maximum number of >> VCPUs you could allot to each domU w/o compromising on performance is 4. >> > > But what is the benefit of having more VCPUs in a logical CPU? > > In what kind of cirumstances does a domU perform better with a 4 VCPUs > than with 1 VCPU? > > I don''t undrestand the difference, as in the end there is just one > logical CPU doing all the work. > > Regards, > Peter > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Mon, 2009-07-06 at 17:22 +0300, Peter Peltonen wrote:> Hi and thanks for your reply, > > On Mon, Jul 6, 2009 at 4:47 PM, Siddharth Wagh<siddharth.wagh@gmail.com> wrote: > > The Xen document specifies that upto 32 VCPUs may be allocated to a single > > domU. But it is recommended that one allocates the same number of VCPUs or > > less than the number of logical CPUs on your machine, for optimum > > performance. Since, you have a quad-core processor, the maximum number of > > VCPUs you could allot to each domU w/o compromising on performance is 4. > > But what is the benefit of having more VCPUs in a logical CPU?None that I know of, and probably that''s why the manual recommends limiting the VCPUs to the number of host CPUs.> In what kind of cirumstances does a domU perform better with a 4 VCPUs > than with 1 VCPU?If you have more than one thread eating CPU, the threads can span across multiple physical CPUs, resulting in better performance. If you have only one VCPU, all the work will be done by a single host CPU.> I don''t undrestand the difference, as in the end there is just one > logical CPU doing all the work.As far as I know, different VCPUs can be mapped to different host CPUs by the xen scheduler. Cheers, Radu R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Peter Peltonen <peter.peltonen@gmail.com> writes:> In what kind of cirumstances does a domU perform better with a 4 VCPUs > than with 1 VCPU?It is a best case/worst case tradeoff. say I have 30 guests on one of my 32GiB ram/8 core boxes; Obviously, I dedicate one core to the Dom0, and set cpus=1-7 for the rest so nobody else can touch the dom0 core. But for the guests, should I give them each 1 vcpu? 4vcpus? 6 vcpus? first, if only one guest is running, if it only has one vcpu, it can only use one physical cpu, so I''m wasting 6 cores (I''m using one in the dom0, remember?) - if I gave everyone 4 vcpus, that one domain could use 4 CPUs, getting more power. so if I only give 1 vcpu to each guest, best case performance is limited. However, if I have vcpus=4 in all guests, one guest is using all 4 vcpus and all the sudden another guest wants to use all 4 vcpus, they have to share. (well, at this point they only have to share 1 vcpu. Now, I''ve read that this can cause scheduling problems, e.g., if one vcpu is more available than another, thus the vmware guys going on about ''gang scheduling''.) even leaving the ''gang scheduling'' to the smart people, if you have more vcpus that want to run at a given moment than physical cpus, it seems pretty obvious to even the most simple-minded janitor that you are going to be doing more context switching, and context switching is expensive. if you accept that the more vcpus each DomU has, the more context switching is going to happen, it follows that worst-case performance gets worse as the number of vcpus in each domain goes up. now, optimizing for best case vs worst case is a business decision. Me, I give each customer 1 vcpu, because I think it''s easier to adjust to being not so awesome in the best case than it is to adjust to total suckage in the worst case. (that, and I know I have some customers who load their VPS to the max.) On the other hand, I have lost one customer I know about (meaning I have lost several orders of magnitude more that I don''t know about) because I get absolutely slaughtered in unixbench type synthetic cpu benchmarks because of this (though I tend to do okay in real-world application benchmarks) and to be clear, looking at xentop, I usually don''t have more than 3 or 4 domains running, so it would probably be ok for me to set vcpus to 2 (maybe I will do so for the larger domains) _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users