<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello Fréderic,</p>
    <p>you are going in the right way. But you need to analyze the
      profiling data in more depth. E.g. it looks like the most
      interesting part is <i>before </i>the fragment you sent here.</p>
    Best regards,<br>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 22.10.2019 18:46, Frédéric Lohier
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CALRGK0qJfM-cq-ELfTsCCv693Awi9asSOhMz4HsLKzC-404d1Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <p style="font-family:arial,sans-serif;font-size:small">Hello,</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">I
          noticed a performance issue with approvals when the
          approverRef references a group of user (Org or Role) in a
          Midpoint instance with 20000+ users. My approvals are
          specified in a globalPolicyRule in the SystemConfiguration
          object.</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">When I
          specifies the approverRef as below, the approval request or
          the approval response each takes up to 30 seconds :</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small"><approverRef
          oid="00000000-0000-0000-0000-000000000000"
          relation="org:default" type="c:OrgType"></p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">Or</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small"><approverRef
          type="OrgType"></p>
        <p style="font-family:arial,sans-serif;font-size:small">   <filter></p>
        <p style="font-family:arial,sans-serif;font-size:small">     
          <q:equal></p>
        <p style="font-family:arial,sans-serif;font-size:small">        
          <q:path>name</q:path></p>
        <p style="font-family:arial,sans-serif;font-size:small">        
          <q:value>Name of the org</q:value></p>
        <p style="font-family:arial,sans-serif;font-size:small">      </q:equal></p>
        <p style="font-family:arial,sans-serif;font-size:small">   </filter></p>
        <p style="font-family:arial,sans-serif;font-size:small">  
          <resolutionTime>run</resolutionTime></p>
        <p style="font-family:arial,sans-serif;font-size:small"> </approverRef></p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">If I
          reduce the number of users in Midpoint, the approval
          request/response gets faster.</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">On the
          other hand, If I specify a static list of approverRef like :</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small"><approverRef
          oid="00000000-0000-0000-0000-000000000000"
          type="c:UserType"></p>
        <p style="font-family:arial,sans-serif;font-size:small"><approverRef
          oid="00000000-0000-0000-0000-000000000000"
          type="c:UserType"></p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">Or a
          dynamic list of approvers through an approverExpression like :</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small"><approverExpression></p>
        <p style="font-family:arial,sans-serif;font-size:small">  
           <script></p>
        <p style="font-family:arial,sans-serif;font-size:small">     
<code>midpoint.getMembersAsReferences("00000000-0000-0000-0000-000000000000")</code></p>
        <p style="font-family:arial,sans-serif;font-size:small">  
           </script></p>
        <p style="font-family:arial,sans-serif;font-size:small"></approverExpression></p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">Then ,
          even with 20000+ users, the approval request/response takes
          less than a second to be processed.</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">For
          reference, the full global policy rule :</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small"><globalPolicyRule></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          <name>Delete user approvals</name></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          <policyConstraints></p>
        <p style="font-family:arial,sans-serif;font-size:small">           
          <modification></p>
        <p style="font-family:arial,sans-serif;font-size:small">               
          <operation>delete</operation></p>
        <p style="font-family:arial,sans-serif;font-size:small">           
          </modification></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          </policyConstraints></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          <policyActions></p>
        <p style="font-family:arial,sans-serif;font-size:small">           
          <approval></p>
        <p style="font-family:arial,sans-serif;font-size:small">               
          <approvalSchema></p>
        <p style="font-family:arial,sans-serif;font-size:small">                   
          <stage></p>
        <p style="font-family:arial,sans-serif;font-size:small">                       
          <approverRef oid="00000000-0000-0000-0000-000000000000"
          relation="org:default" type="c:OrgType"></p>
        <p style="font-family:arial,sans-serif;font-size:small">                       
          <!-- Administrateurs Identités Arobas --></p>
        <p style="font-family:arial,sans-serif;font-size:small">                       
          </approverRef></p>
        <p style="font-family:arial,sans-serif;font-size:small"> 
                                <automaticallyCompleted></p>
        <p style="font-family:arial,sans-serif;font-size:small">                           
          <description>If the user has the superuser role, we
          automatically approve</description></p>
        <p style="font-family:arial,sans-serif;font-size:small">                           
          <script></p>
        <p style="font-family:arial,sans-serif;font-size:small">                               
          <code></p>
        <p style="font-family:arial,sans-serif;font-size:small">                
                             if (midpoint.isDirectlyAssigned(actor,
          "00000000-0000-0000-0000-000000000004")) {</p>
        <p style="font-family:arial,sans-serif;font-size:small">                                       
          return 'skip';</p>
        <p style="font-family:arial,sans-serif;font-size:small">                                   
          }</p>
        <p style="font-family:arial,sans-serif;font-size:small">                                   
          else {</p>
        <p style="font-family:arial,sans-serif;font-size:small">                  
                               return null;</p>
        <p style="font-family:arial,sans-serif;font-size:small">                                   
          }</p>
        <p style="font-family:arial,sans-serif;font-size:small">                               
          </code></p>
        <p style="font-family:arial,sans-serif;font-size:small">                           
          </script></p>
        <p style="font-family:arial,sans-serif;font-size:small">                       
          </automaticallyCompleted></p>
        <p style="font-family:arial,sans-serif;font-size:small">                   
          </stage></p>
        <p style="font-family:arial,sans-serif;font-size:small">               
          </approvalSchema></p>
        <p style="font-family:arial,sans-serif;font-size:small">           
          </approval></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          </policyActions></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          <focusSelector></p>
        <p style="font-family:arial,sans-serif;font-size:small">           
          <type>UserType</type></p>
        <p style="font-family:arial,sans-serif;font-size:small">       
          </focusSelector></p>
        <p style="font-family:arial,sans-serif;font-size:small">   
          </globalPolicyRule></p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">An
          excerpt of the trace:</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 DEBUG: ##### Exit: 2255272           
          ...repo.cache.RepositoryCache->getObject# etime: 1.311 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 TRACE: ###### retval:
systemConfiguration:00000000-0000-0000-0000-000000000001(SystemConfiguration)</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 DEBUG: ##### Exit: 2255271          
...wf.impl.engine.helpers.NotificationHelper->sendPreparedNotifications
          etime: 1.755 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 DEBUG: ##### Exit: 2255257         
          ...wf.impl.engine.EngineInvocationContext->commit etime:
          40.146 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 DEBUG: ##### Exit: 2255157        
          ...wf.impl.engine.WorkflowEngine->executeRequest etime:
          25067.345 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 DEBUG: ##### Exit: 2255136       
...wf.impl.processors.primary.PrimaryChangeProcessor->executeStartInstructions
          etime: 25146.234 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 DEBUG: ##### Exit: 2255118      
...wf.impl.processors.primary.PrimaryChangeProcessor->previewOrProcessModelInvocation
          etime: 25153.706 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,948 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: ##### Exit: 2255117     
          ...wf.impl.hook.WfHook->invoke etime: 25153.876 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: ##### Exit: 2254939    
          ...model.impl.lens.Clockwork->click etime: 25198.070 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: #### Entry: 2255276   
...provisioning.impl.ProvisioningServiceImpl->exitConstraintsCheckerCache#</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 TRACE: ###### args: ()</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: ##### Exit: 2255276    
...provisioning.impl.ProvisioningServiceImpl->exitConstraintsCheckerCache#
          etime: 0.012 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 TRACE: ###### retval: null</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: ##### Exit: 2254935   
          ...model.impl.lens.Clockwork->run etime: 25198.487 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: ##### Exit: 2254934  
          ...model.api.ModelService->executeChanges etime: 25198.728
          ms</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 TRACE: ###### retval: {}</p>
        <p style="font-family:arial,sans-serif;font-size:small">2019-10-21
          17:22:16,949 DEBUG: ##### Exit: 2254933 
          ...model.impl.controller.ModelController->executeChanges#
          etime: 25201.841 ms</p>
        <p style="font-family:arial,sans-serif;font-size:small"> </p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
  </body>
</html>