Hello all,

We are using DB persistance for TicketGrantingTIcket table, and have managed
to setup redundant load balanced servers successfully inc Single Sign Out.

During load testing we noticed a few spikes every 83 minutes (5,000,000
msecs) or so.

It appears that this query is being executed

select ticketgran0_.ID as ID2_, ticketgran0_.NUMBER_OF_TIMES_USED as
NUMBER2_2_, ticketgran0_.CREATION_TIME as CREATION3_2_,
ticketgran0_.EXPIRATION_POLICY as EXPIRATION4_2_,
ticketgran0_.LAST_TIME_USED as LAST5_2_,
ticketgran0_.PREVIOUS_LAST_TIME_USED as PREVIOUS6_2_,
ticketgran0_.ticketGrantingTicket_ID as ticketG10_2_,
ticketgran0_.AUTHENTICATION as AUTHENTI7_2_, ticketgran0_.EXPIRED as
EXPIRED2_, ticketgran0_.SERVICES_GRANTED_ACCESS_TO as SERVICES9_2_ from
TICKETGRANTINGTICKET ticketgran0_

and there is no where clause.

Looking through the code, I believe the culprit is

https://www.ja-sig.org/svn/cas3/tags/cas-3-2-2-rc1/cas-server-core/src/main/java/org/jasig/cas/ticket/registry/support/DefaultTicketRegistryCleaner.java

i.e. the clean method:

        log
            .info("Starting cleaning of expired tickets from ticket registry
at ["
                + new Date() + "]");

--> GETS ALL TICKETS (returned 1500 rows in one of our tests)

        ticketsInCache = this.ticketRegistry.getTickets();

        for (final Ticket ticket : ticketsInCache) {
            if (ticket.isExpired()) {
                ticketsToRemove.add(ticket);
            }
        }

        log.info(ticketsToRemove.size()
            + " found to be removed.  Removing now.");

        for (final Ticket ticket : ticketsToRemove) {
            this.ticketRegistry.deleteTicket(ticket.getId());
        }

        log
            .info("Finished cleaning of expired tickets from ticket registry
at ["
                + new Date() + "]");

Is there any reason why we need to get all the tickets, and the loop through
them?

If I was to write my own DB cleaner, how do I decide what the expiration
policy is?

Is there more to it that meets the eye?

Many thanks
Andrew
_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to