├── .gitignore
├── images
├── write_bw.1-2Draw.png
└── cnp-sandbox-transactions.png
├── CODEOWNERS
├── cnp-loadbalancer
├── .helmignore
├── templates
│ ├── cnp_pooler.yaml
│ ├── NOTES.txt
│ ├── cnp_loadbalancer.yaml
│ ├── _helpers.tpl
│ └── cnp_cluster.yaml
├── Chart.yaml
├── README.md
├── values.yaml
└── values.schema.json
├── fio-benchmark
├── .helmignore
├── templates
│ ├── NOTES.txt
│ ├── fio_pvc.yaml
│ ├── _helpers.tpl
│ ├── fio_job_configmap.yaml
│ └── fio_deployment.yaml
├── Chart.yaml
├── values.schema.json
├── values.yaml
└── README.md
├── hammerdb-benchmark
├── templates
│ ├── hammerdb_config.yaml
│ ├── cnp_pooler.yaml
│ ├── NOTES.txt
│ ├── cnp_cluster.yaml
│ ├── hammerdb_job.yaml
│ └── _helpers.tpl
├── .helmignore
├── Chart.yaml
├── README.md
├── values.yaml
└── values.schema.json
├── pgbench-benchmark
├── .helmignore
├── templates
│ ├── cnp_pooler.yaml
│ ├── NOTES.txt
│ ├── cnp_cluster.yaml
│ ├── _helpers.tpl
│ └── pgbench_job.yaml
├── Chart.yaml
├── README.md
├── values.yaml
└── values.schema.json
├── CONTRIBUTING.md
├── Makefile
├── CODE-OF-CONDUCT.md
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/*
2 |
--------------------------------------------------------------------------------
/images/write_bw.1-2Draw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EnterpriseDB/cnp-bench/HEAD/images/write_bw.1-2Draw.png
--------------------------------------------------------------------------------
/images/cnp-sandbox-transactions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EnterpriseDB/cnp-bench/HEAD/images/cnp-sandbox-transactions.png
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | # The CODEOWNERS file is used to define individuals or teams that are
2 | # responsible for code in a repository. For details, please refer to
3 | # https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners
4 |
5 | * @EnterpriseDB/cloud-native-admins
6 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/fio-benchmark/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/templates/hammerdb_config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: ConfigMap
4 | metadata:
5 | name: {{ include "hammerdb-benchmark.fullname" . }}-conf
6 | namespace: {{ .Release.Namespace }}
7 | labels:
8 | {{- include "hammerdb-benchmark.labels" . | nindent 4 }}
9 | data:
10 | pgschemabuild.tcl:
11 | {{- toYaml .Values.hammerdb.config.pgschemabuild | nindent 6 }}
12 | pgrun.tcl:
13 | {{- toYaml .Values.hammerdb.config.pgrun | nindent 6 }}
14 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/pgbench-benchmark/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *.orig
18 | *~
19 | # Various IDEs
20 | .project
21 | .idea/
22 | *.tmproj
23 | .vscode/
24 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/templates/cnp_pooler.yaml:
--------------------------------------------------------------------------------
1 | {{ if .Values.cnp.pooler.instances }}
2 | apiVersion: postgresql.k8s.enterprisedb.io/v1
3 | kind: Pooler
4 | metadata:
5 | name: pooler-{{ include "cnp-loadbalancer.fullname" . }}
6 | labels:
7 | {{- include "cnp-loadbalancer.labels" . | nindent 4 }}
8 | spec:
9 | cluster:
10 | name: {{ include "cnp-loadbalancer.fullname" . }}
11 | instances: {{ .Values.cnp.pooler.instances }}
12 | type: rw
13 | pgbouncer:
14 | poolMode: {{ .Values.cnp.pooler.pgbouncer.poolMode}}
15 | {{- with .Values.cnp.pooler.pgbouncer.parameters }}
16 | parameters:
17 | {{- toYaml . | nindent 6 }}
18 | {{ end }}
19 | {{ end }}
20 |
--------------------------------------------------------------------------------
/fio-benchmark/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | {{- if .Values.nodeSelector }}
2 | Make sure at least a node has the following labels to be able to schedule the
3 | {{ include "fio-benchmark.fullname" . }} CNP cluster:
4 | {{- toYaml .Values.nodeSelector | nindent 2}}
5 | {{- end }}
6 |
7 | When the {{ include "fio-benchmark.fullname" . }} deployment is ready run
8 |
9 | kubectl port-forward -n {{ .Release.Namespace }} deployment/{{ include "fio-benchmark.fullname" . }} 8000
10 |
11 | and then use a browser and connect to http://localhost:8000/ to get the benchmark data.
12 |
13 | You can then uninstall the chart
14 |
15 | helm uninstall {{ .Release.Name }} -n {{ .Release.Namespace }}
16 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to cnp-bench (Cloud Native PostgreSQL benchmarking)
2 |
3 | Please read the [code of conduct](CODE-OF-CONDUCT.md) first.
4 |
5 | ## How to report a new issue
6 |
7 | Before reporting a new issue, please make sure you have:
8 |
9 | - read the documentation
10 | - checked that a similar issue has not been opened in the past
11 |
12 | ## How to contribute
13 |
14 | You can contribute to cnp-bench by submitting a new pull request.
15 |
16 | Please:
17 |
18 | 1. Open a new issue providing information about the feature you want to add
19 | 2. Fork the project, develop the feature as a branch with the issue ID (e.g. dev/43) and test the code
20 | 3. Submit a pull request
21 |
22 | Thank you.
23 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | {{ if .Values.cnp.nodeSelector -}}
2 | Make sure at least a node has the following labels to be able to schedule the
3 | {{ include "cnp-loadbalancer.fullname" . }} CNP cluster:
4 | {{- toYaml .Values.cnp.nodeSelector | nindent 2}}
5 | {{- end }}
6 |
7 | You can find the password for the `app` user running
8 |
9 | kubectl get secrets -n {{ .Release.Namespace }} {{ include "cnp-loadbalancer.fullname" . }}-app -o jsonpath='{.data.password}' | tr -d '\n' | base64 -d
10 |
11 | and the external IP of the load balancer with
12 |
13 | kubectl get services -n {{ .Release.Namespace }} {{ include "cnp-loadbalancer.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[].ip}'
14 |
15 | To uninstall the chart:
16 |
17 | helm uninstall {{ .Release.Name }} -n {{ .Release.Namespace }}
18 |
--------------------------------------------------------------------------------
/pgbench-benchmark/templates/cnp_pooler.yaml:
--------------------------------------------------------------------------------
1 | {{ if and .Values.cnp.pooler.instances (not .Values.cnp.existingCluster) }}
2 | apiVersion: postgresql.k8s.enterprisedb.io/v1
3 | kind: Pooler
4 | metadata:
5 | name: pooler-{{ include "pgbench-benchmark.fullname" . }}
6 | labels:
7 | {{- include "pgbench-benchmark.labels" . | nindent 4 }}
8 | spec:
9 | cluster:
10 | name: {{ include "pgbench-benchmark.fullname" . }}
11 | instances: {{ .Values.cnp.pooler.instances }}
12 | type: rw
13 | pgbouncer:
14 | poolMode: {{ .Values.cnp.pooler.pgbouncer.poolMode}}
15 | {{- with .Values.cnp.pooler.pgbouncer.parameters }}
16 | parameters:
17 | {{- toYaml . | nindent 6 }}
18 | {{ end }}
19 | template:
20 | spec:
21 | containers: []
22 | {{- with .Values.cnp.pooler.nodeSelector }}
23 | nodeSelector:
24 | {{- toYaml . | nindent 8 }}
25 | {{ end }}
26 | {{ end }}
27 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/templates/cnp_pooler.yaml:
--------------------------------------------------------------------------------
1 | {{ if and .Values.cnp.pooler.instances (not .Values.cnp.existingCluster) }}
2 | apiVersion: postgresql.k8s.enterprisedb.io/v1
3 | kind: Pooler
4 | metadata:
5 | name: pooler-{{ include "hammerdb-benchmark.fullname" . }}
6 | labels:
7 | {{- include "hammerdb-benchmark.labels" . | nindent 4 }}
8 | spec:
9 | cluster:
10 | name: {{ include "hammerdb-benchmark.fullname" . }}
11 | instances: {{ .Values.cnp.pooler.instances }}
12 | type: rw
13 | pgbouncer:
14 | poolMode: {{ .Values.cnp.pooler.pgbouncer.poolMode}}
15 | {{- with .Values.cnp.pooler.pgbouncer.parameters }}
16 | parameters:
17 | {{- toYaml . | nindent 6 }}
18 | {{ end }}
19 | template:
20 | spec:
21 | containers: []
22 | {{- with .Values.cnp.pooler.nodeSelector }}
23 | nodeSelector:
24 | {{- toYaml . | nindent 8 }}
25 | {{ end }}
26 | {{ end }}
27 |
--------------------------------------------------------------------------------
/fio-benchmark/Chart.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: v2
16 | name: fio-benchmark
17 | description: A Helm chart to run customized fio benchmarks
18 | type: application
19 | version: 0.1.0
20 | home: https://github.com/EnterpriseDB/cnp-bench/
21 | sources:
22 | - https://github.com/EnterpriseDB/cnp-bench/
23 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/Chart.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: v2
16 | name: hammerdb-benchmark
17 | description: A Helm chart that starts a CNP Cluster and executes a
18 | HammerDB job on it.
19 | type: application
20 | version: 0.3.0
21 | home: https://github.com/EnterpriseDB/cnp-bench/
22 | sources:
23 | - https://github.com/EnterpriseDB/cnp-bench/
24 |
--------------------------------------------------------------------------------
/pgbench-benchmark/Chart.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: v2
16 | name: pgbench-benchmark
17 | description: A Helm chart that starts a CNP Cluster and executes a
18 | PgBench job on it.
19 | type: application
20 | version: 0.3.0
21 | home: https://github.com/EnterpriseDB/cnp-bench/
22 | sources:
23 | - https://github.com/EnterpriseDB/cnp-bench/
24 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/Chart.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: v2
16 | name: cnp-loadbalancer
17 | description: Create a CNP cluster and expose it using a LoadBalancer. Used to
18 | test CNP from an external application.
19 | type: application
20 | version: 0.3.0
21 | home: https://github.com/EnterpriseDB/cnp-bench/
22 | sources:
23 | - https://github.com/EnterpriseDB/cnp-bench/
24 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .DEFAULT_GOAL := help
2 |
3 | # Credits: https://gist.github.com/prwhite/8168133
4 | .PHONY: help
5 | help: ## Prints help command output
6 | @awk 'BEGIN {FS = ":.*##"; printf "\ncnp-bench CLI\nUsage:\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-30s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
7 |
8 | .PHONY: generate-schemas
9 | generate-schema: ## Updates the auto-generated charts values.schema.json
10 | @helm schema-gen pgbench-benchmark/values.yaml > pgbench-benchmark/values.schema.json || \
11 | (echo "Please, run: helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git" && exit 1)
12 | @helm schema-gen fio-benchmark/values.yaml > fio-benchmark/values.schema.json
13 | @helm schema-gen cnp-loadbalancer/values.yaml > cnp-loadbalancer/values.schema.json
14 | @echo "Validation schemas generated"
15 |
16 | .PHONY: generate-docs
17 | generate-docs: ## Updates the auto-generated charts README.md
18 | @helm-docs || (echo "Please, install https://github.com/norwoodj/helm-docs first" && exit 1)
19 |
--------------------------------------------------------------------------------
/fio-benchmark/templates/fio_pvc.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | kind: PersistentVolumeClaim
16 | apiVersion: v1
17 | metadata:
18 | name: {{ include "fio-benchmark.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "fio-benchmark.labels" . | nindent 4 }}
22 | spec:
23 | {{- with .Values.pvcStorageClassName }}
24 | storageClassName: {{ . }}
25 | {{- end }}
26 | accessModes:
27 | - ReadWriteOnce
28 | resources:
29 | requests:
30 | storage: {{ .Values.pvcSize }}
31 |
--------------------------------------------------------------------------------
/fio-benchmark/values.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/schema#",
3 | "type": "object",
4 | "properties": {
5 | "jobBs": {
6 | "type": "string"
7 | },
8 | "jobDirect": {
9 | "type": "integer"
10 | },
11 | "jobEndFsync": {
12 | "type": "integer"
13 | },
14 | "jobIodepth": {
15 | "type": "integer"
16 | },
17 | "jobIoengine": {
18 | "type": "string"
19 | },
20 | "jobLogAvgMsec": {
21 | "type": "integer"
22 | },
23 | "jobRW": {
24 | "type": "string"
25 | },
26 | "jobRuntime": {
27 | "type": "integer"
28 | },
29 | "jobSize": {
30 | "type": "string"
31 | },
32 | "jobTimeBased": {
33 | "type": "integer"
34 | },
35 | "nodeSelector": {
36 | "type": "object"
37 | },
38 | "pvcSize": {
39 | "type": "string"
40 | },
41 | "pvcStorageClassName": {
42 | "type": "string"
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/templates/cnp_loadbalancer.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: v1
16 | kind: Service
17 | metadata:
18 | name: {{ include "cnp-loadbalancer.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "cnp-loadbalancer.labels" . | nindent 4 }}
22 | spec:
23 | ports:
24 | - name: postgres
25 | port: 5432
26 | protocol: TCP
27 | targetPort: 5432
28 | selector:
29 | {{- include "cnp-loadbalancer.serviceSelectors" . | nindent 4 }}
30 | sessionAffinity: None
31 | type: LoadBalancer
32 |
--------------------------------------------------------------------------------
/pgbench-benchmark/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | {{ if .Values.cnp.nodeSelector -}}
2 | Make sure at least a node has the following labels to be able to schedule the
3 | {{ include "pgbench-benchmark.fullname" . }} CNP cluster:
4 | {{- toYaml .Values.cnp.nodeSelector | nindent 2}}
5 | {{- end }}
6 |
7 | {{ if .Values.pgbench.nodeSelector -}}
8 | Make sure at least a node has the following labels to be able to schedule the
9 | {{ include "pgbench-benchmark.fullname" . }} job running pgbench:
10 | {{- toYaml .Values.pgbench.nodeSelector | nindent 2}}
11 | {{- end }}
12 |
13 | {{ if .Values.cnp.pooler.instances -}}
14 | The benchmark is being run with connection pooling.
15 | Make sure at least a node has the following labels to be able to schedule the
16 | pooler-{{ include "pgbench-benchmark.fullname" . }} pooler:
17 | {{- toYaml .Values.cnp.pooler.nodeSelector | nindent 2}}
18 | {{ end }}
19 |
20 | After the {{ include "pgbench-benchmark.fullname" . }} job completes run
21 |
22 | kubectl logs -n {{ .Release.Namespace }} job/{{ include "pgbench-benchmark.fullname" . }}
23 |
24 | to gather the pgbench results. You can then uninstall the chart
25 |
26 | helm uninstall {{ .Release.Name }} -n {{ .Release.Namespace }}
27 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | {{ if .Values.cnp.nodeSelector -}}
2 | Make sure at least a node has the following labels to be able to schedule the
3 | {{ include "hammerdb-benchmark.fullname" . }} CNP cluster:
4 | {{- toYaml .Values.cnp.nodeSelector | nindent 2}}
5 | {{- end }}
6 |
7 | {{ if .Values.hammerdb.nodeSelector -}}
8 | Make sure at least a node has the following labels to be able to schedule the
9 | {{ include "hammerdb-benchmark.fullname" . }} job running hammerdb:
10 | {{- toYaml .Values.hammerdb.nodeSelector | nindent 2}}
11 | {{- end }}
12 |
13 | {{ if .Values.cnp.pooler.instances -}}
14 | The benchmark is being run with connection pooling.
15 | Make sure at least a node has the following labels to be able to schedule the
16 | pooler-{{ include "hammerdb-benchmark.fullname" . }} pooler:
17 | {{- toYaml .Values.cnp.pooler.nodeSelector | nindent 2}}
18 | {{ end }}
19 |
20 | After the {{ include "hammerdb-benchmark.fullname" . }} job completes run
21 |
22 | kubectl logs -n {{ .Release.Namespace }} job/{{ include "hammerdb-benchmark.fullname" . }}
23 |
24 | to gather the hammerdb results. You can then uninstall the chart
25 |
26 | helm uninstall {{ .Release.Name }} -n {{ .Release.Namespace }}
27 |
--------------------------------------------------------------------------------
/fio-benchmark/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/*
2 | Expand the name of the chart.
3 | */}}
4 | {{- define "fio-benchmark.name" -}}
5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6 | {{- end }}
7 |
8 | {{/*
9 | Create a default fully qualified app name.
10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11 | If release name contains chart name it will be used as a full name.
12 | */}}
13 | {{- define "fio-benchmark.fullname" -}}
14 | {{- if .Values.fullnameOverride }}
15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16 | {{- else }}
17 | {{- $name := default .Chart.Name .Values.nameOverride }}
18 | {{- if contains $name .Release.Name }}
19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20 | {{- else }}
21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22 | {{- end }}
23 | {{- end }}
24 | {{- end }}
25 |
26 | {{/*
27 | Create chart name and version as used by the chart label.
28 | */}}
29 | {{- define "fio-benchmark.chart" -}}
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31 | {{- end }}
32 |
33 | {{/*
34 | Common labels
35 | */}}
36 | {{- define "fio-benchmark.labels" -}}
37 | helm.sh/chart: {{ include "fio-benchmark.chart" . }}
38 | {{- if .Chart.AppVersion }}
39 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
40 | {{- end }}
41 | app.kubernetes.io/managed-by: {{ .Release.Service }}
42 | {{- end }}
43 |
--------------------------------------------------------------------------------
/fio-benchmark/templates/fio_job_configmap.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: v1
16 | kind: ConfigMap
17 | metadata:
18 | name: {{ include "fio-benchmark.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "fio-benchmark.labels" . | nindent 4 }}
22 | data:
23 | job: |
24 | [{{ .Values.jobRW }}]
25 | direct={{ .Values.jobDirect }}
26 | bs={{ .Values.jobBs }}
27 | size={{ .Values.jobSize }}
28 | time_based={{ .Values.jobTimeBased }}
29 | runtime={{ .Values.jobRuntime }}
30 | ioengine={{ .Values.jobIoengine }}
31 | iodepth={{ .Values.jobIodepth }}
32 | end_fsync={{ .Values.jobEndFsync }}
33 | log_avg_msec={{ .Values.jobLogAvgMsec }}
34 | directory=/data
35 | rw={{ .Values.jobRW }}
36 | write_bw_log={{ .Values.jobRW }}
37 | write_lat_log={{ .Values.jobRW }}
38 | write_iops_log={{ .Values.jobRW }}
39 |
--------------------------------------------------------------------------------
/fio-benchmark/values.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | # pvcStorageClassName -- The storage class to use to create the PVC to test.
16 | pvcStorageClassName: ""
17 | # pvcSize -- The size of the PVC to be test.
18 | pvcSize: 2Gi
19 | # nodeSelector -- A key/value dictionary used to schedule the benchmark on
20 | # defined nodes.
21 | nodeSelector: {}
22 | # jobRW -- See fio rw parameter.
23 | jobRW: read
24 | # jobBs -- See fio bs parameter.
25 | jobBs: 8k
26 | # jobRuntime -- See fio runtime parameter.
27 | jobRuntime: 60
28 | # jobTimeBased -- See fio time_based parameter.
29 | jobTimeBased: 1
30 | # jobSize -- See fio size parameter.
31 | jobSize: 1G
32 | # jobIodepth -- See fio iodepth parameter.
33 | jobIodepth: 32
34 | # jobDirect -- See fio direct parameter.
35 | jobDirect: 1
36 | # jobIoengine -- See fio ioengine parameter.
37 | jobIoengine: libaio
38 | # jobEndFsync -- See fio end_fsync parameter.
39 | jobEndFsync: 1
40 | # jobLogAvgMsec -- See fio log_avg_msec parameter.
41 | jobLogAvgMsec: 1000
42 |
--------------------------------------------------------------------------------
/fio-benchmark/README.md:
--------------------------------------------------------------------------------
1 | # fio-benchmark
2 |
3 |  
4 |
5 | A Helm chart to run customized fio benchmarks
6 |
7 | **Homepage:**
8 |
9 | ## Source Code
10 |
11 | *
12 |
13 | ## Values
14 |
15 | | Key | Type | Default | Description |
16 | |-----|------|---------|-------------|
17 | | jobBs | string | `"8k"` | See fio bs parameter. |
18 | | jobDirect | int | `1` | See fio direct parameter. |
19 | | jobEndFsync | int | `1` | See fio end_fsync parameter. |
20 | | jobIodepth | int | `32` | See fio iodepth parameter. |
21 | | jobIoengine | string | `"libaio"` | See fio ioengine parameter. |
22 | | jobLogAvgMsec | int | `1000` | See fio log_avg_msec parameter. |
23 | | jobRW | string | `"read"` | See fio rw parameter. |
24 | | jobRuntime | int | `60` | See fio runtime parameter. |
25 | | jobSize | string | `"1G"` | See fio size parameter. |
26 | | jobTimeBased | int | `1` | See fio time_based parameter. |
27 | | nodeSelector | object | `{}` | A key/value dictionary used to schedule the benchmark on defined nodes. |
28 | | pvcSize | string | `"2Gi"` | The size of the PVC to be test. |
29 | | pvcStorageClassName | string | `""` | The storage class to use to create the PVC to test. |
30 |
31 | ----------------------------------------------
32 | Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
33 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/*
2 | Expand the name of the chart.
3 | */}}
4 | {{- define "cnp-loadbalancer.name" -}}
5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6 | {{- end }}
7 |
8 | {{/*
9 | Create a default fully qualified app name.
10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11 | If release name contains chart name it will be used as a full name.
12 | */}}
13 | {{- define "cnp-loadbalancer.fullname" -}}
14 | {{- if .Values.fullnameOverride }}
15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16 | {{- else }}
17 | {{- $name := default .Chart.Name .Values.nameOverride }}
18 | {{- if contains $name .Release.Name }}
19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20 | {{- else }}
21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22 | {{- end }}
23 | {{- end }}
24 | {{- end }}
25 |
26 | {{/*
27 | Create chart name and version as used by the chart label.
28 | */}}
29 | {{- define "cnp-loadbalancer.chart" -}}
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31 | {{- end }}
32 |
33 | {{/*
34 | Common labels
35 | */}}
36 | {{- define "cnp-loadbalancer.labels" -}}
37 | helm.sh/chart: {{ include "cnp-loadbalancer.chart" . }}
38 | {{- if .Chart.AppVersion }}
39 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
40 | {{- end }}
41 | app.kubernetes.io/managed-by: {{ .Release.Service }}
42 | {{- end }}
43 |
44 | {{/*
45 | Service that we should connect to
46 | */}}
47 | {{- define "cnp-loadbalancer.serviceSelectors" -}}
48 | {{- if .Values.cnpPoolerInstances -}}
49 | k8s.enterprisedb.io/poolerName: pooler-{{ include "cnp-loadbalancer.fullname" . }}
50 | {{- else -}}
51 | postgresql: {{ include "cnp-loadbalancer.fullname" . }}
52 | role: primary
53 | {{- end -}}
54 | {{- end}}
55 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/templates/cnp_cluster.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: postgresql.k8s.enterprisedb.io/v1
16 | kind: Cluster
17 | metadata:
18 | name: {{ include "cnp-loadbalancer.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "cnp-loadbalancer.labels" . | nindent 4 }}
22 | spec:
23 | instances: {{ .Values.cnp.instances}}
24 | {{ if or .Values.cnp.monitoring.customQueriesConfigMap .Values.cnp.monitoring.customQueriesSecret }}
25 |
26 | monitoring:
27 | customQueriesConfigMap:
28 | {{- range .Values.cnp.monitoring.customQueriesConfigMap }}
29 | - key: {{ .key }}
30 | name: {{ .name }}
31 | {{- end }}
32 |
33 | customQueriesSecret:
34 | {{- range .Values.cnp.monitoring.customQueriesSecret }}
35 | - key: {{ .key }}
36 | name: {{ .name }}
37 | {{- end }}
38 |
39 | {{ end }}
40 |
41 | postgresql:
42 | {{- with .Values.cnp.postgreSQLParameters }}
43 | parameters:
44 | {{- toYaml . | nindent 6 }}
45 | {{- end }}
46 | affinity:
47 | {{- with .Values.cnp.nodeSelector }}
48 | nodeSelector:
49 | {{- toYaml . | nindent 6 }}
50 | {{- end }}
51 | storage:
52 | {{- with .Values.cnp.storage.storageClass }}
53 | storageClass: {{ . }}
54 | {{- end }}
55 | size: {{ .Values.cnp.storage.size }}
56 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/templates/cnp_cluster.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | {{ if not .Values.cnp.existingCluster }}
16 | apiVersion: postgresql.k8s.enterprisedb.io/v1
17 | kind: Cluster
18 | metadata:
19 | name: {{ include "hammerdb-benchmark.fullname" . }}
20 | namespace: {{ .Release.Namespace }}
21 | labels:
22 | {{- include "hammerdb-benchmark.labels" . | nindent 4 }}
23 | spec:
24 | instances: {{ .Values.cnp.instances }}
25 | {{- if or .Values.cnp.monitoring.customQueriesConfigMap .Values.cnp.monitoring.customQueriesSecret }}
26 | monitoring:
27 | customQueriesConfigMap:
28 | {{- range .Values.cnp.monitoring.customQueriesConfigMap }}
29 | - key: {{ .key }}
30 | name: {{ .name }}
31 | {{- end }}
32 | customQueriesSecret:
33 | {{- range .Values.cnp.monitoring.customQueriesSecret }}
34 | - key: {{ .key }}
35 | name: {{ .name }}
36 | {{- end }}
37 | {{- end }}
38 | postgresql:
39 | {{- with .Values.cnp.postgreSQLParameters }}
40 | parameters:
41 | {{- toYaml . | nindent 6 }}
42 | {{- end }}
43 | affinity:
44 | {{- with .Values.cnp.nodeSelector }}
45 | nodeSelector:
46 | {{- toYaml . | nindent 6 }}
47 | {{- end }}
48 | storage:
49 | {{- with .Values.cnp.storage.storageClass }}
50 | storageClass: {{ . }}
51 | {{- end }}
52 | size: {{ .Values.cnp.storage.size }}
53 | {{- end }}
54 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/README.md:
--------------------------------------------------------------------------------
1 | # cnp-loadbalancer
2 |
3 |  
4 |
5 | Create a CNP cluster and expose it using a LoadBalancer. Used to test CNP from an external application.
6 |
7 | **Homepage:**
8 |
9 | ## Source Code
10 |
11 | *
12 |
13 | ## Values
14 |
15 | | Key | Type | Default | Description |
16 | |-----|------|---------|-------------|
17 | | cnp.image | string | `"quay.io/enterprisedb/postgresql:13.2"` | |
18 | | cnp.instances | int | `1` | The amount of PostgreSQL instances in the CNP Cluster. |
19 | | cnp.monitoring.customQueriesConfigMap | list | `[]` | |
20 | | cnp.monitoring.customQueriesSecret | list | `[]` | |
21 | | cnp.nodeSelector.workload | string | `"postgres"` | |
22 | | cnp.pooler.instances | int | `0` | The number of pooler replicas that receive the connections. If >0 the benchmarks are run with connection pooling |
23 | | cnp.pooler.pgbouncer.parameters | object | `{}` | PgBouncer configuration. |
24 | | cnp.pooler.pgbouncer.poolMode | string | `"session"` | The pool mode, accepted values: session, transaction |
25 | | cnp.postgreSQLParameters | object | `{"log_autovacuum_min_duration":"1s","log_checkpoints":"on","log_lock_waits":"on","log_min_duration_statement":"1000","log_statement":"ddl","log_temp_files":"1024","maintenance_work_mem":"128MB","shared_buffers":"512MB"}` | Dictionary of key-value pairs representing PostgreSQL configuration. |
26 | | cnp.storage.size | string | `"1Gi"` | The size of the PVCs used by CNP instances. |
27 | | cnp.storage.storageClass | string | `""` | The storage class used to create PVCs for CNP instances. |
28 |
29 | ----------------------------------------------
30 | Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
31 |
--------------------------------------------------------------------------------
/pgbench-benchmark/templates/cnp_cluster.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | {{ if not .Values.cnp.existingCluster }}
16 | apiVersion: postgresql.k8s.enterprisedb.io/v1
17 | kind: Cluster
18 | metadata:
19 | name: {{ include "pgbench-benchmark.fullname" . }}
20 | namespace: {{ .Release.Namespace }}
21 | labels:
22 | {{- include "pgbench-benchmark.labels" . | nindent 4 }}
23 | spec:
24 | instances: {{ .Values.cnp.instances }}
25 |
26 | {{ if or .Values.cnp.monitoring.customQueriesConfigMap .Values.cnp.monitoring.customQueriesSecret }}
27 |
28 | monitoring:
29 | customQueriesConfigMap:
30 | {{- range .Values.cnp.monitoring.customQueriesConfigMap }}
31 | - key: {{ .key }}
32 | name: {{ .name }}
33 | {{- end }}
34 |
35 | customQueriesSecret:
36 | {{- range .Values.cnp.monitoring.customQueriesSecret }}
37 | - key: {{ .key }}
38 | name: {{ .name }}
39 | {{- end }}
40 |
41 | {{ end }}
42 |
43 | postgresql:
44 | {{- with .Values.cnp.postgreSQLParameters }}
45 | parameters:
46 | {{- toYaml . | nindent 6 }}
47 | {{- end }}
48 | affinity:
49 | {{- with .Values.cnp.nodeSelector }}
50 | nodeSelector:
51 | {{- toYaml . | nindent 6 }}
52 | {{- end }}
53 | storage:
54 | {{- with .Values.cnp.storage.storageClass }}
55 | storageClass: {{ . }}
56 | {{- end }}
57 | size: {{ .Values.cnp.storage.size }}
58 | {{- end }}
59 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/values.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | cnp:
16 | # -- The amount of PostgreSQL instances in the CNP Cluster.
17 | instances: 1
18 | storage:
19 | # -- The storage class used to create PVCs for CNP instances.
20 | storageClass: ""
21 | # -- The size of the PVCs used by CNP instances.
22 | size: 1Gi
23 | # -- The PostgreSQL image used by CNP and PgBench.
24 | image: quay.io/enterprisedb/postgresql:13.2
25 | # ndeSelector -- Dictionary of key-value pairs used to define the nodes
26 | # where the cluster instances can run; used to avoid pgbench and PostgreSQL
27 | # running on the same node.
28 | nodeSelector:
29 | workload: postgres
30 | # cnpMonitoring -- Configures custom queries for monitoring.
31 | # The arrays accept a Dictionary made by name: string (resource name), key: string (resource data field containing the queries).
32 | # Documentation on the accepted values: https://docs.enterprisedb.io/cloud-native-postgresql/latest/monitoring/
33 | monitoring:
34 | customQueriesConfigMap: []
35 | customQueriesSecret: []
36 | # -- Dictionary of key-value pairs representing
37 | # PostgreSQL configuration.
38 | postgreSQLParameters:
39 | shared_buffers: '512MB'
40 | maintenance_work_mem: '128MB'
41 | log_checkpoints: "on"
42 | log_lock_waits: "on"
43 | log_min_duration_statement: '1000'
44 | log_statement: 'ddl'
45 | log_temp_files: '1024'
46 | log_autovacuum_min_duration: '1s'
47 |
48 | # Configuration of the pooler
49 | pooler:
50 | # -- The number of pooler replicas that receive the connections.
51 | # If >0 the benchmarks are run with connection pooling
52 | instances: 0
53 | pgbouncer:
54 | # -- The pool mode, accepted values: session, transaction
55 | poolMode: session
56 | # -- PgBouncer configuration.
57 | parameters: {}
58 |
--------------------------------------------------------------------------------
/fio-benchmark/templates/fio_deployment.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: apps/v1
16 | kind: Deployment
17 | metadata:
18 | name: {{ include "fio-benchmark.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "fio-benchmark.labels" . | nindent 4 }}
22 | spec:
23 | replicas: 1
24 | selector:
25 | matchLabels:
26 | app.kubernetes.io/name: fio
27 | app.kubernetes.io/instance: {{ .Release.Name }}
28 | template:
29 | metadata:
30 | labels:
31 | app.kubernetes.io/name: fio
32 | app.kubernetes.io/instance: {{ .Release.Name }}
33 | spec:
34 | containers:
35 | - name: fio
36 | image: wallnerryan/fiotools-aio
37 | ports:
38 | - containerPort: 8000
39 | volumeMounts:
40 | - name: data
41 | mountPath: /data
42 | - name: job
43 | mountPath: /jobs
44 | env:
45 | - name: JOBFILES
46 | value: /jobs/job.fio
47 | - name: PLOTNAME
48 | value: job
49 | readinessProbe:
50 | tcpSocket:
51 | port: 8000
52 | initialDelaySeconds: 60
53 | periodSeconds: 10
54 | # Don't run the a pod on a node that is running another fio benchmark
55 | affinity:
56 | podAntiAffinity:
57 | requiredDuringSchedulingIgnoredDuringExecution:
58 | - topologyKey: "kubernetes.io/hostname"
59 | labelSelector:
60 | matchExpressions:
61 | - key: app
62 | operator: In
63 | values:
64 | - fio
65 | {{- with .Values.nodeSelector }}
66 | nodeSelector:
67 | {{- toYaml . | nindent 8 }}
68 | {{- end }}
69 | volumes:
70 | - name: data
71 | persistentVolumeClaim:
72 | claimName: {{ include "fio-benchmark.fullname" . }}
73 | - name: job
74 | configMap:
75 | name: {{ include "fio-benchmark.fullname" . }}
76 | items:
77 | - key: job
78 | path: job.fio
79 |
--------------------------------------------------------------------------------
/pgbench-benchmark/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/*
2 | Expand the name of the chart.
3 | */}}
4 | {{- define "pgbench-benchmark.name" -}}
5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6 | {{- end }}
7 |
8 | {{/*
9 | Create a default fully qualified app name.
10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11 | If release name contains chart name it will be used as a full name.
12 | */}}
13 | {{- define "pgbench-benchmark.fullname" -}}
14 | {{- if .Values.fullnameOverride }}
15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16 | {{- else }}
17 | {{- $name := default .Chart.Name .Values.nameOverride }}
18 | {{- if contains $name .Release.Name }}
19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20 | {{- else }}
21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22 | {{- end }}
23 | {{- end }}
24 | {{- end }}
25 |
26 | {{/*
27 | Create chart name and version as used by the chart label.
28 | */}}
29 | {{- define "pgbench-benchmark.chart" -}}
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31 | {{- end }}
32 |
33 | {{/*
34 | Common labels
35 | */}}
36 | {{- define "pgbench-benchmark.labels" -}}
37 | helm.sh/chart: {{ include "pgbench-benchmark.chart" . }}
38 | {{- if .Chart.AppVersion }}
39 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
40 | {{- end }}
41 | app.kubernetes.io/managed-by: {{ .Release.Service }}
42 | {{- end }}
43 |
44 | {{/*
45 | Service that we should connect to
46 | */}}
47 | {{- define "pgbench-benchmark.service" -}}
48 | {{- if .Values.cnp.pooler.instances -}}
49 | pooler-{{ include "pgbench-benchmark.fullname" . }}
50 | {{- else -}}
51 | {{ include "pgbench-benchmark.fullname" . }}-rw
52 | {{- end -}}
53 | {{- end}}
54 |
55 | {{- define "pgbench-benchmark.credentials" -}}
56 | {{- if not .Values.cnp.existingCluster }}
57 | - name: PGHOST
58 | value: {{ include "pgbench-benchmark.service" . }}
59 | - name: PGUSER
60 | valueFrom:
61 | secretKeyRef:
62 | name: {{ include "pgbench-benchmark.fullname" . }}-app
63 | key: username
64 | - name: PGPASSWORD
65 | valueFrom:
66 | secretKeyRef:
67 | name: {{ include "pgbench-benchmark.fullname" . }}-app
68 | key: password
69 | {{- else -}}
70 | - name: PGHOST
71 | value: {{ .Values.cnp.existingHost }}
72 | - name: PGDATABASE
73 | value: {{ .Values.cnp.existingDatabase }}
74 | - name: PGPORT
75 | value: {{ .Values.cnp.existingPort }}
76 | - name: PGUSER
77 | valueFrom:
78 | secretKeyRef:
79 | name: {{ .Values.cnp.existingCredentials }}
80 | key: username
81 | - name: PGPASSWORD
82 | valueFrom:
83 | secretKeyRef:
84 | name: {{ .Values.cnp.existingCredentials }}
85 | key: password
86 | {{- end -}}
87 | {{- end }}
88 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/templates/hammerdb_job.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: batch/v1
16 | kind: Job
17 | metadata:
18 | name: {{ include "hammerdb-benchmark.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "hammerdb-benchmark.labels" . | nindent 4 }}
22 | spec:
23 | template:
24 | spec:
25 | initContainers:
26 | - name: wait-for-cnp
27 | image: {{ .Values.cnp.image }}
28 | env:
29 | {{- include "hammerdb-benchmark.credentials" . | nindent 10 }}
30 | command:
31 | - sh
32 | - -c
33 | - until psql -c "SELECT 1"; do echo 'Waiting for {{ include "hammerdb-benchmark.service" . }}' sleep 15; done
34 | {{- if .Values.hammerdb.config.initialize }}
35 | - name: hammerdb-pgschemabuild
36 | image: {{ .Values.hammerdb.image }}
37 | env:
38 | {{- include "hammerdb-benchmark.credentials" . | nindent 10 }}
39 | command:
40 | - ./hammerdbcli
41 | args:
42 | - auto
43 | - /hammerdb/pgschemabuild.tcl
44 | volumeMounts:
45 | - name: config-volume
46 | mountPath: /hammerdb
47 | {{- end }}
48 | {{- if .Values.hammerdb.config.pg_prewarm }}
49 | - name: prewarm
50 | image: {{ .Values.cnp.image }}
51 | env:
52 | {{- include "hammerdb-benchmark.credentials" . | nindent 10 }}
53 | command:
54 | - sh
55 | - -c
56 | - psql tpcc -c "CREATE EXTENSION IF NOT EXISTS pg_prewarm;SELECT pg_prewarm('history');SELECT pg_prewarm('orders');SELECT pg_prewarm('customer');SELECT pg_prewarm('stock');"
57 | {{- end }}
58 | containers:
59 | - name: hammerdb
60 | image: {{ .Values.hammerdb.image }}
61 | env:
62 | {{- include "hammerdb-benchmark.credentials" . | nindent 10 }}
63 | command:
64 | - sh
65 | - -c
66 | - ./hammerdbcli auto /hammerdb/pgrun.tcl 2>&1 | stdbuf -oL -eL sed -e "s,\x1B\[[0-9;]*[a-zA-Z],,g" -e "s,\r,,g" -e "s,hammerdb>,,g" -e "s,after\#[0-9]*,,g"
67 | volumeMounts:
68 | - name: config-volume
69 | mountPath: /hammerdb
70 | restartPolicy: Never
71 | {{- with .Values.hammerdb.nodeSelector }}
72 | nodeSelector:
73 | {{- toYaml . | nindent 8 }}
74 | {{- end }}
75 | volumes:
76 | - name: config-volume
77 | configMap:
78 | name: {{ include "hammerdb-benchmark.fullname" . }}-conf
79 |
--------------------------------------------------------------------------------
/pgbench-benchmark/templates/pgbench_job.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 | apiVersion: batch/v1
16 | kind: Job
17 | metadata:
18 | name: {{ include "pgbench-benchmark.fullname" . }}
19 | namespace: {{ .Release.Namespace }}
20 | labels:
21 | {{- include "pgbench-benchmark.labels" . | nindent 4 }}
22 | spec:
23 | template:
24 | spec:
25 | initContainers:
26 | - name: wait-for-cnp
27 | image: {{ .Values.cnp.image }}
28 | env:
29 | {{- include "pgbench-benchmark.credentials" . | nindent 10 }}
30 | command:
31 | - sh
32 | - -c
33 | - until psql -c "SELECT 1"; do echo 'Waiting for {{ include "pgbench-benchmark.service" . }}' sleep 15; done
34 | {{ if or (not .Values.cnp.existingCluster) (.Values.pgbench.initialize) }}
35 | - name: pgbench-init
36 | image: {{ .Values.cnp.image }}
37 | env:
38 | {{- include "pgbench-benchmark.credentials" . | nindent 10 }}
39 | command:
40 | - pgbench
41 | args:
42 | - --initialize
43 | - --scale
44 | - {{ .Values.pgbench.scaleFactor | quote }}
45 | {{- end }}
46 | {{- if and ( .Values.pgbench.warmTime ) ( ne ( .Values.pgbench.warmTime | quote ) "0" )}}
47 | - name: pgbench-warm
48 | image: {{ .Values.cnp.image }}
49 | env:
50 | {{- include "pgbench-benchmark.credentials" . | nindent 10 }}
51 | command:
52 | - pgbench
53 | args:
54 | - --time
55 | - {{ .Values.pgbench.warmTime | quote }}
56 | - --client
57 | - {{ .Values.pgbench.clients | quote }}
58 | - --jobs
59 | - {{ .Values.pgbench.jobs | quote }}
60 | {{ if (.Values.pgbench.skipVacuum) }}
61 | - --no-vacuum
62 | {{- end }}
63 | {{ if (.Values.pgbench.reportLatencies) }}
64 | - --report-latencies
65 | {{- end }}
66 | {{- end }}
67 | containers:
68 | - name: pgbench
69 | image: {{ .Values.cnp.image }}
70 | env:
71 | {{- include "pgbench-benchmark.credentials" . | nindent 10 }}
72 | command:
73 | - pgbench
74 | args:
75 | - --time
76 | - {{ .Values.pgbench.time | quote }}
77 | - --client
78 | - {{ .Values.pgbench.clients | quote }}
79 | - --jobs
80 | - {{ .Values.pgbench.jobs | quote }}
81 | {{ if (.Values.pgbench.skipVacuum) }}
82 | - --no-vacuum
83 | {{- end }}
84 | {{ if (.Values.pgbench.reportLatencies) }}
85 | - --report-latencies
86 | {{- end }}
87 | restartPolicy: Never
88 | {{- with .Values.pgbench.nodeSelector }}
89 | nodeSelector:
90 | {{- toYaml . | nindent 8 }}
91 | {{- end }}
92 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/*
2 | Expand the name of the chart.
3 | */}}
4 | {{- define "hammerdb-benchmark.name" -}}
5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6 | {{- end }}
7 |
8 | {{/*
9 | Create a default fully qualified app name.
10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11 | If release name contains chart name it will be used as a full name.
12 | */}}
13 | {{- define "hammerdb-benchmark.fullname" -}}
14 | {{- if .Values.fullnameOverride }}
15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16 | {{- else }}
17 | {{- $name := default .Chart.Name .Values.nameOverride }}
18 | {{- if contains $name .Release.Name }}
19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20 | {{- else }}
21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22 | {{- end }}
23 | {{- end }}
24 | {{- end }}
25 |
26 | {{/*
27 | Create chart name and version as used by the chart label.
28 | */}}
29 | {{- define "hammerdb-benchmark.chart" -}}
30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31 | {{- end }}
32 |
33 | {{/*
34 | Common labels
35 | */}}
36 | {{- define "hammerdb-benchmark.labels" -}}
37 | helm.sh/chart: {{ include "hammerdb-benchmark.chart" . }}
38 | {{- if .Chart.AppVersion }}
39 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
40 | {{- end }}
41 | app.kubernetes.io/managed-by: {{ .Release.Service }}
42 | {{- end }}
43 |
44 | {{/*
45 | Service that we should connect to
46 | */}}
47 | {{- define "hammerdb-benchmark.service" -}}
48 | {{- if .Values.cnp.pooler.instances -}}
49 | pooler-{{ include "hammerdb-benchmark.fullname" . }}
50 | {{- else -}}
51 | {{ include "hammerdb-benchmark.fullname" . }}-rw
52 | {{- end -}}
53 | {{- end}}
54 |
55 | {{- define "hammerdb-benchmark.credentials" -}}
56 | {{- if not .Values.cnp.existingCluster }}
57 | - name: PGHOST
58 | value: {{ include "hammerdb-benchmark.service" . }}
59 | - name: PGUSER
60 | valueFrom:
61 | secretKeyRef:
62 | name: {{ include "hammerdb-benchmark.fullname" . }}-superuser
63 | key: username
64 | - name: PGPASSWORD
65 | valueFrom:
66 | secretKeyRef:
67 | name: {{ include "hammerdb-benchmark.fullname" . }}-superuser
68 | key: password
69 | - name: PGSUPERUSER
70 | valueFrom:
71 | secretKeyRef:
72 | name: {{ include "hammerdb-benchmark.fullname" . }}-superuser
73 | key: username
74 | - name: PGSUPERUSERPASS
75 | valueFrom:
76 | secretKeyRef:
77 | name: {{ include "hammerdb-benchmark.fullname" . }}-superuser
78 | key: password
79 | {{- else -}}
80 | - name: PGHOST
81 | value: {{ .Values.cnp.existingHost }}
82 | - name: PGUSER
83 | valueFrom:
84 | secretKeyRef:
85 | name: {{ .Values.cnp.existingSuperuserCredentials }}
86 | key: username
87 | - name: PGPASSWORD
88 | valueFrom:
89 | secretKeyRef:
90 | name: {{ .Values.cnp.existingSuperuserCredentials }}
91 | key: password
92 | - name: PGSUPERUSER
93 | valueFrom:
94 | secretKeyRef:
95 | name: {{ .Values.cnp.existingSuperuserCredentials }}
96 | key: username
97 | - name: PGSUPERUSERPASS
98 | valueFrom:
99 | secretKeyRef:
100 | name: {{ .Values.cnp.existingSuperuserCredentials }}
101 | key: password
102 | {{- end -}}
103 | {{- end }}
104 |
--------------------------------------------------------------------------------
/cnp-loadbalancer/values.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/schema#",
3 | "type": "object",
4 | "properties": {
5 | "cnp": {
6 | "type": "object",
7 | "properties": {
8 | "image": {
9 | "type": "string"
10 | },
11 | "instances": {
12 | "type": "integer"
13 | },
14 | "monitoring": {
15 | "type": "object",
16 | "properties": {
17 | "customQueriesConfigMap": {
18 | "type": "array"
19 | },
20 | "customQueriesSecret": {
21 | "type": "array"
22 | }
23 | }
24 | },
25 | "nodeSelector": {
26 | "type": "object",
27 | "properties": {
28 | "workload": {
29 | "type": "string"
30 | }
31 | }
32 | },
33 | "pooler": {
34 | "type": "object",
35 | "properties": {
36 | "instances": {
37 | "type": "integer"
38 | },
39 | "pgbouncer": {
40 | "type": "object",
41 | "properties": {
42 | "parameters": {
43 | "type": "object"
44 | },
45 | "poolMode": {
46 | "type": "string"
47 | }
48 | }
49 | }
50 | }
51 | },
52 | "postgreSQLParameters": {
53 | "type": "object",
54 | "properties": {
55 | "log_autovacuum_min_duration": {
56 | "type": "string"
57 | },
58 | "log_checkpoints": {
59 | "type": "string"
60 | },
61 | "log_lock_waits": {
62 | "type": "string"
63 | },
64 | "log_min_duration_statement": {
65 | "type": "string"
66 | },
67 | "log_statement": {
68 | "type": "string"
69 | },
70 | "log_temp_files": {
71 | "type": "string"
72 | },
73 | "maintenance_work_mem": {
74 | "type": "string"
75 | },
76 | "shared_buffers": {
77 | "type": "string"
78 | }
79 | }
80 | },
81 | "storage": {
82 | "type": "object",
83 | "properties": {
84 | "size": {
85 | "type": "string"
86 | },
87 | "storageClass": {
88 | "type": "string"
89 | }
90 | }
91 | }
92 | }
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/README.md:
--------------------------------------------------------------------------------
1 | # hammerdb-benchmark
2 |
3 |  
4 |
5 | A Helm chart that starts a CNP Cluster and executes a HammerDB job on it.
6 |
7 | **Homepage:**
8 |
9 | ## Source Code
10 |
11 | *
12 |
13 | ## Values
14 |
15 | | Key | Type | Default | Description |
16 | |-----|------|---------|-------------|
17 | | cnp.existingCluster | bool | `false` | Whether the benchmark should be run against an existing cluster or a new one has to be created |
18 | | cnp.existingHost | string | `""` | The address of the existing cluster |
19 | | cnp.existingSuperuserCredentials | string | `""` | The name of a Secret of type basic-auth containing the existing cluster credentials for a superuser |
20 | | cnp.image | string | `"quay.io/enterprisedb/postgresql:14.1"` | The PostgreSQL image used by CNP and HammerDB. |
21 | | cnp.instances | int | `1` | The amount of PostgreSQL instances in the CNP Cluster. |
22 | | cnp.monitoring | object | `{"customQueriesConfigMap":[],"customQueriesSecret":[]}` | Configures custom queries for monitoring. The arrays accept a Dictionary made by name: string (resource name), key: string (resource data field containing the queries). Documentation on the accepted values: https://docs.enterprisedb.io/cloud-native-postgresql/latest/monitoring/ |
23 | | cnp.nodeSelector | object | `{"workload":"postgresql"}` | Dictionary of key-value pairs used to define the nodes where the cluster instances can run; used to avoid hammerdb and PostgreSQL running on the same node. |
24 | | cnp.pooler.instances | int | `0` | The number of pooler replicas that receive the connections. If >0 the benchmarks are run with connection pooling |
25 | | cnp.pooler.nodeSelector.workload | string | `"pooler"` | |
26 | | cnp.pooler.pgbouncer.parameters | object | `{}` | PgBouncer configuration. |
27 | | cnp.pooler.pgbouncer.poolMode | string | `"session"` | The pool mode, accepted values: session, transaction |
28 | | cnp.postgreSQLParameters | object | `{"log_autovacuum_min_duration":"1s","log_checkpoints":"on","log_lock_waits":"on","log_min_duration_statement":"1000","log_statement":"ddl","log_temp_files":"1024","maintenance_work_mem":"128MB","shared_buffers":"512MB"}` | Dictionary of key-value pairs representing PostgreSQL configuration. |
29 | | cnp.storage.size | string | `"1Gi"` | The size of the PVCs used by CNP instances. |
30 | | cnp.storage.storageClass | string | `""` | The storage class used to create PVCs for CNP instances. |
31 | | hammerdb.config.initialize | bool | `true` | Whether pgschemabuild should be run |
32 | | hammerdb.config.pg_prewarm | bool | `true` | Whether we should prewarm all used tables before running `pgrun` and after running `pgschemabuild` |
33 | | hammerdb.config.pgrun | string | `"#!/bin/tclsh\ndbset db pg\ndiset connection pg_host $::env(PGHOST)\ndiset tpcc pg_superuser $::env(PGSUPERUSER)\ndiset tpcc pg_superuserpass $::env(PGSUPERUSERPASS)\ndiset tpcc pg_rampup 0\ndiset tpcc pg_duration 1\ndiset tpcc pg_vacuum true\nprint dict\nvuset logtotemp 1\nloadscript\nprint script\nvuset vu 1\nvucreate\nvurun\nruntimer 1200\nvudestroy\nexit"` | |
34 | | hammerdb.config.pgschemabuild | string | `"#!/bin/tclsh\nputs \"SETTING CONFIGURATION\"\n\ndbset db pg\ndiset connection pg_host $::env(PGHOST)\ndiset tpcc pg_superuser $::env(PGSUPERUSER)\ndiset tpcc pg_superuserpass $::env(PGSUPERUSERPASS)\n#diset connection pg_port 5432\ndiset tpcc pg_count_ware 8\ndiset tpcc pg_num_vu 2\ndiset tpcc pg_raiseerror true\ndiset tpcc pg_driver timed\nprint dict\nbuildschema\nwaittocomplete"` | The tcl script that will be run to populate the database |
35 | | hammerdb.image | string | `"quay.io/enterprisedb/hammerdb:4.2"` | |
36 | | hammerdb.nodeSelector | object | `{"workload":"hammerdb"}` | Dictionary of key-value pairs used to define the nodes where the hammerdb pod can run; used to avoid hammerdb and PostgreSQL running on the same node. |
37 |
38 | ----------------------------------------------
39 | Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
40 |
--------------------------------------------------------------------------------
/pgbench-benchmark/README.md:
--------------------------------------------------------------------------------
1 | # pgbench-benchmark
2 |
3 |  
4 |
5 | A Helm chart that starts a CNP Cluster and executes a PgBench job on it.
6 |
7 | **Homepage:**
8 |
9 | ## Source Code
10 |
11 | *
12 |
13 | ## Values
14 |
15 | | Key | Type | Default | Description |
16 | |-----|------|---------|-------------|
17 | | cnp.existingCluster | bool | `false` | Whether the benchmark should be run against an existing cluster or a new one has to be created |
18 | | cnp.existingCredentials | string | `""` | The name of a Secret of type basic-auth containing the existing cluster credentials |
19 | | cnp.existingDatabase | string | `""` | The port where PostgreSQL is listening on the specified host (default: 5432) |
20 | | cnp.existingHost | string | `""` | The address of the existing cluster (default: empty) |
21 | | cnp.existingPort | string | `""` | The name of the existing database (default: empty) |
22 | | cnp.image | string | `"quay.io/enterprisedb/postgresql:14.1"` | The PostgreSQL image used by CNP and PgBench. |
23 | | cnp.instances | int | `1` | The amount of PostgreSQL instances in the CNP Cluster. |
24 | | cnp.monitoring | object | `{"customQueriesConfigMap":[],"customQueriesSecret":[]}` | Configures custom queries for monitoring. The arrays accept a Dictionary made by name: string (resource name), key: string (resource data field containing the queries). Documentation on the accepted values: https://docs.enterprisedb.io/cloud-native-postgresql/latest/monitoring/ |
25 | | cnp.nodeSelector | object | `{"workload":"postgres"}` | Dictionary of key-value pairs used to define the nodes where the cluster instances can run; used to avoid pgbench and PostgreSQL running on the same node. |
26 | | cnp.pooler.instances | int | `0` | The number of pooler replicas that receive the connections. If >0 the benchmarks are run with connection pooling |
27 | | cnp.pooler.nodeSelector.workload | string | `"pooler"` | |
28 | | cnp.pooler.pgbouncer.parameters | object | `{}` | PgBouncer configuration. |
29 | | cnp.pooler.pgbouncer.poolMode | string | `"session"` | The pool mode, accepted values: session, transaction |
30 | | cnp.postgreSQLParameters | object | `{"log_autovacuum_min_duration":"1s","log_checkpoints":"on","log_lock_waits":"on","log_min_duration_statement":"1000","log_statement":"ddl","log_temp_files":"1024","maintenance_work_mem":"128MB","shared_buffers":"512MB"}` | Dictionary of key-value pairs representing PostgreSQL configuration. |
31 | | cnp.storage.size | string | `"1Gi"` | The size of the PVCs used by CNP instances. |
32 | | cnp.storage.storageClass | string | `""` | The storage class used to create PVCs for CNP instances. |
33 | | pgbench.clients | int | `1` | The number of clients used by pgbench. |
34 | | pgbench.initialize | bool | `true` | Invoke the initialization mode (TPC-B-like test scenario) |
35 | | pgbench.jobs | int | `1` | The number of jobs used by pgbench. |
36 | | pgbench.nodeSelector | object | `{"workload":"pgbench"}` | Dictionary of key-value pairs used to define the nodes where the pgbench pod can run; used to avoid pgbench and PostgreSQL running on the same node. |
37 | | pgbench.reportLatencies | bool | `false` | Report the average per-statement latency (execution time from the perspective of the client) of each command after the benchmark finishes. See below for details |
38 | | pgbench.scaleFactor | int | `1` | Scale factor used to initialize pgbench (if initialize is set to true). |
39 | | pgbench.skipVacuum | bool | `false` | Perform no vacuuming before running the test. |
40 | | pgbench.time | int | `60` | The amount of seconds the pgbench will run for. |
41 | | pgbench.warmTime | int | `0` | If >0, run an initContainer that runs pgbench for the defined amount of time (using the -T option) with the same clients and jobs that will be used for the main pgbench run; can be useful with storage classes that allow I/O bursts where could affect the actual benchmark result. |
42 |
43 | ----------------------------------------------
44 | Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
45 |
--------------------------------------------------------------------------------
/pgbench-benchmark/values.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | cnp:
17 | # -- Whether the benchmark should be run against an existing cluster
18 | # or a new one has to be created
19 | existingCluster: false
20 | # -- The name of a Secret of type basic-auth containing the existing cluster credentials
21 | existingCredentials: ""
22 | # -- The address of the existing cluster (default: empty)
23 | existingHost: ""
24 | # -- The name of the existing database (default: empty)
25 | existingPort: ""
26 | # -- The port where PostgreSQL is listening on the specified host (default: 5432)
27 | existingDatabase: ""
28 | # -- The amount of PostgreSQL instances in the CNP Cluster.
29 | instances: 1
30 | # -- The PostgreSQL image used by CNP and PgBench.
31 | image: quay.io/enterprisedb/postgresql:14.1
32 | storage:
33 | # -- The storage class used to create PVCs for CNP instances.
34 | storageClass: ""
35 | # -- The size of the PVCs used by CNP instances.
36 | size: 1Gi
37 | # -- Dictionary of key-value pairs used to define the nodes
38 | # where the cluster instances can run; used to avoid pgbench and PostgreSQL
39 | # running on the same node.
40 | nodeSelector:
41 | workload: postgres
42 | # -- Configures custom queries for monitoring.
43 | # The arrays accept a Dictionary made by name: string (resource name), key: string (resource data field containing the queries).
44 | # Documentation on the accepted values: https://docs.enterprisedb.io/cloud-native-postgresql/latest/monitoring/
45 | monitoring:
46 | customQueriesConfigMap: []
47 | customQueriesSecret: []
48 | # -- Dictionary of key-value pairs representing
49 | # PostgreSQL configuration.
50 | postgreSQLParameters:
51 | shared_buffers: '512MB'
52 | maintenance_work_mem: '128MB'
53 | log_checkpoints: "on"
54 | log_lock_waits: "on"
55 | log_min_duration_statement: '1000'
56 | log_statement: 'ddl'
57 | log_temp_files: '1024'
58 | log_autovacuum_min_duration: '1s'
59 |
60 | # Configuration of the pooler
61 | pooler:
62 | # -- The number of pooler replicas that receive the connections.
63 | # If >0 the benchmarks are run with connection pooling
64 | instances: 0
65 | nodeSelector:
66 | workload: pooler
67 | pgbouncer:
68 | # -- The pool mode, accepted values: session, transaction
69 | poolMode: session
70 | # -- PgBouncer configuration.
71 | parameters: {}
72 |
73 | pgbench:
74 | # -- Dictionary of key-value pairs used to define the nodes
75 | # where the pgbench pod can run; used to avoid pgbench and PostgreSQL
76 | # running on the same node.
77 | nodeSelector:
78 | workload: pgbench
79 | # -- Invoke the initialization mode (TPC-B-like test scenario)
80 | initialize: true
81 | # -- Scale factor used to initialize pgbench (if initialize is set to true).
82 | scaleFactor: 1
83 | # -- The amount of seconds the pgbench will run for.
84 | time: 60
85 | # -- The number of clients used by pgbench.
86 | clients: 1
87 | # -- The number of jobs used by pgbench.
88 | jobs: 1
89 | # -- If >0, run an initContainer that runs pgbench for the
90 | # defined amount of time (using the -T option) with the same clients and jobs
91 | # that will be used for the main pgbench run; can be useful with storage classes
92 | # that allow I/O bursts where could affect the actual benchmark result.
93 | warmTime: 0
94 | # -- Perform no vacuuming before running the test.
95 | skipVacuum: false
96 | # -- Report the average per-statement latency (execution time from the
97 | # perspective of the client) of each command after the benchmark finishes.
98 | # See below for details
99 | reportLatencies: false
100 |
101 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/values.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2021 EnterpriseDB Corporation
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 | #
15 |
16 | cnp:
17 | # -- Whether the benchmark should be run against an existing cluster
18 | # or a new one has to be created
19 | existingCluster: false
20 | # -- The name of a Secret of type basic-auth containing the existing cluster credentials for a superuser
21 | existingSuperuserCredentials: ""
22 | # -- The address of the existing cluster
23 | existingHost: ""
24 | # -- The amount of PostgreSQL instances in the CNP Cluster.
25 | instances: 1
26 | # -- The PostgreSQL image used by CNP and HammerDB.
27 | image: quay.io/enterprisedb/postgresql:14.1
28 | storage:
29 | # -- The storage class used to create PVCs for CNP instances.
30 | storageClass: ""
31 | # -- The size of the PVCs used by CNP instances.
32 | size: 1Gi
33 | # -- Dictionary of key-value pairs used to define the nodes
34 | # where the cluster instances can run; used to avoid hammerdb and PostgreSQL
35 | # running on the same node.
36 | nodeSelector:
37 | workload: postgresql
38 | # -- Configures custom queries for monitoring.
39 | # The arrays accept a Dictionary made by name: string (resource name), key: string (resource data field containing the queries).
40 | # Documentation on the accepted values: https://docs.enterprisedb.io/cloud-native-postgresql/latest/monitoring/
41 | monitoring:
42 | customQueriesConfigMap: []
43 | customQueriesSecret: []
44 | # -- Dictionary of key-value pairs representing
45 | # PostgreSQL configuration.
46 | postgreSQLParameters:
47 | shared_buffers: '512MB'
48 | maintenance_work_mem: '128MB'
49 | log_checkpoints: "on"
50 | log_lock_waits: "on"
51 | log_min_duration_statement: '1000'
52 | log_statement: 'ddl'
53 | log_temp_files: '1024'
54 | log_autovacuum_min_duration: '1s'
55 |
56 | # Configuration of the pooler
57 | pooler:
58 | # -- The number of pooler replicas that receive the connections.
59 | # If >0 the benchmarks are run with connection pooling
60 | instances: 0
61 | nodeSelector:
62 | workload: pooler
63 | pgbouncer:
64 | # -- The pool mode, accepted values: session, transaction
65 | poolMode: session
66 | # -- PgBouncer configuration.
67 | parameters: {}
68 |
69 | hammerdb:
70 | image: quay.io/enterprisedb/hammerdb:4.2
71 | # -- Dictionary of key-value pairs used to define the nodes
72 | # where the hammerdb pod can run; used to avoid hammerdb and PostgreSQL
73 | # running on the same node.
74 | nodeSelector:
75 | workload: hammerdb
76 | config:
77 | # -- Whether pgschemabuild should be run
78 | initialize: true
79 | # -- The tcl script that will be run to populate the database
80 | pgschemabuild: |-
81 | #!/bin/tclsh
82 | puts "SETTING CONFIGURATION"
83 |
84 | dbset db pg
85 | diset connection pg_host $::env(PGHOST)
86 | diset tpcc pg_superuser $::env(PGSUPERUSER)
87 | diset tpcc pg_superuserpass $::env(PGSUPERUSERPASS)
88 | #diset connection pg_port 5432
89 | diset tpcc pg_count_ware 8
90 | diset tpcc pg_num_vu 2
91 | diset tpcc pg_raiseerror true
92 | diset tpcc pg_driver timed
93 | print dict
94 | buildschema
95 | waittocomplete
96 | # -- Whether we should prewarm all used tables before running `pgrun` and
97 | # after running `pgschemabuild`
98 | pg_prewarm: true
99 | pgrun: |-
100 | #!/bin/tclsh
101 | dbset db pg
102 | diset connection pg_host $::env(PGHOST)
103 | diset tpcc pg_superuser $::env(PGSUPERUSER)
104 | diset tpcc pg_superuserpass $::env(PGSUPERUSERPASS)
105 | diset tpcc pg_rampup 0
106 | diset tpcc pg_duration 1
107 | diset tpcc pg_vacuum true
108 | print dict
109 | vuset logtotemp 1
110 | loadscript
111 | print script
112 | vuset vu 1
113 | vucreate
114 | vurun
115 | runtimer 1200
116 | vudestroy
117 | exit
118 |
--------------------------------------------------------------------------------
/hammerdb-benchmark/values.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/schema#",
3 | "type": "object",
4 | "properties": {
5 | "cnp": {
6 | "type": "object",
7 | "properties": {
8 | "cnpExistingCredentials": {
9 | "type": "string"
10 | },
11 | "cnpExistingHost": {
12 | "type": "string"
13 | },
14 | "existingCluster": {
15 | "type": "boolean"
16 | },
17 | "image": {
18 | "type": "string"
19 | },
20 | "instances": {
21 | "type": "integer"
22 | },
23 | "monitoring": {
24 | "type": "object",
25 | "properties": {
26 | "customQueriesConfigMap": {
27 | "type": "array"
28 | },
29 | "customQueriesSecret": {
30 | "type": "array"
31 | }
32 | }
33 | },
34 | "nodeSelector": {
35 | "type": "object",
36 | "properties": {
37 | "workload": {
38 | "type": "string"
39 | }
40 | }
41 | },
42 | "pooler": {
43 | "type": "object",
44 | "properties": {
45 | "instances": {
46 | "type": "integer"
47 | },
48 | "nodeSelector": {
49 | "type": "object",
50 | "properties": {
51 | "workload": {
52 | "type": "string"
53 | }
54 | }
55 | },
56 | "pgbouncer": {
57 | "type": "object",
58 | "properties": {
59 | "parameters": {
60 | "type": "object"
61 | },
62 | "poolMode": {
63 | "type": "string"
64 | }
65 | }
66 | }
67 | }
68 | },
69 | "postgreSQLParameters": {
70 | "type": "object",
71 | "properties": {
72 | "log_autovacuum_min_duration": {
73 | "type": "string"
74 | },
75 | "log_checkpoints": {
76 | "type": "string"
77 | },
78 | "log_lock_waits": {
79 | "type": "string"
80 | },
81 | "log_min_duration_statement": {
82 | "type": "string"
83 | },
84 | "log_statement": {
85 | "type": "string"
86 | },
87 | "log_temp_files": {
88 | "type": "string"
89 | },
90 | "maintenance_work_mem": {
91 | "type": "string"
92 | },
93 | "shared_buffers": {
94 | "type": "string"
95 | }
96 | }
97 | },
98 | "storage": {
99 | "type": "object",
100 | "properties": {
101 | "size": {
102 | "type": "string"
103 | },
104 | "storageClass": {
105 | "type": "string"
106 | }
107 | }
108 | }
109 | }
110 | },
111 | "hammerdb": {
112 | "type": "object",
113 | "properties": {
114 | "clients": {
115 | "type": "integer"
116 | },
117 | "jobs": {
118 | "type": "integer"
119 | },
120 | "nodeSelector": {
121 | "type": "object",
122 | "properties": {
123 | "workload": {
124 | "type": "string"
125 | }
126 | }
127 | },
128 | "scaleFactor": {
129 | "type": "integer"
130 | },
131 | "time": {
132 | "type": "integer"
133 | },
134 | "warmTime": {
135 | "type": "integer"
136 | }
137 | }
138 | }
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/pgbench-benchmark/values.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json-schema.org/schema#",
3 | "type": "object",
4 | "properties": {
5 | "cnp": {
6 | "type": "object",
7 | "properties": {
8 | "existingCluster": {
9 | "type": "boolean"
10 | },
11 | "existingCredentials": {
12 | "type": "string"
13 | },
14 | "existingDatabase": {
15 | "type": "string"
16 | },
17 | "existingHost": {
18 | "type": "string"
19 | },
20 | "existingPort": {
21 | "type": "string"
22 | },
23 | "image": {
24 | "type": "string"
25 | },
26 | "instances": {
27 | "type": "integer"
28 | },
29 | "monitoring": {
30 | "type": "object",
31 | "properties": {
32 | "customQueriesConfigMap": {
33 | "type": "array"
34 | },
35 | "customQueriesSecret": {
36 | "type": "array"
37 | }
38 | }
39 | },
40 | "nodeSelector": {
41 | "type": "object",
42 | "properties": {
43 | "workload": {
44 | "type": "string"
45 | }
46 | }
47 | },
48 | "pooler": {
49 | "type": "object",
50 | "properties": {
51 | "instances": {
52 | "type": "integer"
53 | },
54 | "nodeSelector": {
55 | "type": "object",
56 | "properties": {
57 | "workload": {
58 | "type": "string"
59 | }
60 | }
61 | },
62 | "pgbouncer": {
63 | "type": "object",
64 | "properties": {
65 | "parameters": {
66 | "type": "object"
67 | },
68 | "poolMode": {
69 | "type": "string"
70 | }
71 | }
72 | }
73 | }
74 | },
75 | "postgreSQLParameters": {
76 | "type": "object",
77 | "properties": {
78 | "log_autovacuum_min_duration": {
79 | "type": "string"
80 | },
81 | "log_checkpoints": {
82 | "type": "string"
83 | },
84 | "log_lock_waits": {
85 | "type": "string"
86 | },
87 | "log_min_duration_statement": {
88 | "type": "string"
89 | },
90 | "log_statement": {
91 | "type": "string"
92 | },
93 | "log_temp_files": {
94 | "type": "string"
95 | },
96 | "maintenance_work_mem": {
97 | "type": "string"
98 | },
99 | "shared_buffers": {
100 | "type": "string"
101 | }
102 | }
103 | },
104 | "storage": {
105 | "type": "object",
106 | "properties": {
107 | "size": {
108 | "type": "string"
109 | },
110 | "storageClass": {
111 | "type": "string"
112 | }
113 | }
114 | }
115 | }
116 | },
117 | "pgbench": {
118 | "type": "object",
119 | "properties": {
120 | "clients": {
121 | "type": "integer"
122 | },
123 | "initialize": {
124 | "type": "boolean"
125 | },
126 | "jobs": {
127 | "type": "integer"
128 | },
129 | "nodeSelector": {
130 | "type": "object",
131 | "properties": {
132 | "workload": {
133 | "type": "string"
134 | }
135 | }
136 | },
137 | "reportLatencies": {
138 | "type": "boolean"
139 | },
140 | "scaleFactor": {
141 | "type": "integer"
142 | },
143 | "skipVacuum": {
144 | "type": "boolean"
145 | },
146 | "time": {
147 | "type": "integer"
148 | },
149 | "warmTime": {
150 | "type": "integer"
151 | }
152 | }
153 | }
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/CODE-OF-CONDUCT.md:
--------------------------------------------------------------------------------
1 | # cnp-bench (Cloud Native PostgreSQL Benchmarking) - Contributor Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, caste, color, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leader responsible for enforcement,
63 | [@gbartolini](https://github.com/gbartolini).
64 |
65 | All complaints will be reviewed and investigated promptly and fairly.
66 |
67 | All community leaders are obligated to respect the privacy and security of the
68 | reporter of any incident.
69 |
70 | ## Enforcement Guidelines
71 |
72 | Community leaders will follow these Community Impact Guidelines in determining
73 | the consequences for any action they deem in violation of this Code of Conduct:
74 |
75 | ### 1. Correction
76 |
77 | **Community Impact**: Use of inappropriate language or other behavior deemed
78 | unprofessional or unwelcome in the community.
79 |
80 | **Consequence**: A private, written warning from community leaders, providing
81 | clarity around the nature of the violation and an explanation of why the
82 | behavior was inappropriate. A public apology may be requested.
83 |
84 | ### 2. Warning
85 |
86 | **Community Impact**: A violation through a single incident or series
87 | of actions.
88 |
89 | **Consequence**: A warning with consequences for continued behavior. No
90 | interaction with the people involved, including unsolicited interaction with
91 | those enforcing the Code of Conduct, for a specified period of time. This
92 | includes avoiding interactions in community spaces as well as external channels
93 | like social media. Violating these terms may lead to a temporary or
94 | permanent ban.
95 |
96 | ### 3. Temporary Ban
97 |
98 | **Community Impact**: A serious violation of community standards, including
99 | sustained inappropriate behavior.
100 |
101 | **Consequence**: A temporary ban from any sort of interaction or public
102 | communication with the community for a specified period of time. No public or
103 | private interaction with the people involved, including unsolicited interaction
104 | with those enforcing the Code of Conduct, is allowed during this period.
105 | Violating these terms may lead to a permanent ban.
106 |
107 | ### 4. Permanent Ban
108 |
109 | **Community Impact**: Demonstrating a pattern of violation of community
110 | standards, including sustained inappropriate behavior, harassment of an
111 | individual, or aggression toward or disparagement of classes of individuals.
112 |
113 | **Consequence**: A permanent ban from any sort of public interaction within
114 | the community.
115 |
116 | ## Attribution
117 |
118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119 | version 2.0, available at
120 | [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
121 |
122 | Community Impact Guidelines were inspired by
123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124 |
125 | For answers to common questions about this code of conduct, see the FAQ at
126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
127 | at [https://www.contributor-covenant.org/translations][translations].
128 |
129 | [homepage]: https://www.contributor-covenant.org
130 | [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
131 | [Mozilla CoC]: https://github.com/mozilla/diversity
132 | [FAQ]: https://www.contributor-covenant.org/faq
133 | [translations]: https://www.contributor-covenant.org/translations
134 |
135 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # THIS PROJECT HAS BEEN ARCHIVED AND IS NO LONGER UPDATED
2 | ### PLEASE REFER TO THE OPERATOR DOCUMENTATION FOR THE CURRENT WAY TO RUN BENCHMARKS
3 |
4 | * ["Benchmarking" page of the CloudNativePG open source project](https://cloudnative-pg.io/documentation/current/benchmarking/)
5 | * ["Benchmarking" page for EDB Postgres for Kubernetes](https://www.enterprisedb.com/docs/postgres_for_kubernetes/latest/benchmarking/)
6 |
7 | ---
8 |
9 | # Benchmarking Cloud Native PostgreSQL
10 |
11 | `cnp-bench` provides a bundle of helm charts designed for benchmarking a PostgreSQL deployment in Kubernetes,
12 | in a controlled, non-production environment. This guide is currently designed and tested to run `cnp-bench`
13 | on a [Cloud Native PostgreSQL (CNP)](https://docs.enterprisedb.io/) Cluster by [EDB](https://enterprisedb.com/).
14 |
15 | Benchmarking is focused on two aspects:
16 |
17 | - the **storage**, by relying on [fio](https://fio.readthedocs.io/en/latest/fio_doc.html)
18 | - the **database**, by relying on either [pgbench](https://www.postgresql.org/docs/current/pgbench.html),
19 | PostgreSQL's default benchmarking application, or [HammerDB](https://www.hammerdb.com/docs/).
20 |
21 | **IMPORTANT:** `cnp-bench` must be run in a staging or pre-production
22 | environment. Do not use `cnp-bench` in a production environment, as it
23 | might have catastrophic consequences on your databases and the other
24 | workloads/applications that run in the same shared environment.
25 |
26 | ## Requirements
27 |
28 | * A running Kubernetes cluster;
29 | * A working connection to the Kubernetes cluster via `kubectl`;
30 | * Helm should be installed locally (see the
31 | ["Installing Helm" documentation page](https://helm.sh/docs/intro/install/));
32 | * Access, within Kubernetes, to the PostgreSQL cluster you want to benchmark.
33 |
34 | As far as the latter is concerned, you might need to install the CNP operator
35 | if you are planning to run benchmarks on disposable Postgres clusters that
36 | exist for the sole duration of the test.
37 | Consider that, if you *install
38 | [cnp-sandbox](https://github.com/EnterpriseDB/cnp-sandbox), the CNP operator
39 | will be installed together with the monitoring stack comprising Grafana,
40 | Prometheus and default metrics. This is our recommended approach.
41 |
42 | * The above installation method applies to Kubernetes clusters and not Openshift Clusters.
43 |
44 | ## Installing the `cnp-bench` Helm charts
45 |
46 | First, you need to clone the main repository:
47 |
48 | ```
49 | git clone git@github.com:EnterpriseDB/cnp-bench.git
50 | cd cnp-bench
51 | ```
52 | You can install a chart by defining a "Release Name" that will be used to
53 | identify the resources and running:
54 |
55 | ``` sh
56 | helm install RELEASE_NAME path/to/chart/dir
57 | ```
58 | Please note that each benchmark is managed by a different chart that is located in a different folder.
59 |
60 | For example, to run the `fio` benchmark, you need to install the chart located in the `fio-benchmark` folder.
61 | Please refer to the specific sections below for details on each scenario.
62 |
63 | You can override the default settings included in the `values.yaml` file of a chart using the `--values` or `--set` options of `helm install` or
64 | by passing the whole yaml configuration file with the`--values` argument.
65 | You can obtain a configuration file by copying the values.yml contained in your chosen chart and use it as a starting point.
66 | More details are available in the [Helm install documentation](https://helm.sh/docs/helm/helm_install/#helm-install).
67 | See the `README.md` file included in each chart for the available parameters.
68 |
69 | You can verify the installed helm charts with:
70 |
71 | ``` sh
72 | helm list
73 | ```
74 |
75 | Resources created by a chart can be removed running:
76 |
77 | ``` sh
78 | helm uninstall RELEASE_NAME
79 | ```
80 |
81 | ## Installing `cnp-sandbox`
82 |
83 | 
84 |
85 | `cnp-sandbox` will deploy in your selected Kubernetes cluster Prometheus,
86 | Grafana, CNP, as well as a sample dashboard for Granana based on
87 | a sample set of metrics exposed by CNP Clusters.
88 |
89 | For more information, please refer to the [main Github repository of
90 | `cnp-sandbox`](https://github.com/EnterpriseDB/cnp-sandbox).
91 |
92 | ## Benchmarking the storage with `fio`
93 |
94 | The chart is contained in the `fio-benchmark` directory.
95 |
96 | It will:
97 |
98 | 1. Create a PVC;
99 | 1. Create a ConfigMap representing the configuration of a fio job;
100 | 1. Create a fio deployment composed by a single Pod, which will run fio on
101 | the PVC, create graphs after completing the benchmark and start serving the
102 | generated files with a webserver. We use the
103 | [`fio-tools`](https://github.com/wallnerryan/fio-tools`) image for that.
104 |
105 | The pod created by the deployment will be ready when it starts serving the
106 | results. You can forward the port of the pod created by the deployment
107 |
108 | ```
109 | kubectl port-forward -n NAMESPACE deployment/RELEASE_NAME 8000
110 | ```
111 |
112 | and then use a browser and connect to `http://localhost:8000/` to get the data.
113 |
114 | The default 8k block size has been chosen to emulate a PostgreSQL workload.
115 | Disks that cap the amount of available IOPS can show very different throughput
116 | values changing this parameter.
117 |
118 | Below is an example of diagram of sequential writes on a local disk
119 | mounted on a `Standard_E8ds_v4` dedicated Kubernetes node on Azure
120 | (1 hour benchmark):
121 |
122 | 
123 |
124 |
125 | ## Benchmarking the database with `pgbench`
126 |
127 | [pgbench](https://www.postgresql.org/docs/current/pgbench.html) is the default
128 | benchmarking application for PostgreSQL. The chart for `pgbench` is contained
129 | in the `pgbench-benchmark` directory.
130 |
131 | You can run a `pgbench` benchmark on:
132 |
133 | - a disposable PostgreSQL cluster created by the CNP operator specifically for
134 | the benchmark
135 | - an existing PostgreSQL cluster, by providing connection information (host,
136 | port, database name, and user)
137 |
138 | The `cnp.existingCluster` option is the one that controls the above behavior.
139 |
140 | While running a job on a cluster that lives for the sole duration of the test
141 | is useful, we recommend that you first create your PostgreSQL cluster, possibly
142 | with `cnp-sandbox` installed, and then run `pgbench` on that cluster as explained
143 | in the "Running `pgbench` on an existing Postgres cluster" section below.
144 |
145 | ### Running `pgbench` on a disposable CNP cluster
146 |
147 | When `cnp.existingCluster` is set to `false` (default), the chart will:
148 |
149 | 1. Create a CNP cluster based on the user-defined values;
150 | 1. Execute a user-defined `pgbench` job on it.
151 |
152 | You can gather the results after the job is completed running:
153 |
154 | ``` sh
155 | kubectl logs -n NAMESPACE job/RELEASE_NAME-pgbench
156 | ```
157 |
158 | You can use the `kubectl wait` command to wait until the job is complete:
159 |
160 | ``` sh
161 | kubectl wait --for=condition=complete -n NAMESPACE job/RELEASE_NAME-pgbench
162 | ```
163 |
164 | It is suggested to label nodes and use node selectors to avoid pgbench and
165 | PostgreSQL pods running on the same node. By default, the chart expects
166 | the nodes on which pgbench can run to be labelled with `workload: pgbench`
167 | and the node for CNP instances to be labelled with `workload: postgres`.
168 |
169 | ``` sh
170 | kubectl label node/NODE_NAME workload:pgbench
171 | kubectl label node/OTHER_NODE_NAME workload:postgresql
172 | ```
173 |
174 | Below is an example of `pgbench` output on the same `Standard_E8ds_v4`
175 | dedicated Kubernetes node on Azure with local disks as in the previous section
176 | (1 hour benchmark):
177 |
178 | ```console
179 | starting vacuum...end.
180 | transaction type:
181 | scaling factor: 12000
182 | query mode: simple
183 | number of clients: 16
184 | number of threads: 8
185 | duration: 3600 s
186 | number of transactions actually processed: 23022969
187 | latency average = 2.502 ms
188 | tps = 6395.218137 (including connections establishing)
189 | tps = 6395.231977 (excluding connections establishing)
190 | ```
191 |
192 | #### Adding a connection pooler
193 |
194 | CNP has native support for the PgBouncer pooler. You can create a database
195 | access layer with PgBouncer by managing the `cnp.pooler` section of the values
196 | file. By default, PgBouncer will be placed on those nodes with the `workload:
197 | pooler` label.
198 |
199 | Look at the `pgbench-benchmark/values.yaml` for an example, as well as the CNP
200 | documentation for more information on the PgBouncer implementation.
201 |
202 | ### Running `pgbench` on an existing Postgres cluster
203 |
204 | Suppose you already have your PostgreSQL database setup (not necessarily with CNP).
205 | You can use `cnp-bench` to run a `pgbench` test.
206 |
207 |
208 | ``` yaml
209 | cnp:
210 | existingCluster: true
211 | # Name of the host (or service in K8s) or IP address where Postgres is running
212 | existingHost: mydb
213 | # You need to point `existingCredentials` to a Kubernetes `basic-auth`secret
214 | # containing username and password to connect to the database
215 | existingCredentials: mydb-app
216 | # Name of the database on which to run pgbench
217 | existingDatabase: pgbench
218 |
219 | pgbench:
220 | # Node where to run pgbench
221 | nodeSelector:
222 | workload: pgbench
223 | initialize: true
224 | scaleFactor: 1
225 | time: 60
226 | clients: 1
227 | jobs: 1
228 | skipVacuum: false
229 | reportLatencies: false
230 | ```
231 |
232 | The `cnp` section above, points to the existing database.
233 |
234 | The `pgbench` setion contains the parameters you can use to run the `pgbench` job.
235 | For example, you can create a job that initializes only the `pgbench` database
236 | for a given scale (e.g. 7000, corresponding to roughly 95GB-100GB of database
237 | size), then create another one that only runs the job, with different settings
238 | of clients, time and jobs.
239 |
240 |
241 | ## HammerDB
242 |
243 | [HammerDB](https://www.hammerdb.com/) is the leading benchmarking and load
244 | testing software for the world's most popular databases supporting Oracle
245 | Database, SQL Server, IBM Db2, MySQL, MariaDB and PostgreSQL.
246 |
247 | `cnp-bench` by default will run the TPROC-C benchmark, that is the OLTP
248 | workload implemented in HammerDB derived from the TPC-C specification with
249 | modification to make running HammerDB straightforward and cost-effective on any
250 | of the supported database environments. The HammerDB TPROC-C workload is an
251 | open source workload derived from the TPC-C Benchmark Standard and as such is
252 | not comparable to published TPC-C results, as the results comply with a subset
253 | rather than the full TPC-C Benchmark Standard.
254 | The name for the HammerDB workload TPROC-C means "Transaction Processing
255 | Benchmark derived from the TPC "C" specification".
256 |
257 | Similarly to the case of `pgbench`, you can run HammerDB on a disposable CNP cluster.
258 | We won't report instructions here as they are identical to the `pgbench` case.
259 | Also in this case we recommend that you run the test on a previously
260 | created Postgres cluster (with CNP or another operator/method).
261 |
262 |
263 | Make a local copy of the `hammerdb-benchmark/values.yaml` file, and make sure
264 | you set the `existingSuperuserCredentials` option to the Kubernetes secret
265 | containing the superuser password.
266 |
267 | ```yaml
268 | cnp:
269 | existingCluster: true
270 | existingSuperuserCredentials: mydb-superuser
271 | existingHost: mydb
272 | ```
273 |
274 | Then look at the `hammerdb` section on possible ways to customize the test.
275 | In particular, modify the scripts in `hammerdb.pgschemabuild` and
276 | `hammerdb.pgrun`, by taking care of the following options:
277 |
278 | - `pg_count_ware`
279 | - `pg_num_vu`
280 | - `pg_rampup`
281 | - `pg_duration`
282 | - the value `n` in `vuset vu n`
283 | - the value `x` in `runtimer x`
284 |
285 | As reported in the [HammerDB documentation](https://www.hammerdb.com/docs/ch03s07.html),
286 | a good starting rule is to set `pg_num_vu` and `vu` to the number of cores
287 | available on Postgres, while `pg_count_ware` to 4/5 times the same value.
288 |
289 | It is suggested to label nodes and use node selectors to avoid HammerDB and
290 | PostgreSQL pods running on the same node. By default, the chart expects
291 | the nodes on which pgbench can run to be labelled with `workload: hammerdb`
292 | and the node for CNP instances to be labelled with `workload: postgresql`.
293 |
294 | ``` sh
295 | kubectl label node/NODE_NAME workload=hammerdb
296 | kubectl label node/OTHER_NODE_NAME workload=postgresql
297 | ```
298 |
299 | ## Contributing
300 |
301 | Please read the [code of conduct](CODE-OF-CONDUCT.md) and the
302 | [guidelines](CONTRIBUTING.md) to contribute to the project.
303 |
304 | ## Disclaimer
305 |
306 | `cnp-bench` is open source software and comes "as is". Please carefully
307 | read the [license](LICENSE) before you use this software, in particular
308 | the "Disclaimer of Warranty" and "Limitation of Liability" items.
309 |
310 | *Benchmarking is an activity that must be done before you deploy a system
311 | in production. Do not run `cnp-bench` in a production environment, unless
312 | you are aware of the impact of this operation with other services that
313 | are hosted on the same environment.*
314 |
315 | ## Copyright
316 |
317 | `cnp-bench` is distributed under Apache License 2.0.
318 |
319 | Copyright (C) 2021 EnterpriseDB Corporation.
320 |
--------------------------------------------------------------------------------