Scheduled job - need to run on each instance in web farm

Vote:
 
#45002
Oct 26, 2010 12:44
Vote:
 

I have next server configuration - three web server under load balancing work with one db. I create scheduled job, that need to start on each instance each "next scheduled date", but it starts only the one random instance. see below part of job history

10/26/2010 10:40:24 AM OK Finished. Processed 13 destinations at SERVER3 server for 2 seconds

10/26/2010 10:15:24 AM OK Finished. Processed 13 destinations at SERVER2 server for 2 seconds

10/26/2010 9:50:24 AM OK Finished. Processed 13 destinations at SERVER1 server for 1 seconds

The question is - how to prevent scheduler from check - was the task run on the other instance?

#45003
Oct 26, 2010 12:46
Vote:
 

Ivan, this behaviour is by design. A sceduled job is only ever meant to run once, on any of the web servers. You can control which machine scheduled jobs run on by using the "enableScheduler" flag in web.config. If you need communicaton between machines as a result of running a sceduled job then I advise looking into the EPiServer events system:

http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2-SP2/Event-Management-System-Specification/

If the job needs to run on each machine then you are better off looking at a Windows Service.

#45005
Oct 26, 2010 13:39
Vote:
 

Hi Ivan!

Simply put: you dont.
The scheduler is written in such a way that the job will be executed on *one* of the connected servers. You *could* modify the stored procedures to circumvent this behaviour but its really not recommended...

A workaround could be to make use of EPiServers remote event functionality and have the code execute whenever a specific event is raised, and then have the server that happens to check out the scheduled job simply raise the event.

More on events here:
http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-SP2/Event-Management-System-Specification/

/johan

#45006
Oct 26, 2010 13:39
Vote:
 

Congrats David, you beat me with 8secs :-)

/johan

#45008
Oct 26, 2010 13:40
Vote:
 

No worries Johan - I'm simply glad I got the answer correct :)!

#45009
Oct 26, 2010 13:57
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.