Skip to content

Commit f95d409

Browse files
authored
Use the GODEBUG env var to disable Transparent Huge Pages (#463)
THP is unhelpful for databases, in general, because memory access tends to be non-contiguous, and the use of THP can make performance worse when it requires a bunch of page defragmentation to load and map a huge page. We now disable it by default, using the GODEBUG environment variable. Adds a generic facility for managing GODEBUG clauses to the Helm chart. closes https://cockroachlabs.atlassian.net/browse/TREQ-888
1 parent ed4f72a commit f95d409

File tree

6 files changed

+293
-268
lines changed

6 files changed

+293
-268
lines changed

build/templates/README.md

Lines changed: 135 additions & 134 deletions
Large diffs are not rendered by default.

build/templates/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,3 +710,8 @@ iap:
710710
# Create Google Cloud OAuth credentials and set client id and secret
711711
# clientId:
712712
# clientSecret:
713+
714+
# Set the GODEBUG env var for the Go runtime. By default, disable Transparent Huge Pages,
715+
# which cause memory inefficiency for CRDB.
716+
godebug:
717+
disablethp: "1"

cockroachdb/README.md

Lines changed: 135 additions & 134 deletions
Large diffs are not rendered by default.

cockroachdb/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,14 @@ Validate the WAL failover configuration.
350350
{{- end -}}
351351
{{- end -}}
352352
{{- end -}}
353+
354+
{{/*
355+
Construct the GODEBUG env var value (looks like: GODEBUG="foo=bar,baz=quux"; default: "disablethp=1")
356+
*/}}
357+
{{- define "godebugList" -}}
358+
{{- $godebugList := list -}}
359+
{{- range $key, $value := .Values.godebug }}
360+
{{- $godebugList = append $godebugList (printf "%s=%s" $key $value) -}}
361+
{{- end }}
362+
{{- join "," $godebugList -}}
363+
{{- end }}

cockroachdb/templates/statefulset.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ spec:
260260
value: {{ template "cockroachdb.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
261261
- name: COCKROACH_CHANNEL
262262
value: kubernetes-helm
263+
- name: GODEBUG
264+
value: {{ include "godebugList" . }}
263265
{{- with .Values.statefulset.env }}
264266
{{- toYaml . | nindent 12 }}
265267
{{- end }}

cockroachdb/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,3 +711,8 @@ iap:
711711
# Create Google Cloud OAuth credentials and set client id and secret
712712
# clientId:
713713
# clientSecret:
714+
715+
# Set the GODEBUG env var for the Go runtime. By default, disable Transparent Huge Pages,
716+
# which cause memory inefficiency for CRDB.
717+
godebug:
718+
disablethp: "1"

0 commit comments

Comments
 (0)