Skip to content

armgit / core

Public Imported from GitHub
0

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

Add Asset table fillfactor migration script and document postgres container memory settings (#2773)

Rich Turnerc1e3aa11c299
diff --git a/manager/src/main/resources/org/openremote/manager/setup/database/V20260518_01__AssetFillFactor.sql b/manager/src/main/resources/org/openremote/manager/setup/database/V20260518_01__AssetFillFactor.sql
new file mode 100644
index 000000000..a178ac236
--- /dev/null
+++ b/manager/src/main/resources/org/openremote/manager/setup/database/V20260518_01__AssetFillFactor.sql
@@ -0,0 +1,2 @@
+-- SET ASSET FILL FACTOR TO 90%
+ALTER TABLE ${schemaName}.asset SET (fillfactor = 90);
diff --git a/profile/demo.yml b/profile/demo.yml
index 3bfaebf80..ea4d3871c 100644
--- a/profile/demo.yml
+++ b/profile/demo.yml
@@ -58,7 +58,21 @@ services:
postgresql:
restart: always
image: openremote/postgresql:${POSTGRESQL_VERSION:-latest-slim}
- shm_size: 128mb
+ shm_size: 156mb
+ deploy:
+ resources:
+ limits:
+ memory: 512M
+ command:
+ - postgres
+ - -c
+ - shared_buffers=128MB
+ - -c
+ - effective_cache_size=384MB
+ - -c
+ - maintenance_work_mem=56MB
+ - -c
+ - work_mem=4MB
volumes:
- postgresql-data:/var/lib/postgresql/data
- manager-data:/storage
diff --git a/profile/deploy.yml b/profile/deploy.yml
index 89ba415be..8f6d83f2c 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -441,8 +441,22 @@ services:
postgresql:
image: openremote/postgresql:${POSTGRESQL_VERSION:-latest-slim}
restart: always
- # Shared memory should be increased for any reasonable DB size this should be increased further
- shm_size: 128mb
+ # RAM limits and PostgreSQL memory settings should be set appropriately for the expected load (see documentation)
+ shm_size: 156mb
+ deploy:
+ resources:
+ limits:
+ memory: 512M
+ command:
+ - postgres
+ - -c
+ - shared_buffers=128MB
+ - -c
+ - effective_cache_size=384MB
+ - -c
+ - maintenance_work_mem=56MB
+ - -c
+ - 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
@@ -465,11 +479,6 @@ services:
# service DB values so the actual max connections are not exhausted
POSTGRES_MAX_CONNECTIONS: ${POSTGRES_MAX_CONNECTIONS:-50}
- # When a newer POSTGRESQL image is used with a higher OR_REINDEX_COUNTER and PGDATA is
- # preserved then the container will REINDEX the DB automatically unless the following
- # is set to false
- #OR_DISABLE_REINDEX=${OR_DISABLE_REINDEX:-false}
-
# Query Exporter - Prometheus metrics from PostgreSQL queries
# Documentation: https://github.com/albertodonato/query-exporter
query-exporter: