More Xojo Web App (Stand alone) on the same computer

Hello All,

Can more than one Stand Alone web app be run on the same computer? If so, any special setups that need to be done?

Thanks,
Tim

Just make sure they do not use the same port.

No problem, I do it all the time… what michel Bujardet said

Thank you both!
Which ports do you normally use? My existing is 8080…

Tim

anything above 1024 which is not a port needed for another service.

If you want to see your open ports on macOS or Linux, then in terminal or in ssh, type:

netstat -an | grep tcp

to show only the listeners, type:

netstat -an | grep LISTEN

btw: with +r you can search the history in terminal. Repeated hitting of ctrl+r repeats the search.

We even have more than one instance of the same app running on different ports with a little load balancer app that the users navigate to and the balancer then picks an instance to forward the user to. Works a treat.

A few things to be aware of…

On the system that is hosting the web app:

  • check to make sure that there isn’t another program/service that would be using the same port
  • check to make sure that no security programs will interfere with that port

On client systems:
Some browsers, security software and routers/firewalls may block traffic to “non-standard” ports. If this web app is destined to be accessed over the internet, and it listens on port 6000, for example, some end users may experience problems accessing it,

Here is a link that has some relevant info:
https://neo4j.com/developer/kb/list-of-restricted-ports-in-browsers/

what is little load balancer app??? what about the balancer?? where is something you can download or is it something you did??

@Richard Duke Hi Richard. This is something we have written.

In our database we have an “AppServers” table that has a list of instances of our application with the URL and port number. We load this into an “AppServers” array at the App level and then in the HandleSpecialURL of our load balancer, we rotate through the array with each request:

Dim n As Integer

' This status tells the browser to redirect to the location specified and repeat the POST!
Request.Status = 307

' Increment the Current Server Index
App.CurrentServerIndex = (App.CurrentServerIndex + 1 ) Mod (MaxServerIndex + 1)

' Make sure the selected server is in use
While App.AppServers(App.CurrentServerIndex).InUseYN = False

' Increment the attempts and throw an error if the attempts exceeds the number of servers
n = n + 1
If n > App.AppServers.Ubound Then
Raise New RuntimeExceptionEx (1, "No Active Servers after attempts: " + CStr(n))
End If

App.CurrentServerIndex = (App.CurrentServerIndex + 1 ) Mod (MaxServerIndex + 1)
Wend


' Set the location to the current server API URL
Dim APIURL As String = App.AppServers(App.CurrentServerIndex).ApplicationURL + "api/" + Request.Path
Request.Header("Location") = APIURL

' Return true sends the request back to the browser
Return True

We have a status page so admin staff can navigate to the load balancer and see all the AppServers running together with the number of sessions and whether the server is up. From this page we can set the “InUseYN” flag to stop users logging into a specific instance. This allows us to stop an instance if there are problems. We can also do “no downtime upgrades” by moving users over to a new set of instances and then stopping the old instances.

Having multiple instances of a standalone app on Windows makes much better use of resources and is much more scalable.

Give it a go!

Thanks Jim Brock for explain to me.

You can also search for haproxy and nginx on the forum. People are using both of those with Xojo apps as well. haproxy is a fantastic choice IMO. I use it multiple places and it’s been very solid if you stick with the production releases.

I also posted on the weekend and entry about a simple load balancer for one of our clients:

https://www.mbsplugins.de/archive/2019-03-03/Simple_load_balancer_for_Xojo_

[quote=426921:@Christian Schmitz]I also posted on the weekend and entry about a simple load balancer for one of our clients:

https://www.mbsplugins.de/archive/2019-03-03/Simple_load_balancer_for_Xojo_[/quote]

i assume this one can run on window server ???
the haproxy and nginx i assume is for linux server

The little script we have could also work on Windows.
It’s cross platform.