Skip to content

Conversation

@DurvalMenezes
Copy link

@DurvalMenezes DurvalMenezes commented Apr 10, 2020

As discussed on the mailing list: https://zfsonlinux.topicbox.com/groups/zfs-discuss/T2aca1048f5a31bb8/zfsarcmetalimitpercent-a-report-and-some-ideas-for-improvement-was-re-zfs-discuss-pmis-and-pm-in-arcstat-tuning

TL;DR: the idea is to avoid non-intuitivelly wasting up to 25% of ARC in workloads with less than 25% of "interesting" data (meaning data that would enhance performance to be kept in the ARC instead of getting evicted by more-recently-used / more-frequently-used metadata). This wastage is total when primarycache=metadata, but would also happen to any workload with less than 25% (relative to the ARC size) of "interesting" data.

By changing the zfs_arc_meta_limit_percent default to 100%, these situations are avoided, and the decision about what to keep in the ARC is left to the MRU/MFU algorithms; people with special workloads that would benefit from such a "data reservation" (ie, metadata limit) are still free to tweak this parameter accordingly (or if they already do, their tweak will just keep working)

Also, fixed a small English verb-conjugation mistake in the comment.

Signed-off-by: Durval Menezes zfssign@durval.com

Motivation and Context

Description

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

As discussed on the mailing list: https://zfsonlinux.topicbox.com/groups/zfs-discuss/T2aca1048f5a31bb8/zfsarcmetalimitpercent-a-report-and-some-ideas-for-improvement-was-re-zfs-discuss-pmis-and-pm-in-arcstat-tuning

TL;DR: the idea is to avoid inintuitivelly wasting 25% of ARC when people set primarycache=metadata. 

Also, fixed a small English verb-conjugation mistake in the comment.
@amotin
Copy link
Member

amotin commented Apr 10, 2020

And what abount absolute majority of people not using primarycache=metadata? I suppose the tunable was added for a reason. This looks to me you are optimizing default for single very specific use case.

@DurvalMenezes
Copy link
Author

DurvalMenezes commented Apr 10, 2020

Hello @amotin.

And what amount [about the] absolute majority of people not using primarycache=metadata? I suppose the tunable was added for a reason. This looks to me you are optimizing default for single very specific use case.

It's not only people who have set primary=metadata (in which case the wastage would be total), but also anyone whose workload has less than 25% of "interesting" data (meaning data that would enhance performance to be kept in the ARC instead of getting evicted by more recently used / more frequently used metadata). I will update the PR description to reflect that.

That said, I think it's actually a matter of balancing:

(1) On one hand, wasting up to 25% of the ARC for everyone in the situation above.

(2) On the other hand, evicting possibly "more interesting" data from the ARC in favor of metadata; again, IIUC this would happen only when the metadata is more frequently/recently used than the data it's replacing.

I've never seen (and can't very well imagine) a case where (2) is true, but I have lived through a case where (1) was very true, and the default would have avoided me wasting countless hours on long-running backups while gigabytes of RAM were allocated to the ARC but unused nonetheless.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Apr 10, 2020
@codecov-io
Copy link

Codecov Report

Merging #10191 into master will decrease coverage by 13.44%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10191       +/-   ##
===========================================
- Coverage   79.40%   65.95%   -13.45%     
===========================================
  Files         385      304       -81     
  Lines      122603   105322    -17281     
===========================================
- Hits        97350    69467    -27883     
- Misses      25253    35855    +10602     
Flag Coverage Δ
#kernel ?
#user 65.95% <ø> (-0.60%) ⬇️
Impacted Files Coverage Δ
module/zfs/arc.c 75.87% <ø> (-8.26%) ⬇️
module/zfs/objlist.c 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/pathname.c 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_redact.h 0.00% <0.00%> (-100.00%) ⬇️
include/sys/dmu_traverse.h 0.00% <0.00%> (-100.00%) ⬇️
module/zfs/zfs_rlock.c 0.00% <0.00%> (-96.36%) ⬇️
module/lua/ltablib.c 2.34% <0.00%> (-95.32%) ⬇️
module/zfs/bqueue.c 0.00% <0.00%> (-94.45%) ⬇️
module/zcommon/zfs_deleg.c 0.00% <0.00%> (-92.46%) ⬇️
module/zfs/dmu_diff.c 0.00% <0.00%> (-87.88%) ⬇️
... and 235 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36a6e23...bc56ea5. Read the comment docs.

@snajpa
Copy link
Contributor

snajpa commented Jun 21, 2020

I think this should be relegated to userspace, perhaps the ZED? I like the idea of Red Hat's tuned(8) - we could detect, whether the only thing the system is doing is just metadata work and then tune the zfs_arc_meta_limit_percent accordingly.

It would also enable faster innovation in the heuristic algorithms, as developing pure userspace is way easier (though userspace C is I'd say more hostile to the developer, but that's another issue 😄 - but hey, there already is Lua interpreter in the project...)

@vaclavskala
Copy link
Contributor

When #14359 was merged, this PR can be closed.

@amotin amotin closed this Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Code Review Needed Ready for review and testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants