Keeping parts of the program in memory on the server

I’m developping a couple of engines to summarize texts and classify them. Is there a possibility to keep those engines in memory on the server so they don’t have to be reloaded every time a user wants to summarize a text? (It takes about 5-10 seconds to load a language engine).

Something like this:

Client -----------------------------> Server (sending text file via a web app, actually more like an API call as the web app does not need an interface)
----------> web app ‘connects’ with the appropriate language engine that is already running on the server
----------> Engine summarizes the text en gives the result to the web app
<---------- Web app returns the result

Any thoughts on the design of this?

I may only guess due lack of more details. But what about a deamonized app sharing its information with your web app gateway on same (or maybe another server)? I would suggest a mysql database server where all texts or jobs are queued and the results are written back by your dameonized app to the queue.

Sorry, I so caught up with the engines that everything seems obvious for me :slight_smile:

For the moment I’ve got an exe (Windows) for every language engine. I’m looking to convert the code to Xojo and I was thinking of making the engines into Web apps running on an external server. Users would the get a REST API to access those apps and summarize texts.

However, in my case that would mean every time the user makes a request, the web app would load (5-10 seconds), perform the summarization and then close.

I think you are right I will have to build the engines, not as web apps, but as desktop apps running in the background on the server. Then one web app (or PHP) that decodes the REST request and does nothing but pass the request to one of the engines (maybe indeed writing a ‘queue’ in a database). The desktop apps would check this db, perform the action, and inform the web app it’s ready so it can send the summarized text back to the user.

Thank you for your thoughts Tomas!

I would use the Empty Service Project template & set the engines up as windows services. You’ll get better control & can start the engines with the server.

In terms of Scalability I always would prefer to keep the Web Stuff (REST API or UI) as small as possible and put the logic or engines in services behind. So you can run each tier of your engines on seperate servers. Even the mysql server as kinda dispatcher or queue is very good scalable (and should be run on a seperate VM or Server than the Apache CGI or Web-Standalone Server XOJO Web App)