views:

36

answers:

1

We are thinking of ways to get our scheduled tasks centralized as much as possible by dragging alot of tasks from website specific web.config files to one Windows schedules task. I can imagine that this has some negative consequences, but I want to list them so I can make myself a good explanation of what will work best. We have different types of task that have to be done periodically like for example:

  • Keepalive <- calls a page so that the website won't be recompiling every 20 minutes (iis setting)
  • Imports in different websites we run <- Imports of for example objects that have to be placed in a Sitecore database.

Sitecore has it's own scheduler and that makes imports very easy to run by just using this scheduler. On the other side, Sitecore also has it's own "KeepAlive" setting in the web.config that makes sure the website runs faster.

What will be the pro's and the con's on this issue and what will you advice? Keep the scheduled tasks centralized? Split the normal imports from the Keepalive tasks and put one of them in a centralized environment?

Any advice would be appreciated!

+1  A: 

Sitecore native scheduling is executed within Sitecore context, that means that you can easily communicate with Sitecore this way but the app has to be alive for the task to execute. This is pretty much why it is impossible to run a scheduled agent at a specific time, only on scheduled intervals, as there is no guarantee that application is healthy at a given moment.

Windows tasks are executed outside of the context and can be scheduled at a specific time, but this approach lacks that much needed Sitecore context which may complicate the design a bit, but you can always create a Sitecore web service to handle that.

Among the real world examples I've seen where Windows scheduler approach has been implemented is scenario with "publishing at specific time": http://sitecoreblog.alexshyba.com/2007/02/publish-at-specific-time.html Also I've seen large data pushes implemented, like the one you are talking about. You can pretty much have import code run outside of Sitecore context in a console app. Having access to Sitecore.Configuration.Factory, you can instantiate databases, get items and create items. That's all you need. Plus it is more effective that running such code within http context.

Alex Shyba
Thanks Alex for your clear answer!
Younes