Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-2879

Improve performance of incrementally updating policies

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0
    • None
    • plugins
    • None

    Description

      There is large amount of deleting policy operation in incrementally updating mechanism. But policies in RangerPolicyRepository is a List<RangerPolicy>. 

      //
      private void removePolicy(Long id) {
          if (LOG.isDebugEnabled()) {
              LOG.debug("==> RangerPolicyRepository.removePolicy(" + id +")");
          }
          Iterator<RangerPolicy> iterator = policies.iterator();
          while (iterator.hasNext()) {
              if (id.equals(iterator.next().getId())) {
                  iterator.remove();
                  break;
              }
          }
      
          policyEvaluatorsMap.remove(id);
      
          if (LOG.isDebugEnabled()) {
              LOG.debug("<== RangerPolicyRepository.removePolicy(" + id +")");
          }
      }
      

      Replace list with a map structure will improve performance of removePolicy a lot.

       

       

      Attachments

        Issue Links

          Activity

            People

              starphin star
              starphin star
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: