Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor DB compose and metrics settings (#2834)

Rich Turnera8ef94f28617
diff --git a/deployment/query-exporter/config.yaml b/deployment/query-exporter/config.yaml
index 2e8a2e507..2b8888cbe 100644
--- a/deployment/query-exporter/config.yaml
+++ b/deployment/query-exporter/config.yaml
@@ -86,6 +86,10 @@ metrics:
type: gauge
description: Asset datapoint table size in MB
+ pg_datapoint_data_index_ratio:
+ type: gauge
+ description: Asset datapoint table index size to data size ratio (over 1 indicates an possible issue)
+
pg_datapoint_chunk_count:
type: gauge
description: Asset datapoint table hypertable chunk count
@@ -281,14 +285,15 @@ queries:
datapoint_table_size:
interval: 3600 # Hourly
databases: [openremote]
- metrics: [pg_datapoint_raw_data_size, pg_datapoint_indexes_size, pg_datapoint_toast_size, pg_datapoint_disk_size]
+ metrics: [pg_datapoint_raw_data_size, pg_datapoint_indexes_size, pg_datapoint_toast_size, pg_datapoint_disk_size, pg_datapoint_data_index_ratio]
sql: |
SELECT
ROUND(table_bytes / 1048576.0, 0) AS pg_datapoint_raw_data_size,
ROUND(index_bytes / 1048576.0, 0) AS pg_datapoint_indexes_size,
ROUND(toast_bytes / 1048576.0, 0) AS pg_datapoint_toast_size,
- ROUND(total_bytes / 1048576.0, 0) AS pg_datapoint_disk_size
- FROM hypertable_detailed_size('asset_datapoint');
+ ROUND(total_bytes / 1048576.0, 0) AS pg_datapoint_disk_size,
+ ROUND(index_bytes::numeric / NULLIF(table_bytes + toast_bytes, 0), 2) AS pg_datapoint_data_index_ratio
+ FROM hypertable_detailed_size('asset_datapoint');
datapoint_chunks:
interval: 86400 # Daily
diff --git a/profile/deploy.yml b/profile/deploy.yml
index 8f6d83f2c..77755c5d0 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -442,21 +442,21 @@ services:
image: openremote/postgresql:${POSTGRESQL_VERSION:-latest-slim}
restart: always
# RAM limits and PostgreSQL memory settings should be set appropriately for the expected load (see documentation)
- shm_size: 156mb
+ shm_size: ${OR_DB_SHM:-156mb}
deploy:
resources:
limits:
- memory: 512M
+ memory: ${OR_DB_RAM:-512M}
command:
- postgres
- -c
- - shared_buffers=128MB
+ - shared_buffers=${OR_DB_SHARED_BUFFERS:-128MB}
- -c
- - effective_cache_size=384MB
+ - effective_cache_size=${OR_DB_CACHE_SIZE:-384MB}
- -c
- - maintenance_work_mem=56MB
+ - maintenance_work_mem=${OR_DB_MAINTENANCE_WORK_MEM:-56MB}
- -c
- - work_mem=4MB
+ - work_mem=${OR_DB_WORK_MEM:-4MB}
# Docker volume for persistent storage of DB; can alternatively map to host
volumes:
# Needs to be available on the same path as the manager for data exports to work