I was at a customer to help identify why their Sitecore 7.2 client and logon was so slow!
There are a number of things I look at when the Sitecore client starts to run slowly:
- Slow Event handlers (save, rename, create, etc)
- Slow pipeline processors (usually don’t check that it is a sitecore specific requests)
- History, Publish queue or Event queue have to many entries, see my blog on how to fix this.
- Property change events flooding the Event Queue in the Core database, see my blog on how to fix this
But after ensuring all the previous issues were not the problem, I found a new issue with the properties table.
Properties Table flooded with SC_Ticket entries
The properties table in the core database had over 500000 entries, it was filled with SC_TICKET_xxx entries.
Unfortunately the properties table does not have a created date column, so I could not write an SQL script to purge all the entries that where more than X days old.
I noticed that in the value column there was a time-stamp embedded in the Value field. My initial solution was to could create an sitecore agent to do the following:
- iterate over all the entries in the properties table
- Parse the value for SC_Ticket entries
- Remove all the entries that were older than X days.
I knew Sitecore must have a class, which had created all these entries. So using DotPeek I started my search and found the TicketManager class. The TicketManager even had a IsTicketExpired function.
I found that there is already a Sitecore agent that checks for any tickets that are expired and removes them. It is called the CleanupAuthenticationTicketsAgent for some reason this was not in the web.config, but it is easy enough to add see below.
But the important step is to reduce the number of days to keep the tickets as the default is 180. The Authentication.ClientPersistentLoginDuration setting is responsible for determining how long before the ticket should expire (see the IsTicketExpired function in the image above).
I set Authentication.ClientPersistentLoginDuration to 5 and it reduced the number of entries in the properties table to around 500, and then sitecore client and logon was much faster.
Prior to writing this post I wasn’t aware but the is a blog about how sitecore sessions can expire.