Page 1 of 1

Web-based discrete event simulation

Posted: Sun Dec 20, 2009 11:53 am
by Joerg
I am completely new at runrev and looking for a possibility to realize a web-based discrete event simulation (business game) in order to simulate the processes within a hospital. I have to do this for my phd-thesis.

First of all maybe I would like to explain you the requirements or better said, the basic idea of the game:
1) The game host (different persons for each game) and the players of a game should have have the possibility to enter data via web forms.
2) All the data should be saved within an MS SQL Server Standard database, running on an especially for the game bought server with Windows 7 Ultimate
3) The game has many periods and when all players have entered their data for the period successfully, the game host should be able to start the discrete simulation via web each period.
4) The simulation could last many hours, depending on the amount of players and because of the complex database dependent calculation/simulation processes.
5) In the meantime, the game host and the players should get a status about the simulation process every time when they request the website and logged into their game.
6) When the simulation has finished, they should get an information, e.g. via email, that the simulation has been finished.
7) Then they should be able to request the results of the simulation (most of all charts, a balance sheet of the hospital they play and so on)

What I want to know is, how can I realize such a game with revolution? What structure is the best?

Coming from ASP.NET and C# the first thing that came to my mind was, to realize it with server-side scripts. But unfortunately, I cannot use On-rev because, as I mentioned above, we have bought a server just for the game and I have to run the simulation and all the other processes on this server. Due to this restriction, the second thing that came to my mind was, to realize the client side with html/revlet and run the simulation via cgi then. But I don't know if this is a good idea, maybe because of the fact that in case of having more than one cgi scripts running on the server at the same time, the webserver could be used to capacity. So, my last thought was, to realize the client side with html/revlet and uses cgi to start a runrev simulation programm which is installed on the server every time, when a game host starts a simulation - but I do not know, if this possible and/or a good idea?

I am not lucky with all of that because I am not sure, what would work best or what kind of approach I have not considered. Hence the question again:

The main question is: how can I realize such a game (simulation) with runrev? Do you have some other ideas or hints for me?
A second question: does there exist some simulation libraries for runrev (e.g. for distributions (poisson, normal, weibull and so on)

Thank you very much for your answers.

Joerg

Re: Web-based discrete event simulation

Posted: Sun Dec 20, 2009 2:33 pm
by BvG
If the server is indeed a new machine, I'd be incredibly surprised if any single cgi call could stall the whole server. Each cgi call is started as it's own thread (at least in apache, no idea how ISS works, and I'd suggest not using it anyway). Therefore any recent multi-core machine will have 3 full (or as with my newest computer 7 (yes SEVEN!!!)) idle cores waiting for other requests, and usually requests don't even take 0.1 percent of one core to execute. Note that some notebooks and cheaper computers "only" have two cores. If you're using a rack server, chances are that your computer has a whooping 16 cores (two cpu's), and most of the time 15 of em will simply not be of any use whatsoever.

You could theoretically code your own server, which decides itself to delegate everything to another thread (runrev has no threads, but there's many ways to pass data to another application). But if you're looking for maximised parallel performance, using cgi's in apache should be easier to implement, and more efficient. Also, that approach will show no slow down, even for dozens of http request per second, each using heaps of calculations. Another Idea would of course be, if you know asp.net and are comfortable there, why not use that?

Rereading my rather ramblyotic view of todays multi core world, I remembered an important fact that one should always keep in mind when using cgi's (and not knowing that might be the source of your question): Rev CGI's do not have a GUI. The code that is executed when a cgi starts is tiny compared to what happens when a windows standalone made with Rev is started. So obviously they use much less processing power.

As for libraries, the only things I know are the build in StatRound, standardDeviation, median and average functions. But then, I'm not interested in statistics at all.

Re: Web-based discrete event simulation

Posted: Sun Dec 20, 2009 9:54 pm
by Joerg
BvG, thank you very much for your answer. Yes, the server is indeed a new machine and a rack server too. The reason why I don't want to use ASP.NET is, that I changed to Mac and want to use it as an cross platform development environment too. And, I tried something with Visual Studio, ASP.NET and C# but actually I do not really feel comfortable with it. Depending on your suggestions I think I will go on with using revlets, CGI's and the apache web server.