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

feat: bypass disk wirte cache when cache-size-mb is zero #5668

Merged
merged 10 commits into from
Jun 28, 2023

Conversation

tearfur
Copy link
Member

@tearfur tearfur commented Jun 26, 2023

Idea and rationale from #5667 (comment).

@Pentaphon
Copy link

Have you done any performance tests with write cache disabled? Any benefit to disabing it or simply making sure that "0" actually disables cache as we would expect?

@tearfur
Copy link
Member Author

tearfur commented Jun 26, 2023

My theory is this is probably only helpful to those whose filesystem has its own cache layer to group up transactions. Will have to wait for @blind-oracle's results since he has a filesystem with a cache layer.

Disabling the cache was trivial enough that I am confident it works. But I am not able to test it right now.

@tearfur tearfur changed the title Set "cache-size-mb": 0 to disable write cache Set "cache-size-mb": 0 to bypass write cache Jun 26, 2023
@tearfur tearfur marked this pull request as draft June 26, 2023 08:48
@blind-oracle
Copy link

I did the test - it seems to help, the speed was closer to 1Gbit/s most of time, but still I can't really go over that much (some 1.1Gbit/s max). The daemon hits 100% and there it stays.

Here's the graph, though it was taken with release flags and might be not very usable. But anyway it seems that the cache is now mostly no-op which is good.

trans

@tearfur
Copy link
Member Author

tearfur commented Jun 26, 2023

@blind-oracle Nice. 20-30% improvement is a big improvement. But we better compare Debug build with Debug build to be fair.

When you say your CPU is at 100%, do you mean all cores, or just 1?

Looking at your other flame graphs, the other big part is the arc4 cipher. Can you generate another flame graph with encryption disabled? I want to identify the remaining parts that are eating up resources.

@blind-oracle
Copy link

blind-oracle commented Jun 26, 2023

@tearfur

Sure, I can do debug, but it's very slow there. I'll try.

When I say 100% I mean one core. I don't think that transmission can effectively use several cores... at least I never saw >100% cpu usage.

About encryption - I don't think you can disable it, at least the lowest level for it is Tolarable. Hard to say what this means, probably it won't initiate encrypted sessions, but would accept ones?

@tearfur
Copy link
Member Author

tearfur commented Jun 26, 2023

When I say 100% I mean one core. I don't think that transmission can effectively use several cores... at least I never saw >100% cpu usage.

Yeah Transmission is mostly single threaded.

About encryption - I don't think you can disable it, at least the lowest level for it is Tolarable. Hard to say what this means, probably it won't initiate encrypted sessions, but would accept ones?

Sure, just set it to Tolerable to get rid of as much arc4 CPU time as possible.

@blind-oracle
Copy link

Yeah Transmission is mostly single threaded.

Which is sad, a thread-per-torrent would be quite efficient I guess, they don't really need to share any state.

Here's the graph for debug build & tolerated encryption.
For debug build disabling the cache is visible most significantly - speed went up from 4-5MB/s to 20-30MB/s.

ARC4 is still there, but only around 5% of samples.
trans_debug

@tearfur tearfur marked this pull request as ready for review June 26, 2023 12:48
@ckerr
Copy link
Member

ckerr commented Jun 26, 2023

commented @ #5667 (comment)

@ckerr
Copy link
Member

ckerr commented Jun 27, 2023

Just as a side thought, it's very cool that hotspot exports flame graphs svgs that include mouseover text for each slice. That is super useful

@blind-oracle
Copy link

@ckerr these particular graphs were made by flamegraph-rs since hotspot is Linux-only GUI and I don't really have any Linux desktop around...

@ckerr
Copy link
Member

ckerr commented Jun 27, 2023

@blind-oracle TIL about flamegraph-rs, thanks for the info! That is really handy

@tearfur
Copy link
Member Author

tearfur commented Jun 28, 2023

Just as a side thought, it's very cool that hotspot exports flame graphs svgs that include mouseover text for each slice. That is super useful

I agree, they have been very useful. 😁

@ckerr ckerr added type:feat A new feature semver:minor adds functionality in a backwards compatible manner scope:core labels Jun 28, 2023
@ckerr ckerr added this to the 4.1.0 milestone Jun 28, 2023
@ckerr
Copy link
Member

ckerr commented Jun 28, 2023

Notes: Setting "cache-size-mb": 0 in settings.json now disables the disk write cache.

@ckerr ckerr merged commit 6bbe653 into transmission:main Jun 28, 2023
21 checks passed
@ckerr ckerr changed the title Set "cache-size-mb": 0 to bypass write cache feat: bypass disk wirte cache when cache-size-mb is zero Jun 28, 2023
@tearfur tearfur deleted the disable-cache branch June 28, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:core semver:minor adds functionality in a backwards compatible manner type:feat A new feature
Development

Successfully merging this pull request may close these issues.

None yet

4 participants