-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy path_set_quotas.html.md.erb
365 lines (267 loc) · 12.6 KB
/
_set_quotas.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
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:
* [Global](#global)
* [Plan](#plan)
* [Org](#org)
* [Space](#space)
After you set quotas, you can:
* [View Current Org and Space-level Quotas](#view)
* [Monitor Quota Use and Service Instance Count](#monitor)
* [Calculate Resource Costs for On-Demand Plans](#calculate)
## <a id="global"></a> Create Global-level Quotas
Each Pivotal Cloud Foundry (PCF) 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 PCF service independently.
For example, if you have Redis for PCF and RabbitMQ for PCF, 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 some instances of that service are deleted.
## <a id="plan"></a> Create Plan-level Quotas
A service may 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](#global) for the service.
<% if vars.service_name == "MySQL for PCF" %>
If the plan quota field is blank, the plan quota is set to the global quota by default.
<%end%>
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.
## <a id="org"></a> Create and Set Org-level Quotas
An org-level quota applies to all PCF services and sets the maximum number of
service instances an organization can create within PCF.
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 PCF 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 some service instances are deleted.
To create and set an org-level quota, do the following:
1. Run this command to create a quota for service instances at the org level:
<pre>
cf create-quota QUOTA-NAME -m TOTAL-MEMORY -i INSTANCE-MEMORY -r ROUTES -s SERVICE-INSTANCES --allow-paid-service-plans
</pre>
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:
<pre class="terminal">cf create-quota myquota -m 1024mb -i 16gb -r 30 -s 50 --allow-paid-service-plans</pre>
2. Associate the quota you created above with a specific org by running the following command:
<pre>
cf set-quota ORG-NAME QUOTA-NAME
</pre>
For example:
<pre class="terminal">cf set-quota dev_org myquota</pre>
For more information on managing org-level quotas,
see [Creating and Modifying Quota Plans](https://docs.pivotal.io/pivotalcf/1-12/adminguide/quota-plans.html).
## <a id="space"></a> Create and Set Space-level Quotas
A space-level service quota applies to all PCF services and sets the maximum
number of service instances
that can be created within a given space in PCF.
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 PCF 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 some service instances are deleted.
To create and set a space-level quota, do the following:
1. Run the following command to create the quota:
<pre>
cf create-space-quota QUOTA-NAME -m TOTAL-MEMORY -i INSTANCE-MEMORY -r ROUTES -s SERVICE-INSTANCES --allow-paid-service-plans
</pre>
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:
<pre class="terminal">cf create-space-quota myspacequota -m 1024mb -i 16gb -r 30 -s 50 --allow-paid-service-plans</pre>
2. Associate the quota you created above with a specific space by running the following command:
<pre>
cf set-space-quota SPACE-NAME QUOTA-NAME
</pre>
For example:
<pre class="terminal">cf set-space-quota myspace myspacequota</pre>
For more information on managing space-level quotas,
see [Creating and Modifying Quota Plans](https://docs.pivotal.io/pivotalcf/1-12/adminguide/quota-plans.html).
## <a id="view"></a> View Current Org and Space-level Quotas
To view **org** quotas, run the following command.
```
cf org ORG-NAME
```
To view **space** quotas, run the following command:
```
cf space SPACE-NAME
```
For more information on managing org and space-level quotas,
see the [Creating and Modifying Quota Plans](https://docs.pivotal.io/pivotalcf/adminguide/quota-plans.html).
## <a id="monitor"></a> Monitor Quota Use and Service Instance Count
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 metrics are listed below:
<table>
<tr>
<th width=60%><b>Metric Name</b></th>
<th width=40%><b>Description</b></th>
</tr>
<tr>
<td><code>on-demand-broker/SERVICE-NAME/quota_remaining</code></td>
<td>Quota remaining for all instances across all plans</td>
</tr>
<tr>
<td><code>on-demand-broker/SERVICE-NAME/PLAN-NAME/<br>quota_remaining</code> </td>
<td>Quota remaining for a specific plan</td>
</tr>
<tr>
<td><code>on-demand-broker/SERVICE-NAME/total_instances</code> </td>
<td>Total instances created across all plans</td>
</tr>
<tr>
<td><code>on-demand-broker/SERVICE-NAME/PLAN-NAME/<br>total_instances</code> </td>
<td>Total instances created for a specific plan</td>
</tr>
</table>
<p class="note"><strong>Note:</strong> Quota metrics are not emitted if no quota
has been set.</p>
You can also view service instance usage information in Apps Manager. For more information,
see [Reporting Instance Usage with Apps Manager](https://docs.pivotal.io/pivotalcf/opsguide/accounting-report-apps-man.html).
## <a id="calculate"></a> Calculate Resource Costs for On-Demand Plans
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 <%= vars.service_name %> on-demand plan, do the following:
1. Navigate to **Ops Manager Installation Dashboard** > **<%= vars.tile_name %>** > **Settings**.
1. Click the section for the plan you want to view.
<% if vars.service_name == 'RabbitMQ for PCF' %>
For example, **On Demand Instance (RMQ 3.7): Plan 1**.
<% end %>
<% if vars.service_name == 'Redis for PCF' %>
For example, **On-Demand Plan 1**.
<% end %>
<% if vars.service_name == 'MySQL for PCF' %>
For example, **Plan 1**.
<% end %>
<% if vars.service_name == 'Pivotal Cloud Cache' %>
For example, **Plan 1**.
<% end %>
<% if vars.service_name == 'Pivotal Cloud Cache' %>
The image below shows an example that includes the VM type and persistent disk
selected for the server VMs, as well as the quota for this plan.
The quota is shown in the **Maximum service instances** field.
<% else %>
The image below shows an example that includes the VM type and persistent disk
selected for the server VMs, as well as the quota for this plan.
<% end %>
<% if current_page.data.galera %>
Click the tabs below to show an example of each plan:
<style>
.tab {
overflow: hidden;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Style the buttons that are used to open the tab content */
.tab button {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: ;
transition: 0.3s;
}
/* Change background color of buttons on hover */
.tab button:hover {
background-color: #ddd;
}
/* Create an active/current tablink class */
.tab button.active {
background-color: #ccc;
}
/* Style the tab content */
.tabcontent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
</style>
<script>
function openDocs(evt, docsName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(docsName).style.display = "block";
evt.currentTarget.className += " active";
}
</script>
<div class="tab">
<!- Tab headers and links ->
<button class="tablinks" onclick="openDocs(event, 'tab1')">Single Node and Leader Follower</button>
<button class="tablinks" onclick="openDocs(event, 'tab2')">Galera [BETA]</button>
</div>
<div id="tab1" class="tabcontent">
<img src="./images/sn-lf-plan.png">
</div>
<div id="tab2" class="tabcontent">
<img src="./images/galera-plan.png">
</div>
<% else %>
<%= image_tag("../images/plan-resources.png",
:alt => "Example showing a quota set to 15 instances, VM type set to micro, and persistent disk type set to 20 GB",
:width => "400") %>
<% end %>
<p class="note"><strong>Note:</strong>
Although operators 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.</p>
### <a id="calculate-per-plan"></a> Calculate Maximum Resource Cost Per On-Demand Plan
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 above 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**
### <a id="calculate-all-plans"></a> Calculate Maximum Resource Cost for All On-Demand Plans
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**
### <a id="calculate-actual"></a> Calculate Actual Resource Cost of all On-Demand Plans
To calculate the current actual resource cost across all your on-demand plans:
1. Find the number of instances currently provisioned for each active plan by
looking at the `total_instance` [metric](#monitor) for that plan.
2. Multiply the `total_instance` count for each plan by that plan's resource costs.
Record the costs for each plan.
3. 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**