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

significant performance / usability regression from fdatasync(2) change #1313

Open
slingamn opened this issue Nov 12, 2024 · 1 comment
Open

Comments

@slingamn
Copy link
Contributor

d442793 added an fdatasync(2) for each metadata update. Each such operation can be quite slow on HDDs (I'm measuring them at 15-30 milliseconds per operation with strace -T). With two such operations per active torrent, and 1000 active torrents, the main thread (including the UI and all upload and download activity) will freeze for approximately a minute during the periodic session_save operation:

"schedule2 = session_save,1200,1200,((session.save))\n"

resulting in only 95% availability for the client, since the operation is scheduled every 20 minutes.

I'm wondering if there could be a better way to handle this? Some possible ideas that come to mind:

  1. Trigger sync(2) on a separate thread after all metadata updates are complete
  2. fdatasync(2) on individual files, but on a separate thread via some kind of message passing
  3. Make the file format more resilient to corruption (although that might not resolve all the concerns mentioned in jesec/rtorrent@f9a875b )

Thanks for your time.

@rakshasa
Copy link
Owner

The issue is that we need to wait for the files to be sync'ed before calling rename.

This makes it easy to fix the blocking issue as the rename can be done lazily in a separate thread.

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