Add support to customize pg conf (#792)

This commit is contained in:
Michael Lin authored and GitHub committed 2022-04-12 08:36:36 -07:00
1 parent 501e1cde02
commit 72e3ec4e7c
4 files changed
+177 -2

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
#------------------------------------------------------------------------------
# POSTGRESQL DEFAULT CONFIGURATION
#------------------------------------------------------------------------------
# Below is PostgreSQL default configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
dynamic_shared_memory_type = posix
max_wal_size = 1GB
min_wal_size = 80MB
log_timezone = 'UTC'
datestyle = 'iso, mdy'
timezone = 'UTC'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------
# SOURCEGRAPH RECOMMENDED OPTIONS
#------------------------------------------------------------------------------
# Below is Sourcegraph recommended Postgres configuration based on the default resource configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.
shared_buffers = 509546kB
work_mem = 3184kB
maintenance_work_mem = 254773kB
effective_io_concurrency = 200
max_worker_processes = 19
max_parallel_workers_per_gather = 4
max_parallel_workers = 8
wal_buffers = 15285kB
min_wal_size = 512MB
checkpoint_completion_target = 0.9
random_page_cost = 1.1
effective_cache_size = 1492MB
default_statistics_target = 500
autovacuum_max_workers = 10
autovacuum_naptime = 10
shared_preload_libraries = ''
max_locks_per_transaction = 64
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
# Add your customization here
# Learn more: https://docs.sourcegraph.com/admin/config/postgres-conf
+56
View File
@@ -0,0 +1,56 @@
#------------------------------------------------------------------------------
# POSTGRESQL DEFAULT CONFIGURATION
#------------------------------------------------------------------------------
# Below is PostgreSQL default configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
dynamic_shared_memory_type = posix
max_wal_size = 1GB
min_wal_size = 80MB
log_timezone = 'UTC'
datestyle = 'iso, mdy'
timezone = 'UTC'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------
# SOURCEGRAPH RECOMMENDED OPTIONS
#------------------------------------------------------------------------------
# Below is Sourcegraph recommended Postgres configuration based on the default resource configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.
shared_buffers = 1GB
work_mem = 5MB
maintenance_work_mem = 250MB
temp_file_limit = 20GB
bgwriter_delay = 50ms
bgwriter_lru_maxpages = 200
effective_io_concurrency = 200
max_worker_processes = 4
max_parallel_maintenance_workers = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
wal_buffers = 16MB
max_wal_size = 8GB
min_wal_size = 2GB
random_page_cost = 1.1
effective_cache_size = 3GB
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
# Add your customization here
# Learn more: https://docs.sourcegraph.com/admin/config/postgres-conf
+8 -2
View File
@@ -542,7 +542,8 @@ services:
container_name: pgsql
image: 'index.docker.io/sourcegraph/postgres-12-alpine:135107_2022-03-03_9498a8bd3366@sha256:e26b159dc7c0c47d136886390c899816e669a3c2c1ead689bdad0b610364e45e'
cpus: 4
mem_limit: '2g'
mem_limit: '4g'
shm_size: '1g'
healthcheck:
test: '/liveness.sh'
interval: 10s
@@ -551,6 +552,7 @@ services:
start_period: 15s
volumes:
- 'pgsql:/data/'
- '../pgsql/conf:/conf/'
networks:
- sourcegraph
restart: always
@@ -587,7 +589,8 @@ services:
container_name: codeintel-db
image: 'index.docker.io/sourcegraph/codeintel-db:insiders@sha256:4babecc9be85e7110984a2ae74ffc41198b35a868185b7edcaf27f775e804768'
cpus: 4
mem_limit: '2g'
mem_limit: '4g'
shm_size: '1g'
healthcheck:
test: '/liveness.sh'
interval: 10s
@@ -596,6 +599,7 @@ services:
start_period: 15s
volumes:
- 'codeintel-db:/data/'
- '../codeintel-db/conf:/conf/'
networks:
- sourcegraph
restart: always
@@ -637,11 +641,13 @@ services:
image: 'index.docker.io/sourcegraph/codeinsights-db:insiders@sha256:82fe7f91dbdca1cd397a80f1023d9da4e9c6af103bc36866d800e3a8279eea00'
cpus: 4
mem_limit: '2g'
shm_size: '1g'
environment:
- POSTGRES_PASSWORD=password
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- 'codeinsights-db:/var/lib/postgresql/data/'
- '../codeinsights-db/conf:/conf/'
networks:
- sourcegraph
restart: always
+56
View File
@@ -0,0 +1,56 @@
#------------------------------------------------------------------------------
# POSTGRESQL DEFAULT CONFIGURATION
#------------------------------------------------------------------------------
# Below is PostgreSQL default configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
dynamic_shared_memory_type = posix
max_wal_size = 1GB
min_wal_size = 80MB
log_timezone = 'UTC'
datestyle = 'iso, mdy'
timezone = 'UTC'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'
#------------------------------------------------------------------------------
# SOURCEGRAPH RECOMMENDED OPTIONS
#------------------------------------------------------------------------------
# Below is Sourcegraph recommended Postgres configuration based on the default resource configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.
shared_buffers = 1GB
work_mem = 5MB
maintenance_work_mem = 250MB
temp_file_limit = 20GB
bgwriter_delay = 50ms
bgwriter_lru_maxpages = 200
effective_io_concurrency = 200
max_worker_processes = 4
max_parallel_maintenance_workers = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
wal_buffers = 16MB
max_wal_size = 8GB
min_wal_size = 2GB
random_page_cost = 1.1
effective_cache_size = 3GB
#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
# Add your customization here
# Learn more: https://docs.sourcegraph.com/admin/config/postgres-conf