Web Worker vs Typical Model

Sometime ago, I found an article where a programmer was explaining the advantages in having a web worker model for high traffic Web applications. The model he described was as follows:
1 Web application where the majority of the processing was done by console applications running on the same server or different servers. The console applications did the heavy processing work and just passed the results to the web application to present the data. He delineated many benefits for this model vs the traditional web model.

I am very interesting to hear the opinions of all of you to see if there are any advantages in doing this with Xojo. In my opinion this can alleviate a lot of the memory consumption that a single Web Application may have under heavy load.
How would this model would look under Xojo? Probably like this:
** 1 Web Application running. When a client connects all request and processing of data or files is done through the a console application.
** The Web Application can open another console app instance based on the number of active sessions. The more Sessions ( the more heavy traffic) the Web App can continue creating instances of a console app.
** When Sessions are destroy the Web App can also close some of the open console apps.

Many questions come on how to achieve this but before I try something like this I would like to hear from you all if this is something worth exploring.

Plus

  • helpers can be scheduled by the OS preemptively
  • if one crashes it won’t take the whole server down
  • you can really max out every CPU & all memory on a server

IF you are having performance issues with the web app, it can certainly help. But if you’re not, it just adds overhead and complexity.

In most cases I think it would just be easier to load balance between multiple Xojo web apps. A console helper would come into play with any task that might lock up the entire web app for a period of time, resulting in one session blocking all the rest. But for a normal site where every task completes quickly but a lot of users are connecting at once, Xojo behind a load balancer works well.

Key is finding balance. You can take this approach very far and just add unnecessary complexity, as Tim notes. You could also use it as an opportunity to modularize your system. For example, many here who have had their web app send lots of email have run into performance issues, and some have just written daemons to handle email sending. Your app adds an email to some queue – maybe a folder, a file, a database, whatever – the daemon sends them out and marks them sent. I could imagine some third party writing some common building block modules that you might be able to use without much effort in your web app centered system.

I’d start by asking yourself what generic modules, if they existed, that you could use to give you a head start on your system. Design around that and implement those modules. You will get 80% of the benefit this whole approach can get you.