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

Cache: Add maxEntrySize config, make groupBy cacheable by default. #5108

Merged
merged 15 commits into from Aug 7, 2018

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Nov 20, 2017

The idea is a maxEntrySize makes it more feasible to cache query types that
can potentially generate large result sets, like groupBy and select,
without fear of writing too much to the cache per query.

Includes a refactor of cache population code in CachingQueryRunner and
CachingClusteredClient, such that they now use the same CachePopulator
interface with two implementations: one for foreground and one for
background.

The main reason for splitting the foreground / background impls is
that the foreground impl can have a more efficient implementation of
maxEntrySize. It can stop retaining subvalues for the cache early.

Also includes:

  • New cache populator metrics: put/ok, put/errors, put/oversized.
  • Removed groupBy from default uncacheable list, since the main reason it was uncacheable was that its cached values could be too large.

The idea is this makes it more feasible to cache query types that
can potentially generate large result sets, like groupBy and select,
without fear of writing too much to the cache per query.

Includes a refactor of cache population code in CachingQueryRunner and
CachingClusteredClient, such that they now use the same CachePopulator
interface with two implementations: one for foreground and one for
background.

The main reason for splitting the foreground / background impls is
that the foreground impl can have a more effective implementation of
maxEntrySize. It can stop retaining subvalues for the cache early.
@gianm gianm removed the WIP label Jun 13, 2018
@gianm
Copy link
Contributor Author

gianm commented Jun 13, 2018

Removed WIP tag -- I have added tests and resolved conflicts.

@gianm gianm changed the title Cache: Add maxEntrySize config. Cache: Add maxEntrySize config, make groupBy cacheable by default. Jun 13, 2018
Copy link
Member

@clintropolis clintropolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm 👍

@@ -52,10 +52,13 @@
private int cacheBulkMergeLimit = Integer.MAX_VALUE;

@JsonProperty
private int resultLevelCacheLimit = Integer.MAX_VALUE;
private int maxEntrySize = 1_000_000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a typical cache entry size? (how did you pick this number)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our cluster the average size is about 1KB. But I am not sure how representative this is. I chose 1MB because I figured it was a large number that will block egregiously large cache entries.

@jihoonson
Copy link
Contributor

@gianm please fix the licenses.

[ERROR] /home/travis/build/apache/incubator-druid/server/src/main/java/io/druid/client/cache/BackgroundCachePopulator.java:2: Line does not match expected header line of ' * Licensed to the Apache Software Foundation (ASF) under one'. [Header]
[ERROR] /home/travis/build/apache/incubator-druid/server/src/main/java/io/druid/client/cache/CachePopulatorStats.java:2: Line does not match expected header line of ' * Licensed to the Apache Software Foundation (ASF) under one'. [Header]
[ERROR] /home/travis/build/apache/incubator-druid/server/src/main/java/io/druid/client/cache/ForegroundCachePopulator.java:2: Line does not match expected header line of ' * Licensed to the Apache Software Foundation (ASF) under one'. [Header]
[ERROR] /home/travis/build/apache/incubator-druid/server/src/test/java/io/druid/client/cache/CachePopulatorTest.java:2: Line does not match expected header line of ' * Licensed to the Apache Software Foundation (ASF) under one'. [Header]

@gianm
Copy link
Contributor Author

gianm commented Aug 2, 2018

Oops, missed those. I pushed with new license headers.

Copy link
Contributor

@jihoonson jihoonson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after Travis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants