osullivanja
osullivanja

Reputation: 38

DotNetNuke schedules running on a webfarm causing blocking

I have a website running on DotNetNuke v09.02.02 on a webfarm of 3 servers and I have a problem with the PurgeScheduleHistory.

The PurgeScheduleHistory runs once a day, but it's running at the same time from each of the servers and I frequently see dead locks because each server is trying to do the same operation.

I know the procedure can be optimized but I believe I could still see the same problem of each server picking up the Schedule History and deleting it as another server is trying to do the same.

Does DotNetNuke have a setting or ability to only run the schedules from a specified server and not others?

Has anyone else experience of running DotNetNuke on a webfarm?

Upvotes: 0

Views: 47

Answers (2)

Karin
Karin

Reputation: 135

On my web farm I don't always know the names of the servers the jobs my run on as they may change as the provider may change them at any time, so I wrote this little function to see if the job is already running:

private bool AlreadyRunning()
{
    System.Collections.ArrayList scheduleHistory = DotNetNuke.Services.Scheduling.SchedulingProvider.Instance().GetScheduleHistory(ScheduleHistoryItem.ScheduleID);
    if (scheduleHistory != null)
    {
        scheduleHistory.Sort(new DotNetNuke.Services.Scheduling.ScheduleHistorySortStartDate());
        foreach (ScheduleHistoryItem hist in scheduleHistory)
        {
            if (hist.ScheduleHistoryID == ScheduleHistoryItem.ScheduleHistoryID)
                continue;
            if (hist.Succeeded)
                return false;
            else if (hist.EndDate == DateTime.MinValue && hist.ScheduleStartDate > ScheduleHistoryItem.ScheduleStartDate.AddMinutes(-10))
                return true;
            else
                return false;
        }
    }
    return false;
}

}

Upvotes: 1

Mitchel Sellers
Mitchel Sellers

Reputation: 63136

Yes, if you navigate to the scheduler configuration there is a "Run on Server(s)" setting, by default it is blank, you can and should, update that to list the name of a single server in your environment.

You should do this for any of the services that do not need to run on all servers, I don't have an exhaustive list at the moment but items to consider

  • Purge Schedule History
  • Search Index/Crawler
  • Message Dispatch

Basically anything that is DB driven should be done on a single server in this manner.

Upvotes: 0

Related Questions