Remove text index from mongo ticket repository #6221
+53
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue to solve
Currently, the MongoDbTicketRegistry creates a "text" mongo index on the full json contents of the ticket. That index is large and expensive to maintain: it our environment the index is larger than the ticket storage itself, and load testing shows a 50% reduction in tickets-generated-per-second throughput when the index is present. (Updating this index is the bottleneck in how many authentication transactions CAS can perform).
The only use of the text index is in
MongoDbTicketRegistry.getSessionsFor()
, which does a TextQuery of the ticket document to search byprincipal
. Sinceprincipal
is already an field in the ticket document in mongo (with its own index!) there is no need to do a full-text search to find it.Summary of changes
getSessionsFor
, query theprincipal
directly instead of a text search of thejson
IDX_JSON_TYPE_ID
)IDX_JSON_TYPE_ID
from list of supported indexes