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: simplify foyer in-memory cache framework #785

Merged
merged 35 commits into from
Nov 19, 2024
Merged

feat: simplify foyer in-memory cache framework #785

merged 35 commits into from
Nov 19, 2024

Conversation

MrCroxx
Copy link
Collaborator

@MrCroxx MrCroxx commented Nov 12, 2024

What's changed and what's your intention?

Please explain IN DETAIL what the changes are in this PR and why they are needed. :D

  • Allow "get"/"release"/"entry drop" to acquire read lock or lock-free if the algorithm allows.
  • Make most Eviction APIs safe, only acquire unsafe Rust while accessing algorithm managed per-entry state with UnsafeCell.
  • Replace the "reinsertion" design with release with real "release last ref" design.
  • Rename some APIs.

Checklist

  • I have written the necessary rustdoc comments
  • I have added the necessary unit tests and integration tests
  • I have passed make all (or make fast instead if the old tests are not modified) in my local environment.

Related issues or PRs (optional)

close #779 (not adopt the RFC)

- Cloning and dropping cache entry no longer requires locking (ref > 0).
- Use rwlock for cache eviction algorighm without mutable acquire op.
- Use slab to replace object pool optimization.
- Refine abstractions.

Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
Signed-off-by: MrCroxx <[email protected]>
@MrCroxx MrCroxx added feature New feature or request refactor perf Performance optimization labels Nov 12, 2024
@MrCroxx MrCroxx added this to the v0.13 milestone Nov 12, 2024
@MrCroxx MrCroxx self-assigned this Nov 12, 2024
Signed-off-by: MrCroxx <[email protected]>
@MrCroxx MrCroxx changed the title Xx/framework feat: simplify foyer in-memory cache framework Nov 12, 2024
Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 84.32686% with 234 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
foyer-memory/src/eviction/lfu.rs 84.36% 53 Missing ⚠️
foyer-memory/src/record.rs 63.26% 36 Missing ⚠️
foyer-memory/src/raw.rs 88.23% 34 Missing ⚠️
foyer-memory/src/eviction/lru.rs 90.20% 29 Missing ⚠️
foyer-memory/src/eviction/s3fifo.rs 86.05% 29 Missing ⚠️
foyer-memory/src/cache.rs 57.89% 16 Missing ⚠️
foyer-memory/src/eviction/fifo.rs 83.13% 14 Missing ⚠️
foyer-common/src/scope.rs 36.84% 12 Missing ⚠️
foyer-common/src/option.rs 0.00% 8 Missing ⚠️
foyer-common/src/event.rs 0.00% 1 Missing ⚠️
... and 2 more
Files with missing lines Coverage Δ
foyer-memory/src/eviction/mod.rs 100.00% <100.00%> (ø)
foyer-memory/src/eviction/test_utils.rs 100.00% <100.00%> (ø)
foyer-memory/src/indexer/hash_table.rs 100.00% <100.00%> (ø)
foyer-storage/src/large/generic.rs 88.85% <100.00%> (+0.03%) ⬆️
foyer-storage/src/small/bloom_filter.rs 99.00% <100.00%> (+0.01%) ⬆️
foyer-storage/src/small/generic.rs 76.21% <100.00%> (+1.07%) ⬆️
foyer-storage/src/small/set_manager.rs 90.34% <100.00%> (+0.05%) ⬆️
foyer-storage/src/test_utils.rs 90.47% <100.00%> (+2.01%) ⬆️
foyer/src/hybrid/builder.rs 94.90% <ø> (-0.25%) ⬇️
foyer/src/hybrid/cache.rs 82.33% <100.00%> (ø)
... and 13 more

... and 3 files with indirect coverage changes


🚨 Try these New Features:

Signed-off-by: MrCroxx <[email protected]>
@MrCroxx
Copy link
Collaborator Author

MrCroxx commented Nov 15, 2024

image

@MrCroxx
Copy link
Collaborator Author

MrCroxx commented Nov 19, 2024

@MrCroxx MrCroxx merged commit 66a1d91 into main Nov 19, 2024
22 of 23 checks passed
@MrCroxx MrCroxx deleted the xx/framework branch November 19, 2024 05:53
@MrCroxx MrCroxx restored the xx/framework branch November 19, 2024 05:53
@MrCroxx MrCroxx mentioned this pull request Nov 26, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request perf Performance optimization refactor
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

RFC: use atomic reference count to track external in-memory cache record usage
1 participant