diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ecdd88815..9ccb4226be 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -383,13 +383,21 @@ jobs: if: ${{ matrix.job.postgres-version }} # 1. Mount postgres data files onto a tmpfs in-memory filesystem to reduce overhead of docker's overlayfs layer. # 2. Expose the unix socket for postgres. This removes latency of using docker-proxy for connections. + # 3. We disable crash-safety features for speed: fsync, synchronous commits, full-page writes. + # Note: synchronous commits are enabled/disabled at runtime by Synapse, so there is also + # code in `tests/server.py` to configure this as off. run: | docker run -d -p 5432:5432 \ - --tmpfs /var/lib/postgres:rw,size=6144m \ + --tmpfs /var/lib/postgresql:rw,size=6144m \ --mount 'type=bind,src=/var/run/postgresql,dst=/var/run/postgresql' \ -e POSTGRES_PASSWORD=postgres \ -e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \ - postgres:${{ matrix.job.postgres-version }} + postgres:${{ matrix.job.postgres-version }} \ + -c fsync=off \ + -c synchronous_commit=off \ + -c full_page_writes=off \ + -c wal_level=minimal \ + -c max_wal_senders=0 - name: Install Rust uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master diff --git a/docker/complement/conf/postgres.supervisord.conf b/docker/complement/conf/postgres.supervisord.conf index 657845dfdb..e48921236f 100644 --- a/docker/complement/conf/postgres.supervisord.conf +++ b/docker/complement/conf/postgres.supervisord.conf @@ -1,5 +1,11 @@ [program:postgres] +# Disable crash-safety features for speed: fsync, synchronous commit, full page writes command=/usr/local/bin/prefix-log gosu postgres postgres + -c fsync=off + -c synchronous_commit=off + -c full_page_writes=off + -c wal_level=minimal + -c max_wal_senders=0 # Only start if START_POSTGRES=true autostart=%(ENV_START_POSTGRES)s