Copied to clipboard

Flag this post as spam?

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


  • Per Bolmstedt 84 posts 380 karma points
    Dec 06, 2021 @ 13:34
    Per Bolmstedt
    0

    Azure Publisher/Subscriber Load Balancing not working; single entry in UmbracoServer table. ComputerName culprit?

    We use Azure Publisher/Subscriber Load Balancing (1 App Service for Umbraco Admin, 1 App Service for the front-end) and it worked fine in 8 but we can't get it to work in 9.

    The effect is that the cache needs to be cleared manually on the front-end (which also means Umbraco Admin has to be enabled on the front-end).

    We can see that the same entry in the umbracoServer table gets overwritten when Umbraco Admin is started on a server, and there is only one single entry.

    Load Balancing is setup according to the documentation and both App Services have the correct server role accessor, we can see in the logs.

    It looks like computerName is used to identify an installation, but since both our App Services are on the same Plan, they are "on the same computer". If we used on-premise hosting they would still be on the same computer. Maybe the problem is as easy as this? If so, what could the resolution be? Could we override the computer name resolver?

    Also, why was this not a problem in 8? I can see there is an umbracoServer table in 8, but its contents have not been updated for years on our production 8 installations.

  • Per Bolmstedt 84 posts 380 karma points
    Dec 07, 2021 @ 10:43
    Per Bolmstedt
    0

    The problem is that the computed server identity is the machine name and, for Azure, an application ID that is consistent for all nodes of a load-balanced cluster.

    Server Registration Service:

        /// <summary>
        /// Gets the local server identity.
        /// </summary>
        private string GetCurrentServerIdentity() => Environment.MachineName // eg DOMAIN\SERVER
                                               + "/" + _hostingEnvironment.ApplicationId; // eg /LM/S3SVC/11/ROOT;
    

    AspNetCore Hosting Environment:

        public string ApplicationId        {
                ...
                var appId = _serviceProvider.GetApplicationUniqueIdentifier();
                ...
                // TODO: Test on IIS, hopefully this would be equivalent to the IIS unique ID.
    

    I don't know what _serviceProvider.GetApplicationUniqueIdentifier() is (Docs) but it is the same for the Admin App Service and the front-end App Service. So it would seem the machine name and the app ID simply are not useful server identity components on Azure.

    Please advise.

    If anyone is successfully running a load-balanced 9 on Azure, how did you get it to work?

    Umbraco has its own "ID" (in the application settings), is there a way to use that instead? Then we could set it differently on the Publisher and the Subscriber.

    Could we swap out the Server Registration Service for our own implementation?

  • Gabor Ferencz 36 posts 167 karma points
    May 26, 2022 @ 13:48
    Gabor Ferencz
    0

    I have the same issue in Umbraco 8, in KUbernetes pods. For me now, the names of the applications aren't even going into the UmbracoServer table.

    Did you find any way to resolve this?

  • Per Bolmstedt 84 posts 380 karma points
    May 26, 2022 @ 19:19
    Per Bolmstedt
    100

    We did actually. We created our own IHostingEnvironment which uses an appSetting for the applicationId, and then we use different appSettings (and different applicationIds) for each installation.

    This does not support Azure horizontal scale-out since all instances would use the same appSetting. But it does make load balanced setups work in Azure.

    We used the AspNetCoreHostingEnvironment from the Umbraco sources (if I remember correctly) and modified the applicationId calculation.

Please Sign in or register to post replies

Write your reply to:

Draft