Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-716

Performance: caching negative results

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • jackrabbit-core
    • None

    Description

      We recently have been looking at the performance of JackRabbit and noted that the SharedItemStateManager does not cache negative results. For instance, when "hasItemState" returns false, then this negative result is not cached and a subsequent call with the same ItemId will again query the database (if the item has not been added and cached yet). We think, however, that caching such negative results might improve the performance significantly for some applications.

      I've tried to add a simple negative-caching scheme. ItemIds are negatively cached in the method "hasNonVirtualItemState" when the persistence manager returns "false". Cache eviction occurs in the method "getNonVirtualItemState" when a state is loaded. It also seems necessary to evict ItemIds in the methods "stateCreated" and "has/getItemState" (when one of the virtual providers returns something), because when an ItemId is neg-cached, it might still be provided by one of the VISP. The negative cache can then be used in the method "hasNonVirtualItemState" like this:

      if (cache.isCached(id)) {
      return true;
      } else if (negativeCache.isCached(id)) {
      return false;
      }

      Although all JackRabbit tests succeeded during compilation and our application seemingly behaved ok, I still doubt that my implementation is completely correct (I don't know the ins and outs of the SharedItemStateManager and made some assumptions). We are, however, quite eager to investigate this further as our application is 15% faster in an important use case with this very simple negative caching scheme enabled.

      Is there any previous work on something like this in JackRabbit? How difficult is a solid implementation?

      Regards,

      Martijn Hendriks

      Attachments

        1. SharedItemStateManager.java
          53 kB
          Martijn Hendriks

        Activity

          People

            Unassigned Unassigned
            martijnh Martijn Hendriks
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: