Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-9817

JMX CTS session count is broken


    • Support Ticket IDs:


      org.forgerock.openam.monitoring.session.CtsSessionsImpl offers a means of getting a count of the number of sessions stored in CTS: getSumCTSSessions.

      This method delegates to org.forgerock.openam.cts.monitoring.impl.persistence.CtsPersistenceOperationsMonitor#getTotalCount() which performs the following call to OpenDJ:

              TokenFilter filter = new TokenFilterBuilder().returnAttribute(CoreTokenField.TOKEN_ID).build();
              return store.attributeQuery(filter).size();

      There appear to be a number of problems with this approach:

      1) It's likely to be very slow and may even fail to run: Reading the ID attribute of all CTS tokens and then taking a count of the number entries returns may hit OpenDJ read limits or time limits and leads to far more data being transmitted from OpenDJ to OpenAM than is necessary. The same result could be obtained far more efficiently by asking for the numSubOrdinates operation attribute from the CTS root DN.

      2) It answers the wrong question: Given that CtsSessionsImpl should likely be answering the question "how many sessions are stored in CTS" or even "how many active sessions are stored in CTS". Unfortunately, neither of these questions can be answered with a simple numSubOrdinates read.


          Issue Links



              • Assignee:
                craig.mcdonnell Craig McDonnell
              • Votes:
                0 Vote for this issue
                9 Start watching this issue


                • Created: