File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -864,6 +864,17 @@ test-migrations: test-postgres-docker
864864# NOTE: we set --memory to the same size as a GitHub runner.
865865test-postgres-docker :
866866 docker rm -f test-postgres-docker-${POSTGRES_VERSION} || true
867+ # Make sure to not overallocate work_mem and max_connections as each
868+ # connection will be allowed to use this much memory. Try adjusting
869+ # shared_buffers instead, if needed.
870+ #
871+ # - work_mem=8MB * max_connections=1000 = 8GB
872+ # - shared_buffers=2GB + effective_cache_size=1GB = 3GB
873+ #
874+ # This leaves 5GB for the rest of the system _and_ storing the
875+ # database in memory (--tmpfs).
876+ #
877+ # https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM
867878 docker run \
868879 --env POSTGRES_PASSWORD=postgres \
869880 --env POSTGRES_USER=postgres \
@@ -876,9 +887,9 @@ test-postgres-docker:
876887 --detach \
877888 --memory 16GB \
878889 gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} \
879- -c shared_buffers=1GB \
880- -c work_mem=1GB \
890+ -c shared_buffers=2GB \
881891 -c effective_cache_size=1GB \
892+ -c work_mem=8MB \
882893 -c max_connections=1000 \
883894 -c fsync=off \
884895 -c synchronous_commit=off \
You can’t perform that action at this time.
0 commit comments