Compress WAL file
Another WAL related question: Is it expected to grow really fast? I don't scrape a lot of metrics (I'd guess 1000 metrics / 15s), but after 2 minutes the WAL file has already reached 11MB in file size.
Originally posted by @weeco in https://github.com/nakabonne/tstorage/issues/37#issuecomment-955668821
As noticed in the referenced issue the WAL file gets really big quickly. I wanted to create a separate issue for this to possibly introduce a more compressed way how the WAL file is written.
Maybe you can recommend a workaround to reduce the size of the WAL file. I assume smaller partitions could help with that?
Thank you for the separated issue for that!
To be honest, the current WAL format prioritizes simplicity. I'm in the middle of looking for another format that reduces the size and doesn't slow down writing and recovery.
Originally posted by @nakabonne in https://github.com/nakabonne/tstorage/issues/37#issuecomment-955685599
Maybe you can recommend a workaround to reduce the size of the WAL file. I assume smaller partitions could help with that?
As you mentioned, the smaller the size of the partition, the smaller the size per file. But in the end, your overall disk consumption will remain the same.
But in the end, your overall disk consumption will remain the same.
Is that actually the case? If the lifetime of the WAL file is up to partitionRetention before it is rolled, we can reduce the max wal file size by reducing the partition retention as well right?
Since the WAL file is relatively large (compared to the disk files) it could be worth to reduce the partition retention is that right?
Ah, you're right.
That workaround works well since all except for the first two partitions will be flushed to disk partitions and the WAL files for them will be deleted 👍
Just to add some numbers:
My 1h partition is 16MB in size and 2 WAL files take 1GB space.
Hmm... it is common to set PartitionDuration=1h so it's terrible to require 1GB for WAL.