You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2022/06/24 11:12:05 UTC

[GitHub] [sling-org-apache-sling-resourceresolver] joerghoh commented on a diff in pull request #74: SLING-11394: improve diagnostics when # of vanity paths is close or greater than configured cache size

joerghoh commented on code in PR #74:
URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/74#discussion_r905963985


##########
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:
   What is the consequence of this? 
   Also can we add a call-to-action to this? Would "Increase the cache size" be the right recommendation?



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org