reschke commented on code in PR #74:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/74#discussion_r905965944
##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java:
##########
@@ -1251,20 +1251,29 @@ private Map<String, List<String>>
loadVanityPaths(ResourceResolver resolver) {
log.debug("end vanityPath query; elapsed {}ms",
TimeUnit.NANOSECONDS.toMillis(queryElapsed));
long count = 0;
+ long countInScope = 0;
long processStart = System.nanoTime();
while (i.hasNext()) {
count += 1;
final Resource resource = i.next();
final String resourcePath = resource.getPath();
if (Stream.of(this.factory.getObservationPaths()).anyMatch(path ->
path.matches(resourcePath))) {
+ countInScope += 1;
final boolean addToCache = isAllVanityPathEntriesCached()
|| vanityCounter.longValue() <
this.factory.getMaxCachedVanityPathEntries();
loadVanityPath(resource, resolveMapsMap, targetPaths,
addToCache);
}
}
long processElapsed = System.nanoTime() - processStart;
- log.debug("processed {} vanityPaths in {}ms", count,
TimeUnit.NANOSECONDS.toMillis(processElapsed));
+ log.debug("processed {} vanityPaths (of which {} in scope) in {}ms",
count, countInScope, TimeUnit.NANOSECONDS.toMillis(processElapsed));
+ if (!isAllVanityPathEntriesCached()) {
+ if (countInScope > this.factory.getMaxCachedVanityPathEntries()) {
+ log.warn("Number of vanity paths in scope ({}) exceeds
configured cache size ({})", countInScope,
this.factory.getMaxCachedVanityPathEntries());
Review Comment:
The consequence is that request for certainl paths will be slow because
they'll hit the storage (by query). The recommendation would be to either
reduce the number of vanity paths, or increase the cache size.
Do you want to make a proposal for the concrete text?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]