You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/03/01 22:19:11 UTC
[GitHub] [druid] clintropolis opened a new pull request #12293: use a non-concurrent map for lookups-cached-global unless incremental updates are actually required
clintropolis opened a new pull request #12293:
URL: https://github.com/apache/druid/pull/12293
### Description
On very large historical servers with a lot of processors, queries using lookups can find a decent amount of time being wasted on lock contention, when the majority of these lookups are populated offline and then swapped to the new version, making this synchronization unnecessary, at least when using 'on heap' lookups.
I've re-arranged some code in `lookups-cached-global` to allow the "versioned" family of lookups to now "allocate" a cache and then later "attach" it after it is fully populated, which for on-heap lookups means that a non-concurrent map will be used, and wrapped in a `Collections.unmodifiableMap` when "attaching" it to the lookups cache. Since all consumers after initial population are read only, and version updates populate a completely new cache prior to attaching, this should be safe as far as I can tell. Off heap lookups have not been changed and will continue to use the concurrent map implementation at this time.
Kafka extraction lookups still use the old "createCache" method, since they do in fact incrementally update lookups as the consumer finds new values, so they should be unchanged by this patch.
<hr>
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] imply-cheddar commented on a change in pull request #12293: use a non-concurrent map for lookups-cached-global unless incremental updates are actually required
Posted by GitBox <gi...@apache.org>.
imply-cheddar commented on a change in pull request #12293:
URL: https://github.com/apache/druid/pull/12293#discussion_r817225693
##########
File path: extensions-core/lookups-cached-global/src/main/java/org/apache/druid/server/lookup/namespace/cache/CacheScheduler.java
##########
@@ -387,10 +379,11 @@ public String toString()
final CacheHandler cacheHandler;
final String version;
- private VersionedCache(String entryId, String version)
+ private VersionedCache(String entryId, String version, CacheHandler cache)
{
this.entryId = entryId;
- this.cacheHandler = cacheManager.createCache();
+ this.cacheHandler = cache;
+ cacheManager.attachCache(cache);
Review comment:
This is doing work in the constructor. That's a pattern that often creates sadness. Given that `cacheManager` is a field on the parent object here, can we move the attachCache into the `swapCacheState` method maybe?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] cheddar merged pull request #12293: use a non-concurrent map for lookups-cached-global unless incremental updates are actually required
Posted by GitBox <gi...@apache.org>.
cheddar merged pull request #12293:
URL: https://github.com/apache/druid/pull/12293
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org