How to use TD on 3 WebServers with LoadBalancer and IIS 8.5?

Mar 2, 2016 at 1:25 PM
Hi,

at first: I like your project and your code very very much, it is clearly structured, well documented and it works like charm from the first second.

I have a little problem with starting the Dependency on our infrastructure:

So we have a SingleSiteApplication with around 100 users at the moment (will be much more when we go live) with a LoadBalancer and 3 WebServers where the BackEnd runs at the same code.

This means, when I understand it correctly, I have to make 3 dependencys: each BackEnd should get every message and notify every user on the frontend in a case of, e.g. a global message for all.

At the moment this is my code:
     SqlTableDependency<ApplicationSetting> appSettingsDependency = new SqlTableDependency<ApplicationSetting>(clsConfig.getInstance().SQLServerConnectionStringSignalR, "ApplicationSettings",
                 mapper: null,
                   updateOf: (List<string>)null,
                   automaticDatabaseObjectsTeardown: true,
                   namingConventionForDatabaseObjects: machineName + "AppSettings");
That means, as far as I understand, I create the databaseobjects for each machine - 3 triggers for 3 machines, 3 waitlists, etc. Is this correct?

But when to start, when to stop and how to determinate if my connection is still okay?
My IIS never restarts (once a month maybe) - when I start the connection with
appSettingsDependency .onChange = xxx; appSettingsDependency.start() on the Global_AppStart this will not work, right?

So can I check if the state is still okay when a user connects? Make this sense and how to do that?

I tried to just reinitialize the objects but the State is allways "WatForStart".
Coordinator
Mar 2, 2016 at 6:04 PM
"That means, as far as I understand, I create the databaseobjects for each machine - 3 triggers for 3 machines, 3 waitlists, etc. Is this correct?"
Yes it is correct. This is because every time a message is delivered, it is removed from the queue. The relation is 1:1

"appSettingsDependency.start() on the Global_AppStart this will not work, right?" Yes. You can have an example here:
https://tabledependency.codeplex.com/wikipage?title=WebApi


"So can I check if the state is still okay when a user connects? Make this sense and how to do that? " If you mean check is SqlTableDependency is still working, you have two option. By code SqlTableDependency instance has this property:

public TableDependencyStatus Status { get; }

By your self, simply checking if the database monitorated by table dependency has still the trigger generated once you call .Start method.

"I tried to just reinitialize the objects but the State is allways "WatForStart"." You cannot reinitialize db object generate from TableDependency. If your IIS needs to be stopped BUT you want to keep alive triggger and relative queue in order to receive message about changed happened when IIS was stopped you have to create SqlTableDependency with automaticDatabaseObjectsTeardown = FALSE.

I hope this help you.