Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rqbit spends significant disk I/O to save DHT cache #310

Open
izderadicka opened this issue Jan 20, 2025 · 2 comments
Open

rqbit spends significant disk I/O to save DHT cache #310

izderadicka opened this issue Jan 20, 2025 · 2 comments

Comments

@izderadicka
Copy link
Contributor

I'm running rqbit on linux "server" as service (using latest Docker image] and I see significant disk I/O related to rqbit, even if nothing is "happening" - no active torrents.

Command is simple/default: /bin/rqbit server start /home/rqbit/downloads
rqbit is far most active process for disk IO - disk writes - see iotop - accumulated over 10 secs:

    PID  PRIO  USER     DISK READ DISK WRITE>    COMMAND                                                                                            
2528676 be/4 root          0.00 B   2021.00 K rqbit server start /home/rqbit/downloads
    371 be/3 root          0.00 B    356.00 K systemd-journald
   3261 be/4 999           0.00 B     46.00 K postgres: stats collector process

with iostat it looks like ongoing write is about 200 KB/s continuously

Looking with strace what's going on:

$ sudo strace -p 2528676 -f -e trace=file,write 
strace: Process 2528676 attached with 6 threads
[pid 2528698] open("/home/rqbit/cache/com.rqbit.dht/dht.json.tmp.1", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE|O_CLOEXEC, 0666) = 19
[pid 2528698] write(19, "{\"addr\":\"0.0.0.0:55022\",\"table\":"..., 8163) = 8163
[pid 2528698] write(19, "3caad6911d8e95475da6a6dc498ab3d8"..., 8191) = 8191
...
[pid 2528698] rename("/home/rqbit/cache/com.rqbit.dht/dht.json.tmp.1", "/home/rqbit/cache/com.rqbit.dht/dht.json") = 0
[pid 2528698] write(19, "2d721ae6fa4a2a24f2bd3e1886e91371"..., 315) = 315
...

File /home/rqbit/cache/com.rqbit.dht/dht.json is rewritten every ~ 3 second. Size of file is ~ 200 KB.

And this generates notable load to disks.

I have not looked for CLI options, if it can be disabled - will look, but as default option it seem to me bit aggressive from disk IO perspective.

@izderadicka
Copy link
Contributor Author

indeed this option solves problem:

 --disable-dht-persistence
          Set this to disable DHT reading and storing it's state. For now this is a useful workaround if you want to launch multiple rqbit instances, otherwise DHT port will conflict

          [env: RQBIT_DHT_PERSISTENCE_DISABLE=]

However I would line DHT persistance - with some much more "reasonable" storage period - ideally store on program exit on SIGTERM, or with some much longer, configurable period - like 1h

@ikatson
Copy link
Owner

ikatson commented Jan 20, 2025

Thanks for reporting definitely smth worth optimizing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants