Unnecessarily high disk I/O caused by json_temp files
Stack Trace or error message
siad should only write to state files when something relevant changes.
siad updates some files periodically, regardless of changes, resulting in high disk I/O.
For example, I run a host with very low load and
siad alone causes permanently more than 250 KiB/s write I/O. This does not sound like much, but it seems that this disk traffic is also actively
fsync()ed, disrupting sequential read/write performance of the disk.
inotifywait -m to monitor file access operations done by
siad and get the following output more than once per second:
host/contractmanager/ CREATE contractmanager.json_temp host/contractmanager/ OPEN contractmanager.json_temp host/contractmanager/ MODIFY contractmanager.json_temp host/contractmanager/ MODIFY contractmanager.json_temp host/contractmanager/ CLOSE_WRITE,CLOSE contractmanager.json_temp host/contractmanager/ MOVED_FROM contractmanager.json_temp host/contractmanager/ MOVED_TO contractmanager.json
contractmanager.json is a 200 KiB file.
When I compare two versions of that file copied out with some writes in between, the order of the JSON entries is different, but, when sorted, the content is identical.
I'd therefore suggest to only write the files if something has actually changed since the last write.
I think I also saw this effect for other Could not reproduce it for other files on an idle renter (synced, wallet unlocked, allowance=0).
.json_temp files on a renter-only node. I'll check for the names.
How to reproduce it
- Open a shell in the sia data folder.
inotifywait -mr .and watch for periodic writes to
- Sia version: 220.127.116.11
- OS: Linux