Server stress testing: Playback a recording over a remote server
by Edward Rotberg · in Torque 3D Professional · 03/18/2010 (4:40 pm) · 1 replies
I haven't found anything like this on the boards, but that's not unusual. I seem to always be headed in a different direction than everyone else around here :/
I want to stress test client/server capabilities and find out what our limits will look like. I have already figured out how to run a headless client (which required some modifications to both the engine and existing scripts due to a bug with LightManager related code, and modifying my own custom renderDelegates), and even have it automatically start a playback or a recorded demo - under the stand-alone, local serer scenario. Since a NullDevice is used for this, I should (read as "am hoping to") be able to start up multiple client instances from a single computer.
So at this point, I'm left with two questions. The first is where in the script file would be the best place to kick off the playback. I'm going to start by trying to put the code in onMissionDownloadComplete() in missionDowload.cs, but I have a feeling that won't be the best sport for it, even if it happens to work.
The second question has to do with actually kicking off the playback itself. This is automatically accomplished (at least in stand-alone mode) by executing the following code in script instead of calling loadStartup() in init.cs:
= Ed =
I want to stress test client/server capabilities and find out what our limits will look like. I have already figured out how to run a headless client (which required some modifications to both the engine and existing scripts due to a bug with LightManager related code, and modifying my own custom renderDelegates), and even have it automatically start a playback or a recorded demo - under the stand-alone, local serer scenario. Since a NullDevice is used for this, I should (read as "am hoping to") be able to start up multiple client instances from a single computer.
So at this point, I'm left with two questions. The first is where in the script file would be the best place to kick off the playback. I'm going to start by trying to put the code in onMissionDownloadComplete() in missionDowload.cs, but I have a feeling that won't be the best sport for it, even if it happens to work.
The second question has to do with actually kicking off the playback itself. This is automatically accomplished (at least in stand-alone mode) by executing the following code in script instead of calling loadStartup() in init.cs:
new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
if(ServerConnection.playDemo(%file))
{
Canvas.setContent(PlayGui);
Canvas.popDialog(RecordingsDlg);
ServerConnection.prepDemoPlayback();
clientCmdMissionStart();
}
else
{
MessageBoxOK("Playback Failed", "Demo playback failed for file '" @ %file @ "'.");
if (isObject(ServerConnection)) {
ServerConnection.delete();
}
}where %file is the file name of the recorded "demo" script. Note that you use the ServerConnection object to start the demo playback. However in the stand-alone case that is the local server connection, and it's added to the RootGroup. I'm sure I'm not supposed to add the remote server connection to anywhere, and I'm not planning to - at least at this point. I'm hoping that this will just work with a remote server connection, but things rarely work out as I hope, so if you have any ideas about this, let me know.= Ed =
About the author
Torque 3D Owner Edward Rotberg
Initially when I tried what I have described above, I get an "Error, cannot change event behavior after a connection has been established.", on the ServerConnection.playDemo() call. So I tried to move some of the code and put the ServerConnection.playDemo() call in just before the connection is established in JoinServerDlg.gui. This time the ServerConnection.playDemo() call does not trigger the error - the error just gets triggered later on.
In looking at how this stuff works, the playDemo function appears to read the recording file and effect the load of the mission in this way. This will simply not work with the server connection which also wants to cause a mission download. Unfortunately, it appears that the mission loading information is co-mingled with the actual event information contained in the recording - or at least I haven't figured out - yet - how to separate them from each other.
One other note. The ServerConnection.prepDemoPlayback() function that is referenced in my original post does not seem to exist - at least I have been totally unable to find it. At this point I am assuming it is a vestigial remnant of some previous incarnations of this code and is no longer used. Apparently calling non-existent ConsoleMethods results in a NOP?
Anyhow, I'm beginning to think that I might not be able to use the recordings to do my stress testing. I'm hoping that someone with more inside information on how all of this works might respond with something useful.
Here's to hope, and thanks in advance to any who can offer any advice on this.
= Ed =