File tree 1 file changed +13
-2
lines changed
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
864
864
# NOTE: we set --memory to the same size as a GitHub runner.
865
865
test-postgres-docker :
866
866
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
867
878
docker run \
868
879
--env POSTGRES_PASSWORD=postgres \
869
880
--env POSTGRES_USER=postgres \
@@ -876,9 +887,9 @@ test-postgres-docker:
876
887
--detach \
877
888
--memory 16GB \
878
889
gcr.io/coder-dev-1/postgres:${POSTGRES_VERSION} \
879
- -c shared_buffers=1GB \
880
- -c work_mem=1GB \
890
+ -c shared_buffers=2GB \
881
891
-c effective_cache_size=1GB \
892
+ -c work_mem=8MB \
882
893
-c max_connections=1000 \
883
894
-c fsync=off \
884
895
-c synchronous_commit=off \
You can’t perform that action at this time.
0 commit comments