Hi,
To avoid performance issues with Redis ticket registry on 6.6.x, we switched to MongoDB ticket registry.
I was really astonished that MongoDB was using as much CPU as CAS Java, and was causing a lot of iowait.
After looking around, I found a mostly unused text index:
name: 'json_text_type_text_ticketId_text',
weights: { json: 1, ticketId: 1, type: 1 },
Looking at the code, it seems to be useful for
| TextQuery.queryText(TextCriteria.forDefaultLanguage().matchingAny(principalId))
used by
- countSessionsFor (but only if crypto not enabled)
which is used by UniquePrincipalAuthenticationPolicy (cf
https://apereo.github.io/cas/development/authentication/Configuring-Authentication-Policy-UniquePrincipal.html#unique-principal---authentication-policy )
- getSessionsFor to get all sessions for a user... but only if crypto not enabled.
If crypto is enabled it now uses the new "principal" field.
I suggest using "principal" field in any case (crypto enabled or not), and remove the costly json_text_type_text_ticketId_text indexes.
Here is the trivial commits I applied here:
https://github.com/prigaux/cas/commits/remove-mongo-ticket-registry-textindex-6.6
https://github.com/prigaux/cas/commits/remove-mongo-ticket-registry-textindex
NB: you can remove thoses indexes with
db.proxyGrantingTicketsCollection.dropIndex('json_text_type_text_ticketId_text')
db.proxyTicketsCollection.dropIndex('json_text_type_text_ticketId_text')
db.serviceTicketsCollection.dropIndex('json_text_type_text_ticketId_text')
db.ticketGrantingTicketsCollection.dropIndex('json_text_type_text_ticketId_text')
but they will come back at apereo CAS startup.
On the index subject, you may add the following useful one:
db.ticketGrantingTicketsCollection.createIndex({ ticketId: 1 })
db.serviceTicketsCollection.createIndex({ ticketId: 1 })
db.proxyTicketsCollection.createIndex({ ticketId: 1 })
db.proxyGrantingTicketsCollection.createIndex({ ticketId: 1 })
cu