About the Least Sold Key Quota policy
The Least Sold Key Quota policy chooses a resource that has sold the least amount of the key quota (quota type) that you have specified. If there are two or more resources with the same value of the least-sold key quota, this policy picks any one of them randomly.
While setting this policy for a service, you need to specify the key quota. This key quota is then used by the Least Sold Key Quota policy to choose a resource from a list of all those resources that satisfy all the service-specific quota requirements for the organization. Any resource from this list of resources that has sold the least amount of the key quota is chosen by the policy for hosting the service for the organization.
If all the resources have sold unlimited amount of the key quota, since all of them have sold the same amount of the key quota, the Least Sold Key Quota policy will choose any one of these resources randomly.
If a resource does not have the key quota, the policy ignores this resource and moves on to the next resource.
If none of the resources has the key quota, the service provisioning process fails with an exception. This usually occurs if you have not selected the appropriate quota type as the key quota.
If none of the resources has the key quota, and the key quota is not selected while provisioning the service to the organization, the policy then selects the first available resource that satisfies all the service-specific quota requirements for the organization.
Since the Least Sold Key Quota policy checks only the amount of key quota that is sold and not the amount of key quota that is available or being currently used, this policy may heavily utilize certain resources that may be low-end resources. Therefore, you should create separate pools for low-end and high-end resources.
Example: You have specified the key quota as disk space. A service provider has access to three resources with resource IDs as 1, 2, and 3, all with unlimited disk space quota and none of them has been used for service provision.
If the service provider now tries to provision a service with 100 MB disk space quota to an organization, and all the four resources satisfy all the service-specific quota requirements, the Least Sold Key Quota policy will choose any resource randomly since all resources have sold the least amount of the key quota. Let us assume that it selects the resource with ID 2.
For the second service provision with say 200 MB disk space quota, the policy can now choose only between resources with IDs 1 and 3. Let us assume that it selects the resource with ID 1.
For the third service provision with say 50 MB disk space quota, the policy will directly select the resource with ID 3, since that resource has sold the least amount (0 MB) of the key quota.
For the fourth service provision with say 400 MB disk space quota, since the resource with ID 1 has sold 200 MB disk space quota, the resource with ID 2 has sold 100 MB disk space quota, and the resource with ID 3 has sold 50 MB disk space quota, the policy selects the resource with ID 3 since it has sold the least amount of the key quota.