🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
Load balancing MDriven Turnkey and MDriven Server

Load Balancing the Turnkey Server

Use sticky-session to make sure the user returns to the same node during the session.

If you need to signal the LoadBalancer, we suggest that you model a page and make it RestAllow=true. Give the URL to your load balancer and return the data you have agreed upon. For example, you may want to return Active or InActive in order to implement some application setting to move traffic away from a node you will work on.

In some examples, we have a page named AreYouOkCheck that the load balancer calls to see if 200 OK is returned. Give the load balancer the page's REST address, not the address you see in the browser: in a browser address like https://APP/App#/AreYouOkCheck/$null$, everything after # is never sent to the server, so the server answers 200 OK whether the page works or not. The REST address has the form https://APP/MDrivenRest/get?ViewModel=AreYouOkCheck – see REST services for the exact form for your application.

Behind a load balancer, also set each application's own address with HardServerUrl.

Load Balancing the MDrivenServer

Use Fail-over in the Load Balancer. Only one MDrivenServer should be used at a time, but you can have hot standbys.

Since the Load Balancer must know which of the multiple MDrivenServers is a candidate for being the hot one - and also remember which one is hot - you can give the Load Balancer the URL: https://<yourserver>/home/ReturnNodeNameIfOk

You then set the unique names of the nodes in the UserAndRolesAdmin page in MDrivenServer.

It is important that the hot standbys do not execute ServerSide-jobs, since these should only be on one server.

1: Make sure the Server name is set - you want it to be unique per node in the load balance group.

2: If the "Check Load balancer before running jobs" is not checked, everything works as normal and periodic actions will always run (if the app is Started).

3: If you set a URL in Load Balanced MDrivenServerUrl, you will - prior to running PeriodicActions - check what you get back from <LoadBalancedAdress>/home/ReturnNodeNameIfOk - and, if the returned value is ==TheNameOfThisServer, you will know that you have the hot-one; if not, you don't have the hot one.

4: The last known result from the Load balance check will be written to LoadBalancerStatus.

5: If we append the string "THIS NODE HAS REQUESTED TO BE LEFT ALONE" to the return name from /home/ReturnNodeNameIfOk, then the names will not match and we will not run periodic actions.

We changed the logic to use HideFromLoadBalancerUntil, which is a DateTime in the future; if it is in the future, we return a 500 error that the Load Balancers will interpret as an error. We will return this error until the timestamp has passed; then the node becomes online again. This change will enable you to reach servers that may not be reachable from any other address that is load balanced.