Commit Graph

81 Commits (cf051e8091154bb8fe6ed7d2f0364bdddccee6eb)

Author SHA1 Message Date
Carol (Nichols || Goulding) d8d29bc4b4
fix: Reduce type complexity
As now caught by clippy. https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
2022-08-11 15:04:15 -04:00
Carol (Nichols || Goulding) b982bdaf2f
fix: Derive Eq when we derive PartialEq and members can derive Eq
Allow this in generated code that we don't control, though.

Recommended by clippy now. https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
2022-08-11 15:04:06 -04:00
Marco Neumann 26f3849191
feat: improve cache policies and their testing (#5375)
1. add GET support for the subscribers (this is needed so that
   TTL/refreshers and LRU systems "know" when a key was used)
2. improve multi-threading test to not rely on a wait loop but use a 2nd
   barrier instead
3. ensure that panics in the testing background thread are propagated
   and make the test fail
4. implement defaults for `Subscriber` methods to reduce boilerplate for
   implementators

Helps with #5320.
2022-08-11 13:53:22 +00:00
Marco Neumann 13f2a2ebc7
feat: new policy system for caches (#5370)
* feat: new policy system for caches

This is the framework part for the policy system outlined in #5320. It
does NOT port any existing policies (likely TTL, LRU and shared) over to
the new system. This will be a follow-up.

* docs: improve example

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-08-11 09:41:17 +00:00
Marco Neumann a8f6d579c8
feat: add metric for predicate-based cache entry removal (#5257) 2022-08-02 07:44:53 +00:00
Marco Neumann fec6b18d80
feat: add metric for TTL cache expiration (#5256)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-08-02 07:00:30 +00:00
dependabot[bot] fbd39844d8
chore(deps): Bump async-trait from 0.1.56 to 0.1.57 (#5247)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.56 to 0.1.57.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.56...0.1.57)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-01 08:30:33 +00:00
Marco Neumann b35502ce61
feat: cache tracing (#5164)
* feat: cache tracing

Add tracing to the metrics cache wrapper. The extra arguments for GET
and PEEK make this quite simple, because the wrapper can just extend the
inner args with the trace information.

We currently terminate the span in `querier::cache` (i.e. only pass in
`None`, so no tracing will occur) to keep this PR rather small. This
will be changed in subsequent PRs.

For #5129.

* fix: typo

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-21 11:54:22 +00:00
Marco Neumann 4e4c37d68c
refactor: improve cache system generic tests (#5163)
This prepares the test system for the usage of extra args for GET and
PEEK by pulling all generics and the whole interface into a single
trait. This is similar to how the write buffer tests work.

This is needed to introduce extra args into the metrics wrapper (i.e. to
pass down spans) while still being able to use the generic tests in a
follow-up PR. Overall this change is required for #5129.

The tests itself are unchanged.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-21 05:52:54 +00:00
Marco Neumann 3b8f98c7b8
feat: allow passing for extra arguments to `Cache::peek` (#5161)
This will be used to pass spans down to `CacheWithMetrics` (or a new
wrapper specific to tracing) and will help with #5129.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-20 13:51:21 +00:00
dependabot[bot] 9b67de2f43
chore(deps): Bump tokio from 1.19.2 to 1.20.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.19.2 to 1.20.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.19.2...tokio-1.20.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-14 01:21:43 +00:00
pierwill 500ece7c13
fix: Clean up docs for `addressable_heap` (#5092)
Removes an erroneous line and reworks one sentence for clarity.

Co-authored-by: pierwill <pierwill@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-11 19:31:38 +00:00
Marco Neumann 96da584139
test: do NOT create expensive bloom filters when we do not need them (#5089)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-11 16:29:53 +00:00
Marco Neumann cec169b7ca
feat: add "peek" functionality for caches (#5049)
Required for #5032.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-07-07 07:00:44 +00:00
Ryan Russell 106d84c6e1
chore: readability improvements (#4955)
* chore(arrow_util): readability improvements

Signed-off-by: Ryan Russell <git@ryanrussell.org>

* chore(tracker): readability improvements

Signed-off-by: Ryan Russell <git@ryanrussell.org>

* chore(cache_system): improve readability

Signed-off-by: Ryan Russell <git@ryanrussell.org>

* refactor(lru test): rename `test_panic_id_collision`

Signed-off-by: Ryan Russell <git@ryanrussell.org>

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-06-28 14:28:14 +00:00
Marco Neumann 2b84e5c087
feat: measure "probably reloaded" cache loads (#4813)
To roughly gauge how much data we re-load into cached (i.e. data that
was already loaded but was later evicted due to LRU pressure or TTL
eviction) this change introduces a new metric that estimates if a cache
entry that is requested from the loader was already seen before (using a
probabilistic filter).
2022-06-13 13:51:45 +00:00
Marco Neumann faaa2c9823
feat: add LRU cache eviction counter (#4814)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-06-09 13:33:45 +00:00
Marco Neumann 4e5842dec7
feat: expose hit-miss metrics for querier caches (#4811)
* feat: `MetricsCache`

* feat: expose hit-miss metrics for querier caches

* refactor: `MetricsCache` -> `CacheWithMetrics`

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-06-09 13:07:40 +00:00
Marco Neumann 2e3ba83795
refactor: expose `CacheGetStatus` (and improve tests) (#4804)
* refactor: expose `CacheGetStatus` (and improve tests)

- add a `CacheGetStatus` which tells the user if the request was a hit
  or miss (or something inbetween)
- adapt some tests to use the status (only the tests where this could be
  relevant)
- move the test suite from using `sleep` to proper barriers (more stable
  under high load, more correct, potentially faster)

* refactor: improve `abort_and_wait` checks

* docs: typos and improve wording

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* refactor: `FutureExt2` -> `EnsurePendingExt`

* refactor: `Queried` -> `MissAlreadyLoading`

* docs: explain `abort_or_wait` more

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-06-09 07:32:46 +00:00
Marco Neumann 317e9486df
refactor: make `Cache` a trait (#4802)
* refactor: make `Cache` a trait

To insert more high-level metrics (e.g. cache misses/hits) it would be
helpful if we could easily instrument the layer right above the cache
driver (that combines the backend and the loader). To do that without
polluting the types too much, let's introduce a trait that describes the
driver interface and that we could later wrap with intrumentation.

This also pulls out the test into a generic setup, similar to how this
is done for the cache storage backends.

This does NOT include any functionality changes.

* fix: typo

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-06-08 11:04:53 +00:00
dependabot[bot] e03bf94420
chore(deps): Bump tokio from 1.18.2 to 1.19.1 (#4783)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.18.2 to 1.19.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.18.2...tokio-1.19.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-06-06 14:15:12 +00:00
dependabot[bot] 9a21292db8
chore(deps): Bump async-trait from 0.1.53 to 0.1.56 (#4774)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.53 to 0.1.56.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.53...0.1.56)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-03 09:10:40 +00:00
Carol (Nichols || Goulding) 39fc19e946
test: Exercise the Extra type in the cache system tests 2022-06-01 09:19:52 -04:00
Carol (Nichols || Goulding) 37347f2389
feat: Add an Extra type to Cacher Loader to specify extra information for loading entries 2022-06-01 08:58:19 -04:00
Carol (Nichols || Goulding) 66823522f3
docs: Fix comment wrapping while reading through 2022-05-25 17:19:10 -04:00
Andrew Lamb a64b2b1d0b
feat: Add `SharedBackend` to cache system (#4652)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-05-23 14:24:24 +00:00
Marco Neumann 6577887440
feat: instrument querier cache loaders w/ metrics (#4635)
* feat: `MetricsLoader`

Add ability to instrument cache loaders w/ metrics.

* feat: instrument querier cache loaders w/ metrics

* fix: fix metric descriptions and names
2022-05-19 08:30:34 +00:00
Marco Neumann 770293a973
feat: add LRU cache metrics (#4632)
* refactor: require `Resource`s to be convertible to `u64`

* refactor: require `Resource`s to have a unit name

* refactor: make LRU cache IDs static

* feat: add LRU cache metrics

* docs: improve type names in LRU doctest

* docs: epxlain `MeasuredT`

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>

* docs: explain `test_metrics`

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
2022-05-19 08:05:17 +00:00
Marco Neumann 7aaabb37cb refactor: `cache_system::backend::dual` 2022-05-18 11:39:30 +02:00
Marco Neumann 779f0e9cdf
feat: querier RAM pool (#4593)
* feat: `SortKey::size`

* feat: `FunctionEstimator`

* feat: querier RAM pool

Let's put all the caches into a single RAM pool, so we can at least
somewhat control RAM usage. Note that this does NOT limit the peak
memory during query execution though, but should at least stop unlimited
cache growth. A follow-up PR will add metrics.

* refactor: improve some size calculations

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-05-17 13:11:20 +00:00
Marco Neumann cb0a4176fd
refactor: move `querier::cache_system` into its own crate (#4592) 2022-05-13 13:12:07 +00:00