hi, Nikita Gubenko
Do you make a second round test about random algorithm vm allocation? I had built a tested environment which simulated with yours , with XenServer hypervisor in advanced zone and use FirstFitRoutingAllocator HostAllocator . Below is my test result: XenServer1 : S , C , R , 10,11,15,17,18,20,24,25 XenServer2 : 7,9,12,13,14,16,19,21,22,23 After the test , I think , though the results was not just like toss a coin 20 times , 10 coin head and 10 coin tail, the VMs distribution was randomness , as we expected . In order to let me observe the whole process more easily , I use a log tools which can redirect the raw log to browser , download from http://www.cloudstack-china.org/2012/12/1531.html http://www.cloudstack-china.org/wp-content/plugins/download-monitor/download.php?id=25 and in console terminal input : $./std_to_browser -log=/path/to/(vmpos.log|management-server.log) -bind=ip:port Attach with some pieces of my log : FirstFitPlanner DeploymentPlanner allocation algorithm: random FirstFitPlanner Trying to allocate a host and storage pools from dc:1, pod:null,cluster:null, requested cpu: 128, requested ram: 67108864 FirstFitPlanner Is ROOT volume READY (pool already allocated)?: No FirstFitPlanner Searching all possible resources under this Zone: 1 FirstFitPlanner enough CPU and RAM capacity under this Zone: 1 FirstFitPlanner CPUOverprovisioningFactor considered: 1.0 FirstFitPlanner Checking resources in Cluster: 1 under Pod: 1 FirstFitPlanner Calling HostAllocators to find suitable hosts FirstFitPlanner allocator type:class RecreateHostAllocator$$EnhancerByCGLIB$$8f795c8b FirstFitAllocator Looking for hosts in dc: 1 pod:1 cluster:1 FirstFitAllocator FirstFitAllocator has 2 hosts to check for allocation: [Host[-3-Routing], Host[-7-Routing]] FirstFitAllocator Found 2 hosts for allocation after prioritization: [Host[-3-Routing], Host[-7-Routing]] FirstFitAllocator Looking for speed=128Mhz, Ram=64 CapacityManagerImpl Checking if host: 3 has enough capacity for requested CPU: 128 and requested RAM: 67108864 , cpuOverprovisioningFactor: 1.0 CapacityManagerImpl Hosts's actual total CPU: 12625 and CPU after applying overprovisioning: 12625 CapacityManagerImpl Checking if host: 7 has enough capacity for requested CPU: 128 and requested RAM: 67108864 , cpuOverprovisioningFactor: 1.0 CapacityManagerImpl Hosts's actual total CPU: 12625 and CPU after applying overprovisioning: 12625 CapacityManagerImpl Free CPU: 11345 , Requested CPU: 128 FirstFitAllocator Found a suitable host, adding to list: 7 FirstFitPlanner Checking suitable pools for volume (Id, Type): (24,ROOT) FirstFitPlanner Calling StoragePoolAllocators to find suitable pools FirstFitStoragePoolAllocator FirstFitStoragePoolAllocator has 1 pools to check for allocation AbstractStoragePoolAllocator Checking if storage pool is suitable, name: pri ,poolId: 201 StorageManagerImpl Checking pool 201 for storage, totalSize: 203829477376, usedBytes: 94380589056, usedPct: 0.4630369967632213, disable threshold: 0.85 StorageManagerImpl Checking pool: 201 for volume allocation [Vol[24|vm=24|ROOT]], maxSize : 407658954752, totalAllocatedSize : 7896982528, askingSize : 52428800, allocated disable threshold: 0.85 FirstFitStoragePoolAllocator FirstFitStoragePoolAllocator returning 1 suitable storage pools FirstFitPlanner Host: 3 can access pool: 201 FirstFitPlanner Found a potential host id: 3 name: xenserver-120-23 and associated storage pools for this VM FirstFitPlanner Returning Deployment Destination: Dest[Zone(Id)-Pod(Id)-Cluster(Id)-Host(Id)-Storage(Volume(Id|Type-->Pool(Id))] : Dest[Zone(1)-Pod(1)-Cluster(1)-Host(3)-Storage(Volume(24|ROOT-->Pool(201))] VirtualMachineManagerImpl Deployment found - P0=VM[User|6acc656f-2ead-41a9-b891-39453fda5942], P0=Dest[Zone(Id)-Pod(Id)-Cluster(Id)-Host(Id)-Storage(Volume(Id|Type-->Pool(Id))] : Dest[Zone(1)-Pod(1)-Cluster(1)-Host(3)-Storage(Volume(24|ROOT-->Pool(201))] CapacityManagerImpl VM state transitted from :Starting to Starting with event: OperationRetryvm's original host id: null new host id: 3 host id before state transition: null ------------------ Regards, ChunFeng ------------------ Original ------------------ From: "Nikita Gubenko"<nikita.gube...@gmail.com>; Date: Thu, Apr 25, 2013 07:55 AM To: "users"<users@cloudstack.apache.org>; Subject: Re: VM allocation scheduler Sure. On Thu, Apr 25, 2013 at 3:54 AM, ChunFeng <chunf...@domolo.com> wrote: > hi, Nikita Gubenko > > > The configuration of HostAllocator node in your components.xml is ok. > > > Btw, did you restart management server after you changed the > vm.allocation.algorithm value in global configuration and before create > your user VM instance ? > > > ------------------ > > > Regards, > > > ChunFeng > > > > ------------------ Original ------------------ > From: "Nikita Gubenko"<nikita.gube...@gmail.com>; > Date: Wed, Apr 24, 2013 10:04 PM > To: "users"<users@cloudstack.apache.org>; > > Subject: Re: VM allocation scheduler > > > I have this > <adapters key="com.cloud.agent.manager.allocator.HostAllocator"> > <adapter name="FirstFitRouting" > class="com.cloud.agent.manager.allocator.impl.FirstFitRoutingAllocator"/> > <!--adapter name="FirstFitRouting" > class="com.cloud.agent.manager.allocator.impl.RecreateHostAllocator"/--> > <!--adapter name="FirstFit" > class="com.cloud.agent.manager.allocator.impl.FirstFitAllocator"/--> > </adapters> > > at /usr/src/apache-cloudstack-4.0.1-incubating-src/client/tomcatconf/ > components.xml.in > How should I change this to get balanced/random distribution? > Thanks > > > On Wed, Apr 24, 2013 at 5:54 PM, ChunFeng <chunf...@domolo.com> wrote: > > > hi, Nikita Gubenko > > > > > > When using random allocation algorithm to deploy VNs to hosts in > > cluster , as we expected , should make a balanced distribution . > > > > > > In your cluster the VMs distribution was 14:6 , though the total > > numbers of VMs is fewer , but make some sense. > > > > > > I think you should check the adapters item in components.xml file in > > which HostAllocator using . > > > > > > <adapters > > key="com.cloud.agent.manager.allocator.HostAllocator"> > > > > > > > > > > > > Regards, > > > > > > ChunFeng > > > > > > > > > > > > > > > > > > > > ------------------ Original ------------------ > > From: "Nikita Gubenko"<nikita.gube...@gmail.com>; > > Date: Wed, Apr 24, 2013 04:24 AM > > To: "users"<users@cloudstack.apache.org>; > > > > Subject: VM allocation scheduler > > > > > > Hi > > I have cluster with two xenserver hosts in it. vm.allocation.algorithm is > > set to random. When I try to create 20 vms the allocation algorithm works > > strange - it allocates 14 one host (where console proxy + ssvm also) and > 6 > > to other host (+VR). Should it work like that? > > > > > > Thanks > > -- > > Best Regards, Nikita Gubenko > > > > > > -- > Best Regards, Nikita Gubenko > -- Best Regards, Nikita Gubenko