Short version: on hashstore, a large part of the random read IO on an HDD comes from the hash table, not from piece data. If you can move the table off the spinning disk, your HDD has a more headroom for real customer traffic. There are two ways to do that:
- memtbl: the table lives in RAM. Fastest, but it needs a lot of memory.
- hashtbl on an SSD:
hashstore.table-pathputs the tables on another disk. This needs very little RAM, and you probably already have an SSD for the OS.
I tested both on my own nodes (2 Raspberry Pis with 8 GB RAM, 16–18 TB HDDs, NVMe SSD for the OS).
Test setup
- One HDD got the change. A second HDD on the same Pi with similar nodes stayed unchanged as the control.
- Before the change, I measured the ratio between the two disks for a week, so the results below are compared against that baseline and not just raw numbers.
Result: hashtbl on SSD
Ratio of test disk to control disk (below 1.0 means the test disk does less):
| metric | before (7-day baseline) | after moving tables to SSD | change |
|---|---|---|---|
| disk utilization | 1.13 | ~0.60 | about −45% |
| read ops/s | 1.03 | ~0.62 | about −40% |
| read latency (r_await) | 1.23 | ~0.75 | about −40% |
In absolute numbers the test disk went from about the same load as the control (~55–65% busy) to 30–43% while the control stayed at 53–65%. Time to first byte for downloads was about the same on average and slightly better at p90. The bigger gain is the headroom the HDD gets back, which matters most during compaction, garbage collection and busy upload hours.
After that I moved the tables of all of my nodes to the SSDs.
Result: memtbl
memtbl removes the table IO just like the SSD does, and lookups are even faster. The problem is RAM:
- I measured 21–34 bytes of RAM per piece, which works out to about 0.3–0.4 GB of RAM per TB stored.
- A full 9 TB node needs about 3–3.5 GB of RAM just for the tables.
- A Pi with four full 16 TB disks would need 20–25 GB of RAM.
On 8 GB Pis this ended in swapping after only about a third of the tables were converted, so I stopped the test. If you have the RAM (for example a small number of nodes on a machine with 32+ GB), memtbl is the best option. For everyone else, the SSD is the practical way.
How much SSD space you need
The tables are small compared to the data: about 0.7 GB per TB stored. A full 9 TB node has about 6 GB of tables. All of my nodes together use well under 100 GB on the SSDs.
How to move the tables to an SSD
Per node, with the node stopped:
- Copy every
storage/hashstore/<satellite>/s0/metaand.../s1/metafolder to the new location, keeping the same structure:<table-path>/<satellite>/s0/meta,<table-path>/<satellite>/s1/meta. - Add
hashstore.table-path: /path/on/ssd/node1to config.yaml. Use an absolute path, and a separate folder for each node. - Start the node. Check the log and check that the node holds files open under the new path.
Notes:
- The node-level
storage/hashstore/metafolder (bloom filter, migration state) stays where it is. Only the per-satellites0/metaands1/metafolders move. - If the path is wrong, the node refuses to start with “missing hashtbl” instead of starting empty. That is a good safety net.
- Downtime per node was 2 seconds to about 5 minutes, depending on table size and how busy the HDD was.
- Keep the old folders (I renamed them to
meta.pre-ssd) for a few days, then delete them. Once compaction has run, they are outdated and can’t be used to roll back.
Risks
- If the SSD dies, the tables are gone. The data in the logs is still on the HDD, and the tables can be rebuilt from the logs (
write-hashtbl), but that takes time and the node is offline meanwhile. Put the tables on an SSD you trust, not a cheap USB stick. - If the OS and the tables share the SSD, keep an eye on free space and wear. Compaction rewrites the table each time it runs.
If you run hashstore nodes on HDDs and have an SSD in the machine anyway, I think this is one of the cheapest performance improvements available right now. I’d be interested in numbers from other setups, especially from people who run memtbl on machines with enough RAM.