Updating web app with hundred users

  1. 7 months ago

    ronaldo f

    30 Nov 2019 Philippines

    Hi Guys,

    I would like to solicit on how do you do things, like:

    It's been obvious that to update XOJO web app, it need to kill the app and reupload a bunch of files and re-run again. However, what if you found some bug and you need to update your web app asap while there is a hundred users connected to it.

    How do you handle this type of situation?

  2. Michel B

    30 Nov 2019 Testers, Xojo Pro

    You simply cannot update the app while it runs.

    But, do you really have hundreds of visitors 24 hours a day ?

    With a cgi app, you can set autoquit to true, so when all sessions are closed, the app quits.

    Here is the code created by Phillip Zedalis of 1701 Software I have in my apps Open event handler :

    if not DebugBuild then
      timerShutDown = New Timer
      AddHandler timerShutDown.Action, AddressOf timerShutDown_Action
      timerShutDown.Period = 10000
      timerShutDown.Mode = Timer.ModeMultiple
    end if

    TimerShutDown is a Timer property of app

    Here is the content of the timerShutDown_Action method that handles the Action event of the timer:

    Public Sub timerShutdown_Action(sender As Timer)
      dim f as FolderItem
      f = getFolderItem("")
      if not DebugBuild then
        f = getFolderItem(f.NativePath + Lowercase(App.ExecutableFile.Name)+".cgi", Folderitem.PathTypeNative)
        f = getFolderItem("My Application.debug", Folderitem.PathTypeNative)
      end if
      if (f.Exists() = False) or App.SessionCount = 0 then
      end if
    End Sub

    If the .cgi file is removed from the server, the app quits. You can upload a new version, so next time a visitor comes up, he gets the updated app.

  3. Jens K

    30 Nov 2019 Testers, Xojo Pro Europe (Germany)

    Probably you could use a loadbalancer (for example one of the capabilities of nginx) to solve this problem.

  4. Maximilian T

    1 Dec 2019 Testers, Xojo Pro Europe, Germany, Berlin

    Look here for a starter on how to build a load balancer. Kudos to Christian for posting this.

  5. Christian S

    1 Dec 2019 Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    Thanks @MaximilianTyrtania for pointing to my own blog.

    That's a very simple system we have working with a few client projects.
    Easy and reliable.

    Can work with 4 well, but also with 10 instances.

  6. Steve K

    1 Dec 2019 Testers, Xojo Pro, XDC Speakers The land of Oz

    If you're using Xojocloud you can request a load balancer to be created. You then point your domain name to the load balancer and it will route to your online servers. That way you can take them down one at a time and update them. We currently have groups of two ui servers and a database server behind a load balancer. It has worked well for our web application.

or Sign Up to reply!