John,

Thanks for reporting this bug.

Captured to https://issues.jasig.org/browse/UP-4143 .

Yes, it should batch.  The algorithm probably should be loading a 
reasonable number at a go, purging those, and then loading more, 
repeating until done with the requested purge.

Want to have a go at coding that?

Kind regards,

Andrew


On 6/16/14, 12:09 PM, John K Peterson wrote:
> Hi all,
>
> We had a problem last week where a very large number of sessions 
> (millions)
> were created in uPortal.  As a server in a cluster tried to purge expired
> events, it eventually ran out of memory.
>
> I think the source of the problem is in the method 
> purgeEventSessionsBefore
> of org.jasig.portal.events.aggr.session.JpaEventSessionDao. It appears to
> create a list of all the EventSessionImpl's to purge and then delete them
> one by one.  In our case, it made it to about 7,000,000 of them
> (100,000,000 when you count all the supporting hibernate objects) and
> almost 4GB of heap space.
>
> I'm not a hibernate specialist, but is it possible to do this more
> efficiently and/or in batches? (My workaround for the time being is 
> calling
> setMaxResults(100000) on the query.)
>
> ----------------
>
> @AggrEventsTransactional
> @Override
> public int purgeEventSessionsBefore(DateTime lastAggregatedEventDate) {
>   final TypedQuery<EventSessionImpl> query =
> this.createQuery(this.findExpiredEventSessionsQuery);
>   query.setParameter(this.dateTimeParameter, lastAggregatedEventDate);
>   final List<EventSessionImpl> resultList = query.getResultList();
>   for (final EventSessionImpl eventSession : resultList) {
>       this.getEntityManager().remove(eventSession);
>   }
>
>   return resultList.size();
>     }
> -- 
>
> You are currently subscribed to [email protected] as: 
> [email protected]
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/uportal-dev


-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/uportal-dev

Reply via email to