DotNetNuke, ASP.NET, Web Development Blog

Is your DotNetNuke site running slow

Is your DotNetNuke site running ridiculously slowly and consuming massive amounts of your processor? It might be stuck in a bit of a catch 22... The scheduler is trying to clear the ScheduleHistory table, but it can't because the ScheduleHistory table is too full.

I don't know exactly what versions of DNN this affects but I know it was around for quite awhile. Various things were done to improve it and I'm really not sure if it's been fully fixed but I do know it was at its worst in the 4.3.x versions.

It's been awhile since I dug into the exact specifics but the basics are... There's a table called, ScheduleHistory. Normally, that table is cleared by the scheduler on a regular basis so that it never gets bigger than a few hundred records. But sometimes, something causes the Scheduler to not clear out the table for a bit. In the 4.3.x versions, there was some SQL that was run by the Scheduler which, for every record in the table it would would check that record against every other record in the table. The number of sql call increases exponentially as the table grows. So, if there were 500 records on the table, 250,000 sql calls were made. everytime this function was fired off by the scheduler, which was fairly frequent. This isn't a problem as long as the table stays small, but once it gets to a certain size, the scheduler can no longer clear the table and the problem gets continually worse.

The fix: run the following SQL Statement (you can do this in the Host/SQL tab)
SELECT COUNT(*) FROM ScheduleHistory

If this returns a number greater than 500. Run this:
truncate table schedulehistory

Then monitor things for a few days to ensure the ScheduleHistory table is getting cleaned up on a regular basis.