Skip to content

Commit b8b3eed

Browse files
authored
feat(autoscale): add documentation for the autoscale functionality (#483)
Closes #403
1 parent b00f9e3 commit b8b3eed

1 file changed

Lines changed: 68 additions & 28 deletions

File tree

src/applications/managing-app-processes.md

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ Scaling processes... but first, coffee!
8585
done in 0s
8686
=== steely-mainsail Processes
8787
--- cmd:
88-
steely-mainsail-v3-cmd-nyrim up (v3)
88+
steely-mainsail-cmd-3291896318-nyrim up (v3)
8989
--- sleeper:
90-
steely-mainsail-v3-sleeper-oq1jr up (v3)
90+
steely-mainsail-sleeper-3291896318-oq1jr up (v3)
9191
```
9292

9393
!!! note
@@ -102,25 +102,25 @@ Scaling processes... but first, coffee!
102102
done in 3s
103103
=== steely-mainsail Processes
104104
--- cmd:
105-
steely-mainsail-v3-cmd-nyrim up (v3)
105+
steely-mainsail-cmd-3291896318-nyrim up (v3)
106106
```
107107

108108
## Scaling Processes
109109

110-
Applications deployed on Deis Workflow [scale out via the process model][]. Use `deis scale` to control the number of
111-
[Containers][container] that power your app.
110+
Applications deployed on Deis Workflow scale out via the [process model][]. Use `deis scale` to control the number of
111+
[containers][container] that power your app.
112112

113113
```
114114
$ deis scale cmd=5 -a iciest-waggoner
115115
Scaling processes... but first, coffee!
116116
done in 3s
117117
=== iciest-waggoner Processes
118118
--- cmd:
119-
iciest-waggoner-v2-cmd-09j0o up (v2)
120-
iciest-waggoner-v2-cmd-3r7kp up (v2)
121-
iciest-waggoner-v2-cmd-gc4xv up (v2)
122-
iciest-waggoner-v2-cmd-lviwo up (v2)
123-
iciest-waggoner-v2-cmd-kt7vu up (v2)
119+
iciest-waggoner-web-3291896318-09j0o up (v2)
120+
iciest-waggoner-web-3291896318-3r7kp up (v2)
121+
iciest-waggoner-web-3291896318-gc4xv up (v2)
122+
iciest-waggoner-web-3291896318-lviwo up (v2)
123+
iciest-waggoner-web-3291896318-kt7vu up (v2)
124124
```
125125

126126
If you have multiple process types for your application you may scale the process count for each type separately. For
@@ -135,13 +135,13 @@ Scaling processes... but first, coffee!
135135
done in 4s
136136
=== scenic-icehouse Processes
137137
--- web:
138-
scenic-icehouse-v2-web-7lord up (v2)
139-
scenic-icehouse-v2-web-jn957 up (v2)
140-
scenic-icehouse-v2-web-rsekj up (v2)
141-
scenic-icehouse-v2-web-vwhnh up (v2)
142-
scenic-icehouse-v2-web-vokg7 up (v2)
138+
scenic-icehouse-web-3291896318-7lord up (v2)
139+
scenic-icehouse-web-3291896318-jn957 up (v2)
140+
scenic-icehouse-web-3291896318-rsekj up (v2)
141+
scenic-icehouse-web-3291896318-vwhnh up (v2)
142+
scenic-icehouse-web-3291896318-vokg7 up (v2)
143143
--- background:
144-
scenic-icehouse-v2-background-yf8kh up (v2)
144+
scenic-icehouse-web-3291896318-background-yf8kh up (v2)
145145
```
146146

147147
!!! note
@@ -159,13 +159,51 @@ Scaling processes... but first, coffee!
159159
done in 1s
160160
=== scenic-icehouse Processes
161161
--- background:
162-
scenic-icehouse-v2-background-yf8kh up (v2)
162+
scenic-icehouse-web-3291896318-background-yf8kh up (v2)
163163
--- web:
164-
scenic-icehouse-v2-web-7lord up (v2)
165-
scenic-icehouse-v2-web-rsekj up (v2)
166-
scenic-icehouse-v2-web-vokg7 up (v2)
164+
scenic-icehouse-web-3291896318-7lord up (v2)
165+
scenic-icehouse-web-3291896318-rsekj up (v2)
166+
scenic-icehouse-web-3291896318-vokg7 up (v2)
167167
```
168168

169+
## Autoscale
170+
171+
Autoscale allows adding a minimum and maximum number of pods on a per process type basis. This is accomplished by specifying a target CPU usage across all available pods.
172+
173+
This feature is built on top of [Horizontal Pod Autoscaling][HPA] in Kubernetes or [HPA][] for short.
174+
175+
!!! note
176+
This is an alpha feature. It is recommended to be on the latest Kubernetes when using this feature.
177+
178+
```
179+
$ deis autoscale:set web --min=3 --max=8 --cpu-percent=75
180+
Applying autoscale settings for process type web on scenic-icehouse... done
181+
182+
```
183+
And then review the scaling rule that was created for `web`
184+
185+
```
186+
$ deis autoscale:list
187+
=== scenic-icehouse Autoscale
188+
189+
--- web:
190+
Min Replicas: 3
191+
Max Replicas: 8
192+
CPU: 75%
193+
```
194+
195+
Remove scaling rule
196+
197+
```
198+
$ deis autoscale:unset web
199+
Removing autoscale for process type web on scenic-icehouse... done
200+
```
201+
202+
For autoscaling to work CPU requests have to be specified on each application Pod (can be done via `deis limits --cpu`). This allows the autoscale policies to do the [appropriate calculations][autoscale-algo] and make decisions on when to scale up and down.
203+
204+
Scale up can only happen if there was no rescaling within the last 3 minutes. Scale down will wait for 5 minutes from the last rescaling. That information and more can be found at [HPA algorithm page][autoscale-algo].
205+
206+
169207
## Web vs Cmd Process Types
170208

171209
When deploying to Deis Workflow using a Heroku Buildpack, Workflow boots the `web` process type to
@@ -189,25 +227,27 @@ Kubernetes to terminate the old process and launch a new one in its place.
189227
$ deis ps
190228
=== scenic-icehouse Processes
191229
--- web:
192-
scenic-icehouse-v2-web-7lord up (v2)
193-
scenic-icehouse-v2-web-rsekj up (v2)
194-
scenic-icehouse-v2-web-vokg7 up (v2)
230+
scenic-icehouse-web-3291896318-7lord up (v2)
231+
scenic-icehouse-web-3291896318-rsekj up (v2)
232+
scenic-icehouse-web-3291896318-vokg7 up (v2)
195233
--- background:
196-
scenic-icehouse-v2-background-yf8kh up (v2)
197-
$ deis ps:restart scenic-icehouse-v2-background-yf8kh
234+
scenic-icehouse-background-3291896318-yf8kh up (v2)
235+
$ deis ps:restart scenic-icehouse-background-3291896318-yf8kh
198236
Restarting processes... but first, coffee!
199237
done in 6s
200238
=== scenic-icehouse Processes
201239
--- background:
202-
scenic-icehouse-v2-background-yd87g up (v2)
240+
scenic-icehouse-background-3291896318-yd87g up (v2)
203241
```
204242

205-
Notice that the process name has changed from `scenic-icehouse-v2-background-yf8kh` to
206-
`scenic-icehouse-v2-background-yd87g`. In a multi-node Kubernetes cluster, this may also have the effect of scheduling
243+
Notice that the process name has changed from `scenic-icehouse-background-3291896318-yf8kh` to
244+
`scenic-icehouse-background-3291896318-yd87g`. In a multi-node Kubernetes cluster, this may also have the effect of scheduling
207245
the Pod to a new node.
208246

209247
[container]: ../reference-guide/terms.md#container
210248
[process model]: https://devcenter.heroku.com/articles/process-model
211249
[buildpacks]: ../applications/using-buildpacks.md
212250
[dockerfile]: ../applications/using-dockerfiles.md
213251
[docker image]: ../applications/using-docker-images.md
252+
[HPA]: http://kubernetes.io/docs/user-guide/horizontal-pod-autoscaling/
253+
[autoscale-algo]: https://github.com/kubernetes/kubernetes/blob/master/docs/design/horizontal-pod-autoscaler.md#autoscaling-algorithm

0 commit comments

Comments
 (0)