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

Warmer (search) to support query cache #7326

Closed
wants to merge 3 commits into from

Conversation

Projects
None yet
3 participants
@kimchy
Copy link
Member

kimchy commented Aug 19, 2014

allow for search based warmer to support query cache flag on the search request, and use the index level query caching flag if set.
Note, this change required changing the logic in warmer, to pass the actual searcher that will be used on for the actual search requests to the warmers. This changes the previous behavior of only using readers that were not warmed during merges, or already around. This change simplifies the warmer code significantly, and the overhead will be very small for existing warmed readers (like after a merge), yet allow us to implement warmers like the query cache (and actually have a cleaner contract, "same as search").

@kimchy kimchy added review labels Aug 19, 2014

Warmer (search) to support query cache
allow for search based warmer to support query cache flag on the search request, and use the index level query caching flag if set.
 Note, this change required changing the logic in warmer, to pass the actual searcher that will be used on for the actual search requests to the warmers. This changes the previous behavior of only using readers that were not warmed during merges, or already around. This change simplifies the warmer code significantly, and the overhead will be very small for existing warmed readers (like after a merge), yet allow us to implement warmers like the query cache (and actually have a cleaner contract, "same as search").
closes #7326
@kimchy

This comment has been minimized.

Copy link
Member Author

kimchy commented Aug 19, 2014

@jpountz hey, would for you to look at this, since in order to change that, I ended up changing the warmer logic in which searcher to provide.

indicesQueryCache.load(request, context, queryPhase);
} else {
queryPhase.execute(context);
}

This comment has been minimized.

Copy link
@jpountz

jpountz Aug 19, 2014

Contributor

These 5 lines are exactly the same as in executeQueryPhase, maybe this should be extracted to a utility method?

@jpountz

This comment has been minimized.

Copy link
Contributor

jpountz commented Aug 19, 2014

I am worried that this might have significant impact on users who have large shards/lots of warmer queries/complex warmer queries? I wouldn't be surprised that warmer queries often use a match_all query, and in such a case the warmer would need to collect every document on every every refresh while most of time there is just a new smallish NRT segment?

@jpountz jpountz removed the review label Aug 19, 2014

Second round of query cache warmer
try and keep the existing only warm new segments, but extend the top warming to also execute in search, also, make methods names a bit more readable
boolean canCache = indicesQueryCache.canCache(request, context);
// early terminate when we can cache, since we can only do proper caching on top level searcher
// also, if we can't cache, and its top, we don't need to execute it, since we already did when its not top
if ((canCache && !top) || (!canCache && top)) {

This comment has been minimized.

Copy link
@jpountz

jpountz Aug 20, 2014

Contributor

This looks like a complicated way to say if (canCache != top)?

This comment has been minimized.

Copy link
@kimchy

kimchy Aug 20, 2014

Author Member

aye :)

.endObject()
);
.endObject()
.endObject()

This comment has been minimized.

Copy link
@jpountz

jpountz Aug 20, 2014

Contributor

I tend to find it easier to read when indented?

@jpountz

This comment has been minimized.

Copy link
Contributor

jpountz commented Aug 20, 2014

LGTM, I just left minor (costmetics) comments

@kimchy kimchy closed this in 3a52296 Aug 20, 2014

kimchy added a commit that referenced this pull request Aug 20, 2014

Warmer (search) to support query cache
allow for search based warmer to support query cache flag on the search request, and use the index level query caching flag if set.
closes #7326

@kimchy kimchy deleted the kimchy:query_cache_warmer branch Aug 20, 2014

@kimchy kimchy added the enhancement label Aug 20, 2014

kimchy added a commit that referenced this pull request Sep 8, 2014

Warmer (search) to support query cache
allow for search based warmer to support query cache flag on the search request, and use the index level query caching flag if set.
closes #7326

@clintongormley clintongormley changed the title Warmer (search) to support query cache Query cache: Warmer (search) to support query cache Sep 8, 2014

@clintongormley clintongormley changed the title Query cache: Warmer (search) to support query cache Query Cache: Warmer (search) to support query cache Sep 11, 2014

@clintongormley clintongormley changed the title Query Cache: Warmer (search) to support query cache Warmer (search) to support query cache Jun 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.