Skip to content

Commit 537ae01

Browse files
committed
Set values for tiler db tuning
1 parent 5b9295e commit 537ae01

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed
Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
#!/bin/sh
2-
set -e
3-
if [ "${POSTGRES_DB_MAX_CONNECTIONS}X" != "X" ]; then
4-
set -x;
2+
3+
# max_connections
4+
if [[ "${POSTGRES_DB_MAX_CONNECTIONS}X" != "X" ]]; then
55
sed -i -e"s/^.*max_connections =.*$/max_connections = $POSTGRES_DB_MAX_CONNECTIONS/" $PGDATA/postgresql.conf
6-
set +x;
6+
fi
7+
8+
# shared_buffers
9+
if [[ "${POSTGRES_DB_SHARED_BUFFERS}X" != "X" ]]; then
10+
sed -i -e"s/^.*shared_buffers =.*$/shared_buffers = $POSTGRES_DB_SHARED_BUFFERS/" $PGDATA/postgresql.conf
11+
fi
12+
13+
# work_mem
14+
if [[ "${POSTGRES_DB_WORK_MEM}X" != "X" ]]; then
15+
sed -i -e"s/^.*#work_mem =.*$/work_mem = $POSTGRES_DB_WORK_MEM/" $PGDATA/postgresql.conf
16+
fi
17+
18+
# maintenance_work_mem
19+
if [[ "${POSTGRES_DB_MAINTENANCE_WORK_MEM}X" != "X" ]]; then
20+
sed -i -e"s/^.*maintenance_work_mem =.*$/maintenance_work_mem = $POSTGRES_DB_MAINTENANCE_WORK_MEM/" $PGDATA/postgresql.conf
21+
fi
22+
23+
# effective_cache_size
24+
if [[ "${POSTGRES_DB_EFFECTIVE_CACHE_SIZE}X" != "X" ]]; then
25+
sed -i -e"s/^.*effective_cache_size =.*$/effective_cache_size = $POSTGRES_DB_EFFECTIVE_CACHE_SIZE/" $PGDATA/postgresql.conf
726
fi

images/tiler-server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ COPY ./start.sh .
5050
COPY ./expire-watcher.sh .
5151
COPY ./seed-by-diffs.sh .
5252
COPY ./tile_cache_downloader.sh .
53-
# CMD ./start.sh & ./tile_cache_downloader.sh & ./expire-watcher.sh
53+
CMD ./start.sh & ./tile_cache_downloader.sh & ./expire-watcher.sh

osm-seed/templates/tiler-db-statefulset.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ spec:
4747
value: {{ .Values.tilerDb.persistenceDisk.mountPath }}
4848
- name: POSTGRES_DB_MAX_CONNECTIONS
4949
value: {{ default 100 .Values.tilerDb.env.POSTGRES_DB_MAX_CONNECTIONS | quote }}
50+
- name: POSTGRES_DB_SHARED_BUFFERS
51+
value: {{ default "128MB" .Values.tilerDb.env.POSTGRES_DB_SHARED_BUFFERS | quote }}
52+
- name: POSTGRES_DB_WORK_MEM
53+
value: {{ default "4MB" .Values.tilerDb.env.POSTGRES_DB_WORK_MEM | quote }}
54+
- name: POSTGRES_DB_MAINTENANCE_WORK_MEM
55+
value: {{ default "64MB" .Values.tilerDb.env.POSTGRES_DB_MAINTENANCE_WORK_MEM | quote }}
56+
- name: POSTGRES_DB_EFFECTIVE_CACHE_SIZE
57+
value: {{ default "4GB" .Values.tilerDb.env.POSTGRES_DB_EFFECTIVE_CACHE_SIZE | quote }}
5058
- name: POD_IP
5159
valueFrom: { fieldRef: { fieldPath: status.podIP } }
5260
livenessProbe:

osm-seed/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ tilerDb:
259259
POSTGRES_USER: postgres
260260
POSTGRES_PASSWORD: '1234'
261261
POSTGRES_PORT: 5432
262-
POSTGRES_DB_MAX_CONNECTIONS: 500
262+
POSTGRES_DB_MAX_CONNECTIONS: 100
263+
POSTGRES_DB_SHARED_BUFFERS: 128MB
264+
POSTGRES_DB_WORK_MEM: 4MB
265+
POSTGRES_DB_MAINTENANCE_WORK_MEM: 64MB
266+
POSTGRES_DB_EFFECTIVE_CACHE_SIZE: 4GB
263267
persistenceDisk:
264268
enabled: false
265269
accessMode: ReadWriteOnce

0 commit comments

Comments
 (0)