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

Provide cache statistics #262

Draft
wants to merge 8 commits into
base: v0.11.x
Choose a base branch
from
Draft

Provide cache statistics #262

wants to merge 8 commits into from

Conversation

tatsuya6502
Copy link
Member


Fixes #234.

- Add the `stats` module with the `CacheStats` and `StatsCounter`s.
- Update the `sync::Cache` and `future::Cache` to record some of the stats such as
  hit count, load success count and time.
@tatsuya6502 tatsuya6502 added this to the Backlog milestone May 4, 2023
- Update the `sync::Cache`, `sync::SegmentedCache` and `future::Cache` to record the
  rest of the stats.
- Add unit tests to `sync::Cache` and `future::Cache`.
@tatsuya6502 tatsuya6502 self-assigned this May 4, 2023
@tatsuya6502 tatsuya6502 added the enhancement New feature or request label May 4, 2023
Fix test failures in non-quanta environment.
- In order to make `StatsCounter` implementors to return arbitrary cache stats type,
  add a generic parameter `CS` (cache stats) to the cache, cache builder and entry
  selector structs.
    - This change will not break existing user codes because `CS` has a default type
      of `CacheStats`.
- Add the following methods to the `CacheBuilder`:
    - `enable_stats`
    - `stats_counter`
- Add more statistics.
- Refactoring: Create `cache_stats` and `stats_counter` modules under `stats` module,
  move a trait and structs around, and rename some structs.
- Add `DetailedCacheStats` and `DetailedStatsCounter` structs.
Avoid measuring time if the configured stats counter does not record
the time.
- Add more stats to `DetailedCacheStats`.
- Performance: Make batch calls on `record_hits` and `record_misses` methods when
  possible.
@tatsuya6502 tatsuya6502 changed the base branch from main to v0.11.x January 11, 2024 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Statistics for metrics
1 participant