seems your declined PR at https://github.com/apereo/cas/pull/5627/files got 
now adopted by re-worked MongoDB support 
https://github.com/apereo/cas/commit/d7830d0d6ab47234abfd89b145c17f240f053170

On Saturday, April 1, 2023 at 12:23:41 PM UTC+2 Pascal Rigaux wrote:

> 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
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/e6275f04-46cd-48ac-8263-00a9eec9a56bn%40apereo.org.

Reply via email to