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: unify foyer in-memory cache and disk cache #391

Merged
merged 3 commits into from
Apr 21, 2024
Merged

feat: unify foyer in-memory cache and disk cache #391

merged 3 commits into from
Apr 21, 2024

Conversation

MrCroxx
Copy link
Collaborator

@MrCroxx MrCroxx commented Apr 21, 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

All-in-one builder example (with all args):

let hybrid: HybridCache<u64, Arc<String>> = HybridCacheBuilder::new()
        .memory(1024)
        .with_shards(4)
        .with_eviction_config(LruConfig {
            high_priority_pool_ratio: 0.1,
        })
        .with_object_pool_capacity(1024)
        .with_hash_builder(ahash::RandomState::default())
        .with_weighter(|_key, value: &Arc<String>| value.len())
        .storage()
        .with_name("foyer")
        .with_eviction_config(LfuConfig {
            window_capacity_ratio: 0.1,
            protected_capacity_ratio: 0.8,
            cmsketch_eps: 0.001,
            cmsketch_confidence: 0.9,
        })
        .with_device_config(
            FsDeviceConfigBuilder::new(dir.path())
                .with_capacity(64 * 1024 * 1024)
                .with_file_size(4 * 1024 * 1024)
                .with_align(4 * 1024)
                .with_io_size(16 * 1024)
                .build(),
        )
        .with_catalog_shards(4)
        .with_admission_policy(Arc::new(RatedTicketAdmissionPolicy::new(10 * 1024 * 1024)))
        .with_reinsertion_policy(Arc::new(RatedTicketReinsertionPolicy::new(10 * 1024 * 1024)))
        .with_flushers(2)
        .with_reclaimers(2)
        .with_clean_region_threshold(2)
        .with_recover_concurrency(4)
        .with_compression(foyer::Compression::Lz4)
        .with_runtime_config(
            RuntimeConfigBuilder::new()
                .with_thread_name("foyer")
                .with_worker_threads(4)
                .build(),
        )
        .with_lazy(true)
        .build()
        .await?;

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)

#327

Signed-off-by: MrCroxx <mrcroxx@outlook.com>
@MrCroxx MrCroxx added feature New feature or request refactor labels Apr 21, 2024
@MrCroxx MrCroxx self-assigned this Apr 21, 2024
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
Copy link

codecov bot commented Apr 21, 2024

Codecov Report

Attention: Patch coverage is 81.07143% with 53 lines in your changes are missing coverage. Please review.

Project coverage is 80.65%. Comparing base (23bff43) to head (204d82d).

Files Patch % Lines
foyer/src/hybrid.rs 79.43% 51 Missing ⚠️
foyer-storage/src/reinsertion/exist.rs 0.00% 1 Missing ⚠️
foyer-storage/src/store.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #391      +/-   ##
==========================================
+ Coverage   77.76%   80.65%   +2.88%     
==========================================
  Files          51       52       +1     
  Lines        6423     6668     +245     
==========================================
+ Hits         4995     5378     +383     
+ Misses       1428     1290     -138     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: MrCroxx <mrcroxx@outlook.com>
@MrCroxx MrCroxx merged commit f2df49f into main Apr 21, 2024
13 checks passed
@MrCroxx MrCroxx deleted the xx/foyer branch April 21, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request refactor
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant