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

Improve caching #19130

Merged
merged 2 commits into from Feb 26, 2024
Merged

Improve caching #19130

merged 2 commits into from Feb 26, 2024

Conversation

klauspost
Copy link
Contributor

Description

  • Remove lock for cached operations.
  • Rename "Relax" to ReturnLastGood.
  • Add CacheError to allow caching values even on errors.
  • Add NoWait that will return current value with async fetching if within 2xTTL.
  • Make benchmark somewhat representative. Result with 1ms for both implementions:
Before: BenchmarkCache-12       16408370                63.12 ns/op            0 B/op
After:  BenchmarkCache-12       428282187                2.789 ns/op           0 B/op
  • Remove storageRESTClient.scanning. Nonsensical - RPC clients will not have any idea about scanning.
  • Always fetch remote diskinfo metrics and cache them. Seems most calls are requesting metrics.
  • Do async fetching of usage caches.

How to test this PR?

Regular operation.

Types of changes

  • Optimization (provides speedup with no functional changes)

* Remove lock for cached operations.
* Rename "Relax" to `ReturnLastGood`.
* Add `CacheError` to allow caching values even on errors.
* Add NoWait that will return current value with async fetching if within 2xTTL.
* Make benchmark somewhat representative.

```
Before: BenchmarkCache-12       16408370                63.12 ns/op            0 B/op
After:  BenchmarkCache-12       428282187                2.789 ns/op           0 B/op
```

* Remove `storageRESTClient.scanning`. Nonsensical - RPC clients will not have any idea about scanning.
* Always fetch remote diskinfo metrics and cache them. Seems most calls are requesting metrics.
* Do async fetching of usage caches.
internal/cachevalue/cache.go Show resolved Hide resolved
internal/cachevalue/cache.go Show resolved Hide resolved
@harshavardhana harshavardhana merged commit 2b5e4b8 into minio:master Feb 26, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants