Backups: the archive is gzipped at level 9, which costs about 45% more CPU on the database than level 6 for 4% less size #1124
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#1124
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What exists today
src/postulo/core/backup.py:548writes the archive withtarfile.open(path, "w:gz"), whosecompressleveldefaults to 9. The archive holds the SQLite copy (database.sqlite3, made with SQLite's backup API, lines 327-330), the media tree and the plugins directory (lines 553-556).Measured with
zlib.compressat levels 1, 6 and 9 (python -I, this machine):jobs/data/geonames-cities1000.sqlite)data/postulo.sqlite3Correction to the scout: the cost is not "level 9 over already-compressed media". On data that does not compress, deflate at level 9 is no slower than level 6 (593 against 678 ms). The extra cost of level 9 is on the database, where it is about 45% more time for 3.6% less size. Level 1 is faster still but expands incompressible media by 5% and leaves the database 16% larger than level 6, so it is not recommended.
What would change
tarfile.open(path, "w:gz", compresslevel=6). Reading is unchanged (gzip decompression does not depend on the level), so older archives,verify_backup, restore and the offsite copy are untouched, and the archive format number does not change. A modern alternative (zstd) would need Python 3.14'scompression.zstdor a new dependency and a new archive format; not worth it for this.What it saves or protects
small: about a third less compression time on the database part of every backup (measured 1.36 s at level 9 against 0.94 s at level 6 on a 30 MB SQLite file), for archives about 4% larger on that part and no different on media
Accessibility
none
Decided by the maintainer (2026-10-31)
backups at gzip level 6, a constant
Decisions
Found by the efficiency and reliability audit of 2026-10-30 (finding D4; index postulo/postulo#1108). Checked against
mainatdaee30b15(2026-10-30).