Load Multiple Examples/Apps?
Added by Matthew Kettlewell over 14 years ago
Is there a way to have multiple apps running simultaneously?
From the examples, it appears that only one can be running at a time...
This would be for either the builtin or for FCGI...
It seems that the built-in server is actually built into the executable, and if so, makes me think not possible.
For FCGI, I've not played enough to know what it can/can't do...
I see the wt-home app for internal paths, but I'd like to modularize a bit more so that if, for example, I clicked on the "run example" link in the examples, it would actually open a new window and run the example (like it does on the real home page), but instead of being integrated, would be a separate executable.
Is this possible?
Replies (3)
RE: Load Multiple Examples/Apps? - Added by Wim Dumon over 14 years ago
Matthew Kettlewell wrote:
Is there a way to have multiple apps running simultaneously?
From the examples, it appears that only one can be running at a time...
This would be for either the builtin or for FCGI...
>
Yes, of course it is possible to run multiple examples simultaneously. How to do it depends a bit on the connector:
- FCGI and ISAPI: this just works. Deploy the examples in different directories, and use a browser to surf to them. The examples will all be started and run at the same time.
- Built-in httpd: Every example is a separate executable that listens on a configurable port. A port can only be listened to by one process, so if you're running multiple examples, each one has to be deployed on a different port. You do this by specifying a different port with the ---http-port startup parameter.
It seems that the built-in server is actually built into the executable, and if so, makes me think not possible.
>
For deployment in such case, we run a reverse proxy (preferably an asynchronous server like nginx) in front of the Wt applications. Forward all requests for a certain path to another port on the same machine (probably you'll want to set the ---http-address for those wt servers to 127.0.0.1, so that only localhost can connect to them).
For FCGI, I've not played enough to know what it can/can't do...
>
No problem here.
I see the wt-home app for internal paths, but I'd like to modularize a bit more so that if, for example, I clicked on the "run example" link in the examples, it would actually open a new window and run the example (like it does on the real home page), but instead of being integrated, would be a separate executable.
Is this possible?
That's exactly how we deploy our homepage. We use a reverse proxy in front of wthttpd servers, each listening on its own port (e.g. 8000 to 8010) on the localhost (127.0.0.1) address.
BR,
Wim.
RE: Load Multiple Examples/Apps? - Added by Matthew Kettlewell over 14 years ago
Thanks for the thorough response, I think I'm getting the concept now.
A couple more questions on this topic:
I currently have a VPS with hostgator, and think I can set up either an Apache/FCGI or Apache/wthttpd scenario
From a performance perspective (generalized of course), which would be the better option for a high traffic site?
And if I decided that Apache wasn't doing it for me, what is a better setup to use? Nginx? lighttpd? Apache? wthttpd? FCGI?
Thanks
Matt
PS - If I get a hostgator VPS setup with WT, is there a place on this site that I could post a tutorial/instructions for others?
RE: Load Multiple Examples/Apps? - Added by Wim Dumon over 14 years ago
Matthew Kettlewell wrote:
Thanks for the thorough response, I think I'm getting the concept now.
A couple more questions on this topic:
I currently have a VPS with hostgator, and think I can set up either an Apache/FCGI or Apache/wthttpd scenario
From a performance perspective (generalized of course), which would be the better option for a high traffic site?
>
Apache/wthttpd is a bit easier to configure. It's unlikely that FCGI will support websockets (the next release of Wt will). Performance wise, there are few important reasons to prefer the one above the other.
There's not many reasons to choose FCGI above a reverse proxy. In fact, the only reason is that with FCGI, you can configure Wt so that not all sessions reside in the same process. This is for example an advantage when your application would crash - in that case, not all sessions are terminated.
On the other hand a reverse proxy also has its advantages. For example, file upload progress bars are not shown correctly when using the fcgi connector (because all fcgi implementations cache the complete request before forwarding it to the fcgi program, so Wt can't monitor the progress).
And if I decided that Apache wasn't doing it for me, what is a better setup to use? Nginx? lighttpd? Apache? wthttpd? FCGI?
>
I'd recommend an asynchronous reverse proxy such as ngingx. nginx has a clear advantage compared to apache because it's a fully asynchronous httpd. It's not that apache is bad; in certain cases it won't scale very well (e.g. when you would use Wt's serverpush extensively, which quickly consume apache's thread pool).
A bare wthttpd deployment is possible too, but wthttpd is conceived to be the ideal http server for Wt application (e.g. it includes websocket support, can properly serve html5 video, asynchronous architecture, ...). It probably lacks some features to be considered a good generic http server.
PS - If I get a hostgator VPS setup with WT, is there a place on this site that I could post a tutorial/instructions for others?
Sure, make a section in the Wt installation wiki:
http://redmine.webtoolkit.eu/projects/wt/wiki/Wt_Installation