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

cache-size-mb只涉及到内存写入缓存,不能设置读取缓存?所有上传经过硬盘导致io高负载 #818

Closed
1265578519 opened this issue Jan 17, 2019 · 8 comments

Comments

@1265578519
Copy link

1265578519 commented Jan 17, 2019

cache-size-mb只涉及到内存写入缓存,不能设置读取缓存?所有上传经过硬盘导致io高负载
我查看了配置文件,都没有详细说明读取缓存
https://github.com/transmission/transmission/wiki/Editing-Configuration-Files

1
2
3
4

监控也很明显的,全走磁盘,不经过内存
1

@1265578519
Copy link
Author

版本 2.84

@mc256
Copy link

mc256 commented Jan 30, 2019

Translate:
cache-size-mb can merely set the writing buffer but make no controls on reading buffer, which makes seeding a problem.

The user @1265578519 wants to configure the reading buffer so that the program can load the entire file to memory for seeding purpose.

@mc256
Copy link

mc256 commented Jan 30, 2019

版本 2.84

发英文比较好

@xavery
Copy link
Contributor

xavery commented Jan 30, 2019

cache-size-mb is only used for (re-)calculating the hashes. It is not used for I/O during peer messages at all. If you grep through the code, the only references to tr_cache{Read,Prefetch}Block that you're going to find come from functions which are used for calculating hashes for the torrent's pieces. The cache is filled while the pieces are received from peers (presumably for recalculating the hash when the torrent is completed, though I haven't checked that in depth), but isn't used at all when sending data to them.
The only form of caching used while sending data to peers is POSIX's fadvise call. Transmission does not appear to use any form of internal caching in this case.
It seems like the meaning of this configuration key is very widely misunderstood. I wish there was a wiki page or something that users can be pointed to in order to familiarise themselves with what cache-size-mb actually does, or, more importantly, what it doesn't do.

@1265578519
Copy link
Author

@xavery 我认为,他是确实有写入缓存的,因为你尝试修改值,然后进行下载操作,你会发现,在设置的值内,不会写入硬盘,都存在内存中。
如果达到内存值满了,才会进行一次硬盘的写入操作。

@xavery
Copy link
Contributor

xavery commented Jan 30, 2019

@1265578519 You're welcome to open the code and prove me wrong. I'm just sharing my own experiences, since I've looked into this before.

@mc256
Copy link

mc256 commented Jan 30, 2019

I would suggest closing this issue. This is not a programming issue.
The wiki page might need to be updated.

@Shados
Copy link

Shados commented Jan 5, 2022

cache-size-mb is only used for (re-)calculating the hashes. It is not used for I/O during peer messages at all. If you grep through the code, the only references to tr_cache{Read,Prefetch}Block that you're going to find come from functions which are used for calculating hashes for the torrent's pieces. The cache is filled while the pieces are received from peers (presumably for recalculating the hash when the torrent is completed, though I haven't checked that in depth), but isn't used at all when sending data to them. The only form of caching used while sending data to peers is POSIX's fadvise call. Transmission does not appear to use any form of internal caching in this case. It seems like the meaning of this configuration key is very widely misunderstood. I wish there was a wiki page or something that users can be pointed to in order to familiarise themselves with what cache-size-mb actually does, or, more importantly, what it doesn't do.

For anyone looking into cache-size-mb behaviour: the quoted comment was incorrect at the time of writing, and still is. I'm not sure how the OP missed it, but the cache was and is used for both prefetching and reading blocks in response to peer messages, since right back from its initial implementation in 2010 (look at the diff for libtransmission/peer-msgs.c).

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

No branches or pull requests

5 participants