Remediation Hub (9)
Run rust-synapse-compress-state Weekly Cron to Shrink Postgres
Automated weekly state compression deduplicates redundant room state trees in Postgres without taking your Synapse homeserver offline.
Disk Reclaimed: 60-80% of state_groups_state | Tool: synapse_auto_compressor
Step 1: Run synapse_auto_compressor in Bounded Batches
Install synapse_auto_compressor (the Rust state compressor) and run it with -c 500 -n 100 against your Postgres connection string. Batching 500 chunks of 100 state groups keeps lock contention minimal while rewriting bloated state pointers.
Step 2: Reclaim Physical NVMe Blocks via VACUUM
Because PostgreSQL marks deleted state_groups_state rows as reusable rather than shrinking files on disk, run standard VACUUM ANALYZE weekly to stop growth, or schedule a brief maintenance window for pg_repack / VACUUM FULL to return gigabytes to the OS.
Measured Thresholds & Configuration
| Compression Flag | Recommended Value | Operational Effect |
|---|---|---|
| -c (chunk_size) | 500 | Caps per-transaction memory and lock hold |
| -n (chunks_to_compress) | 100 - 250 | Safe weekly cron pace without IOPS spikes |
| Post-Run Postgres Action | VACUUM ANALYZE (or pg_repack) | Frees dead tuples without table lock |