Xojo web app as backend server intermediary

Hi,

After a longer while I am looking at Xojo again.

Can I use Xojo to create a backend service on a server. I have a game app that is written in javascript and to access an SQL database I need server code that translates HTTP Ajax requests to SQL requests to the server, and then returns a response in JSON format. I’d like to know if a Xojo web app could play the intermediate role to receive the HTTP request, submit the SQL statement to the server and package the response in JSON …

thanks,

Dan

Why wouldn’t you do this in PHP? Xojo seems like a heavyweight solution to a lightweight problem.

To answer the question, yes, you could do this. Though, as Tim suggested, it may not be the fastest solution.

I’ve done this with Xojo for a few projects in standalone mode behind a load balancer. Considering I can share code with other apps which speeds up development time its actually very fast. There is some overhead with Apache/PHP - not significant but standalone apps can be pretty fast as long as you monitor concurrent API requests. RAM is the big issue and I would not dare do this in CGI mode as CGI is very slow compared to standalone.

I have done that a couple of times.
It’s often easier and quicker if Xojo is needed to just use web framework and HandleSpecialURL event than writing own web server.

Especially if you’re already familiar with Xojo. Learning a new language has its own problems.

@Paul Lefebvre has two upcoming webinars on this very subject.

Really good question, IMO.

I am doing some tests w/o WEB edition just as a process with ServerSocket / TCPSocket / JSON.
I though about designing it firstly as an option (Web target), but I need to get the wider audience as possible as I think it can be a good 3rd party add-on candidate.

Client - Server comms are just a few JSON packets, and I wonder if you have developed some kind of backend using this arch. It will have a SQLite DB, handling code on DataAvailable Event ( I wonder if I need to avoid loosing cycles in this event or move to threads ) and will need to handle as much connections as possible (little traffic). Do you think using this with Xojo is plausible for a 500 connections average?

As it’s going to be a 3rd party code, can’t use any plugins here to make it available to all Xojo people.

It was the initial implementation of Web Edition that got me interested in web development and it’s also what convinced me to learn php/Javascript instead.

I do not think WE is the “all to everybody” program. It does a very nice job at quickly building an app or prototyping a web service, for instance, but it is heavy as an aircraft carrier. And kind of slow. Also, I had to endure unexplained crashes and app unresponsive several times since I placed my first WE app online back in 2013.

I rather use PHP when I need very fast response and high reliability. For instance, I would certainly not replace the php paypal listener by Xojo, even if it could handle http1.1. It has been some 7 years I used php for that and sending download instructions by mail to customers, and never once had a downtime.

JavaScript is kind of mandatory for any Xojo “out of the ordinary” app.

That said, my latest iOS app uses a Xojo web service to download fonts to the device. But I have set it up to use two different apps, so if one goes down or hangs, it will fetch the other. Sort of a fault tolerant method :slight_smile:

It is a big problem. Sometimes the application stops responding, sometimes it seems to slow down without apparent reason (no additional traffic), sometimes it seems to freeze 1 or 2 seconds, etc.

Maybe we should open a thread on it, to share our experiences and try to discover commonalities, because these problems are difficult to isolate.

Sorry if I am becoming a one-note-song but server configuration and the overall system design has a HUGE effect on overall responsiveness and load capacity of web apps. I have found that load balancing multiple standalone app instances and taking full advantage of the server’s init system (upstart/systemd/whatever) to manage stalled or crashed instances helps tremendously.

That said - Xojo Web Addition apps are a good choice for a back-end service. I am currently working on a system like this right now tying together 1500 retail locations with a legacy ERP system. Web edition makes creating a GUI for admin or reporting super easy. You can handle requests with HandleUrl. Xojo is REALLY performant in this situation (of course, it depends on what you are doing).

I have used a simple load balanced configuration like I am suggesting and load tested with ApacheBench and Jmeter and have seen very impressive performance. Again - a lot depends on the configuration and what you are doing in your app. I am talking about XML responses in my situation. If you are rendering images or doing huge database queries your mileage will vary accordingly.

I have worked in LAMP for years and I am not trusting Xojo with my client’s data and businesses blindly. So far I have not been disappointed at all - Xojo makes many things much much easier. But you may have to think outside of the LAMP box and rely on some of your ServerOps skills as well. In my opinion, the IDEAL use for Xojo web framework is this very situation. Developing a backend service with admin GUI, or a web application for internal use.