Skip to content

Commit

Permalink
prevent scaling to zero for both ATS and repo
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Jun 5, 2024
1 parent 6d00021 commit 1f1d47e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
38 changes: 19 additions & 19 deletions docs/helm/autoscaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ alfresco-repository:
...
```
The Alfresco repository [KEDA
scaledobject](https://keda.sh/docs/latest/concepts/scaling-deployments/#scaledobject-spec)
forbids scaling repository replicaset down to zero, mainly because it is a
service which requires some time to startup (incompatible with on-demand spin
up) and it is the main service of the Alfresco platform.
##### Prometheus scaler
The KEDA based auto scaler relies on the number of Tomcat thread used. By
Expand All @@ -113,6 +119,14 @@ In the same maner the parameters below can be set:
* `minReplicas`: The default minimum number of replica count is 1.
* `maxReplicas`: The default maximum number of replica count is 3.

To enable repository scaling through KEDA, you need to set the following values:

```yaml
keda:
components:
- alfresco-repository
```

### Alfresco Transform Service

#### Basic (CPU based) scaling for ATS
Expand All @@ -127,6 +141,11 @@ implications.

To start with, make sure your Kubernetes cluster has KEDA installed

The Alfresco Transform Service[KEDA
scaledobject](https://keda.sh/docs/latest/concepts/scaling-deployments/#scaledobject-spec)
forbids scaling tengines replicaset down to zero, as the T-router would
eventually stop working if it losses all instances of a specific tengine.

##### Activemq scaler

Regular ActiveMQ instances exposes a rest API which can be used to get the
Expand All @@ -152,11 +171,6 @@ T-engine workloads (`imagemagick`, `libreoffice`, `transformmisc`, `pdfrenderer`
* `kedaPollingInterval`: Queues are checked every 15 seconds.
* `kedaInitialCoolDownPeriod`: KEDA will wait for 5 minutes before activating
the scaling object (before no scaling can happen).
* `kedaCooldownPeriod`: After KEDA has found there is no activity in the
monitored queue, it will wait for 15 minutes before scaling down the pods to
0.
* `kedaIdleReplicas`: The default idle replica count is 0 (tears down the
service).
* `minReplicas`: The default minimum number of replica count is 1.
* `maxReplicas`: The default maximum number of replica count is 3.

Expand All @@ -165,20 +179,6 @@ T-engine workloads (`imagemagick`, `libreoffice`, `transformmisc`, `pdfrenderer`
> is one of the following: `imagemagick`, `libreoffice`, `transformmisc`,
> `pdfrenderer` & `tika`.

Scaling replicas down to zero is great when you have workload that is consistent
enough with long period of inactivity (e.g. overnigh). But it can trigger a
delay for the first requests when the workload starts again (e.g. the morning
after). If you want to avoid scaling down you ATS deployments down to zero and
always have at least one pod up to deal with "lonely" requests just apply the
yaml below for the appropriate scaler object (here for pdf convertion):

```yaml
alfresco-transform-service:
pdfrenderer:
autoscaling:
kedaIdleReplicas: null
```

If you want to use an external ActiveMQ broker instead of the embeded one
(recommended), you can set the following values:

Expand Down
4 changes: 2 additions & 2 deletions helm/alfresco-content-services/templates/_helpers-keda.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Usage: include "alfresco-content-services.keda.scaler.options" $
{{- define "alfresco-content-services.keda.scaler.options" -}}
pollingInterval: {{ .autoscaling.kedaPollingInterval | default 15 }}
initialCooldownPeriod: {{ .autoscaling.kedaInitialCooldownPeriod | default 300 }}
cooldownPeriod: {{ .autoscaling.kedaCooldownPeriod | default 900 }}
idleReplicaCount: {{ .autoscaling.kedaIdleReplicas | default 0 }}
cooldownPeriod: {{ .autoscaling.kedaCooldownPeriod | default "null" }}
idleReplicaCount: {{ .autoscaling.kedaIdleReplicas | default "null" }}
minReplicaCount: {{ .autoscaling.minReplicas }}
maxReplicaCount: {{ .autoscaling.maxReplicas }}
advanced:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ spec:
serverAddress: {{ required $reqMsg .Values.prometheus.url }}
threshold: {{ $repoCtx.Values.autoscaling.kedaTargetValue | default 170 | quote }}
query: avg(jvm_threads_live_threads-jvm_threads_daemon_threads)
{{- $scaleOpts := omit (include "alfresco-content-services.keda.scaler.options" $repoCtx.Values | fromYaml) "idleReplicaCount" }}
{{- toYaml $scaleOpts | nindent 2 }}
{{- include "alfresco-content-services.keda.scaler.options" $repoCtx.Values | nindent 2 }}
{{- end }}

0 comments on commit 1f1d47e

Please sign in to comment.