-
-
Notifications
You must be signed in to change notification settings - Fork 150
Description
These days, a lot of people are on solid-state-only systems and may wish to conserve NAND writes. I measured haveno-reto v1.0.17 (current) running with the default --maxConnections=12 consistently writing 1.2GB per hour (28.8 GB/day), when little or none of this actually needs to be written through to the disk. With --maxConnections=300, it gets around 80-110 connections and writes at ~1.42 GB/h.
Measurement and workaround:
du -sh
reports the Haveno data folder (.local/share/Haveno-reto) occupying only 188M of disk. A compressed ramdisk can easily be set up to hold this:
$ mv Haveno-reto Hr
$ sudo zramctl --find --size 300M # try --algorithm zstd if you have support for it
$ sudo mkfs.ext2 -i 65536 -m 0 /dev/zram1 # substitute the zram device name you got
$ mkdir Haveno-reto
$ sudo mount -o discard /dev/zram1 Haveno-reto # -o discard is essential so zram will be informed about freed blocks
$ sudo chown <youruser>:<youruser> Haveno-reto
$ rsync -axXH Hr/ Haveno-reto
Since all the data is being written to a separate device, it can easily be measured with e.g. iostat -h
.
Also add AvoidDiskWrites 1
to your torrc if you're trying to economize on disk writes.
You can find the list of all the things AvoidDiskWrites affects on tor's gitlab:
https://gitlab.torproject.org/tpo/core/tor/-/issues/31507
The state can be copied back to the disk from the ramdisk with,
$ rsync -axXH --delete --exclude /lost+found/ --info=progress2 ~/.local/share/Haveno-reto/ ~/.local/share/Hr
No matter how many hours it's been running for and gigs it's written, if you haven't added any trades or other state this syncs only about 32MB.
If you don't have any open trades or offers listed and are just running to watch the network, you don't really have to sync the data to disk at all.
It would be nice to have a toggle which keeps all the constant mumbling in RAM (using the default lzo-rle compression algorithm, the ramdisk occupies only ~116M) and immediately writes through to the disk only essential state changes, like creating a new hidden service, wallet, payment method or trade, trade state changes and new trade chat messages, with the rest of it flushed at a user-configurable interval and on shutdown.