On-demand provisioning is intended to accelerate app development by eliminating the need for development teams to request and wait for operators to create a service instance. However, to control costs, operations teams and administrators must ensure responsible use of resources.
There are several ways to control the provisioning of on-demand service instances by setting various quotas at these levels:
After you set quotas, you can:
Each on-demand service has a separate service broker. A global quota at the service level sets the maximum number of service instances that can be created by a given service broker. If a service has more than one plan, then the number of service instances for all plans combined cannot exceed the global quota for the service.
The operator sets a global quota for each service tile independently. For example, if you have two service tiles, you must set a separate global service quota for each of them.
When the global quota is reached for a service, no more instances of that service can be created unless the quota is increased, or in some instances of that service are deleted.
A service might offer one or more plans. You can set a separate quota per plan so that instances of that plan cannot exceed the plan quota. For a service with multiple plans, the total number of instances created for all plans combined cannot exceed the global quota for the service.
When the plan quota is reached, no more instances of that plan can be created unless the plan quota is increased or some instances of that plan are deleted.
An org-level quota applies to all on-demand services and sets the maximum number of service instances an organization can create within their foundation. For example, if you set your org-level quota to 100, developers can create up to 100 service instances in that org using any combination of on-demand services.
When this quota is met, no more service instances of any kind can be created in the org unless the quota is increased or in some service instances are deleted.
To create and set an org-level quota, do the following:
Run the following command to create a quota for service instances at the org level:
cf create-quota QUOTA-NAME -m TOTAL-MEMORY -i INSTANCE-MEMORY -r ROUTES -s SERVICE-INSTANCES --allow-paid-service-plans
Where:
QUOTA-NAME
—A name for this quota.TOTAL-MEMORY
—Maximum memory used by all service instances combined.INSTANCE-MEMORY
—Maximum memory used by any single service instance.ROUTES
—Maximum number of routes allowed for all service instances combined.SERVICE-INSTANCES
—Maximum number of service instances allowed for the org.For example:
cf create-quota myquota -m 1024mb -i 16gb -r 30 -s 50 --allow-paid-service-plans
Associate the quota you previously created with a specific org by running the following command:
cf set-quota ORG-NAME QUOTA-NAME
For example:
cf set-quota dev_org myquota
A space-level service quota applies to all on-demand services and sets the maximum number of service instances that can be created within a given space in a foundation. For example, if you set your space-level quota to 100, developers can create up to 100 service instances in that space using any combination of on-demand services.
When this quota is met, no more service instances of any kind can be created in the space unless the quota is updated or in some service instances are deleted.
To create and set a space-level quota, do the following:
Run the following command to create the quota:
cf create-space-quota QUOTA-NAME -m TOTAL-MEMORY -i INSTANCE-MEMORY -r ROUTES -s SERVICE-INSTANCES --allow-paid-service-plans
Where:
QUOTA-NAME
—A name for this quota.TOTAL-MEMORY
—Maximum memory used by all service instances combined.INSTANCE-MEMORY
—Maximum memory used by any single service instance.ROUTES
—Maximum number of routes allowed for all service instances combined.SERVICE-INSTANCES
—Maximum number of service instances allowed for the org.For example:
cf create-space-quota myspacequota -m 1024mb -i 16gb -r 30 -s 50 --allow-paid-service-plans
Associate the quota you previously created with a specific space by running the following command:
cf set-space-quota SPACE-NAME QUOTA-NAME
For example:
cf set-space-quota myspace myspacequota
For more information on managing space-level quotas, see Creating and modifying quota plans.
To view org quotas, run the following command.
cf org ORG-NAME
To view space quotas, run the following command:
cf space SPACE-NAME
Service-level and plan-level quota use, and total number of service instances, are available through the on-demand broker metrics emitted to Loggregator.
These are the metrics:
Metric Name | Description |
---|---|
on-demand-broker/SERVICE-NAME/quota_remaining |
Quota remaining for all instances across all plans |
on-demand-broker/SERVICE-NAME/PLAN-NAME/ |
Quota remaining for a specific plan |
on-demand-broker/SERVICE-NAME/total_instances |
Total instances created across all plans |
on-demand-broker/SERVICE-NAME/PLAN-NAME/ |
Total instances created for a specific plan |
Quota metrics are not emitted if no quota has been set.
You can also view service instance usage information in Apps Manager. For more information, see Reporting instance usage with Apps Manager.
On-demand plans use dedicated VMs, disks, and various other resources from an IaaS, such as AWS. To calculate maximum resource cost for plans individually or combined, you multiply the quota by the cost of the resources selected in the plan configuration(s). The specific costs depend on your IaaS.
To view configurations for your VMware SQL with MySQL for TAS on-demand plan, do the following:
Go to Tanzu Operations Manager Installation Dashboard > VMware SQL with MySQL for Tanzu Application Service > Settings.
Click the section for the plan you want to view. For example, Plan 1.
The following image shows an example that includes the VM type and persistent disk selected for the server VMs, and the quota for this plan.
Click the following tabs to show an example of each plan:
Although you can limit on-demand instances with plan quotas and a global quota, as described in the above topics, IaaS resource usage still varies based on the number of on-demand instances provisioned.
To calculate the maximum cost of VMs and persistent disk for each plan, do the following calculation:
plan quota x cost of selected resources
For example, if you selected the options in the previous image, you have selected a VM type micro and a persistent disk type 20 GB, and the plan quota is 15. The VM and persistent disk types have an associated cost for the IaaS you are using. Therefore, to calculate the maximum cost of resources for this plan, multiply the cost of the resources selected by the plan quota:
(15 x cost of micro VM type) + (15 x cost of 20 GB persistent disk) = max cost per plan
To calculate the maximum cost for all plans combined, add together the maximum costs for each plan. This assumes that the sum of your individual plan quotas is less than the global quota.
Here is an example:
(plan1 quota x plan1 resource cost) + ( plan2 quota x plan2 resource cost) = max cost for all plans
To calculate the current actual resource cost across all your on-demand plans:
Find the number of instances currently provisioned for each active plan by looking at the total_instance
metric for that plan.
Multiply the total_instance
count for each plan by that plan’s resource costs. Record the costs for each plan.
Add up the costs noted in Step 2 to get your total current resource costs.
For example:
(plan1 total_instances x plan1 resource cost) + (plan2 total_instances x plan2 resource cost) = current cost for all plans