Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Mar 31, 2015 @ 12:43
    Dave Woestenborghs
    0

    Scheduled tasks not working in load balanced environment

    Hi 

    I have a load balanced setup having 2 servers running Umbraco 7.1.9

    Master : editors work on this server and have a url for accessing this server like editor.mydomain.com
    Slave : not editor work will be done on this server

    My domain www.mydomain.com will go through a load balancer and load will be distributed between master and slave.

    We have set up load balancing according to this : https://our.umbraco.org/documentation/Installation/load-balancing#Correctconfigforscheduledpublishing&tasks

    This is myconfig : 

    <distributedCall enable="true">
        <!-- the id of the user who's making the calls -->
        <!-- needed for security, umbraco will automatically look up correct login and passwords -->
        <user>1</user>
        <servers>
          <server serverName="Master">internaldomain1.com</server>
          <server serverName="Slave1">internaldomain2.com</server>
    </servers> </distributedCall>

    The domains used here are internal domains that only work behind the loadbalancer. This setup works fine. When a user publishes something on the Master server the cache of the Slave server get's updated.

    We have noticed that scheduled tasks are not running for some reason. So scheduled publishing of content does not work.

    We tried adding a baseUrl for the scheduled taks as described here : https://our.umbraco.org/documentation/Using-Umbraco/Config-files/umbracoSettings/#ScheduledTasks

    But that didn't have any effect.

    <scheduledTasks baseUrl="internaldomain1.com/umbraco">
    <!-- add tasks that should be called with an interval (seconds) --> <!-- <task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>--> </scheduledTasks>

    I also tried setting the baseUrl to editor.mydomain.com/umbraco but that also didn't have any effect.

    There are also no entries in the log for the task scheduler (searched for Umbraco.Web.Scheduling.Scheduler , Umbraco.Web.Scheduling.ScheduledTasks)

    If I run the same application in a non load balanced setup everything works as it should.

    Anybody got an idea what i'm missing here ?

    Dave

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Apr 01, 2015 @ 08:09
    Dave Woestenborghs
    0

    Still need some help on this. All help is appreciated.

    Dave

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Apr 01, 2015 @ 15:38
    Dave Woestenborghs
    0

    Bumping this up again.

    Dave

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Apr 02, 2015 @ 10:23
    Dave Woestenborghs
    104

    After some more digging throug the logs I found this :

    2015-04-02 09:27:38,103 [48] DEBUG Umbraco.Web.Scheduling.Scheduler - [Thread 48] Scheduling interval executing
    2015-04-02 09:27:38,119 [48] DEBUG Umbraco.Web.Scheduling.Scheduler - [Thread 48] Current server (XXXX) detected as a slave, no scheduled processes will execute on this server
    2015-04-02 09:27:38,119 [48] DEBUG Umbraco.Web.Scheduling.Scheduler - [Thread 48] Scheduling interval complete (took 4ms)

    With this information I went on search throught the Umbraco source.

    If the server is detected as Slave instance than it will not start the scheduled tasks :

    https://github.com/umbraco/Umbraco-CMS/blob/7.1.9/src/Umbraco.Web/Scheduling/Scheduler.cs

    So in this file (https://github.com/umbraco/Umbraco-CMS/blob/7.1.9/src/Umbraco.Core/NetworkHelper.cs) we see that the machine name or dns hostname is used to determine if a instance is the master instance.

    After updating the serverName attribute to match the machine name scheduled publishing started working.

    I made a pull request to update the documentation.

    Dave

  • Kevin Nolan 9 posts 60 karma points
    Apr 15, 2015 @ 03:06
    Kevin Nolan
    0

    Awesome - I've been having this issue with a load balanced version of 7.2.2 - this fixed things up nicely! Thanks heaps, Dave :)

Please Sign in or register to post replies

Write your reply to:

Draft