chore(deploy): tune postgres memory parameters and limit (CACHE-2)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
05b163ce32
commit
71d2cd70cf
2 files changed
+29
No files matched your search
@@ -19,6 +19,27 @@ services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
# 内存参数按 4C/8G 机器给 PG 3G 设定(CACHE-2);机器不同按 docs/runbook/storage.md「PG 参数」调整,
|
||||
# 改 .env 里的 PG_* 后 docker compose up -d postgres 重建生效
|
||||
command:
|
||||
- postgres
|
||||
- -c
|
||||
- shared_buffers=${PG_SHARED_BUFFERS:-2GB}
|
||||
- -c
|
||||
- effective_cache_size=${PG_EFFECTIVE_CACHE_SIZE:-5GB}
|
||||
- -c
|
||||
- work_mem=${PG_WORK_MEM:-32MB}
|
||||
- -c
|
||||
- maintenance_work_mem=${PG_MAINTENANCE_WORK_MEM:-256MB}
|
||||
- -c
|
||||
- max_wal_size=${PG_MAX_WAL_SIZE:-2GB}
|
||||
mem_limit: ${PG_MEM_LIMIT:-3g}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: ${PG_MEM_LIMIT:-3g}
|
||||
# 并行查询的动态共享内存走 /dev/shm,Docker 缺省 64MB 不够
|
||||
shm_size: 512mb
|
||||
environment:
|
||||
POSTGRES_USER: umt
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?请设置 POSTGRES_PASSWORD}
|
||||
|
||||
Reference in new issue
Block a user