In this example we demonstrate how an experimenter can setup client and server traffic generators.
First we illustrate the example with only one server and one client. Then we show how the same procedure can be used for a a significantly larger topology in the tutorial Case Study: 55 Clients and 5 Servers.
We demonstrate three aspects of MAGI: specifying multiple event streams, synchronizing with triggers, and a special target called exit to unload agents.
This example has three events streams; the server stream, the client stream, and the cleanup stream.
The coordination between the events can be illustrated as follows:
Event streams can be synchronized using event-based triggers or time-based triggers. The triggers are indicated as wait states in gray. The group formation and loading the agents, which is also automated by the orchestrator tool, is not illustrated above.
The server event stream consists of three states. The start state which generates a trigger, called serverStarted, once the server agent is activated on the experiment nodes.
It then enters the wait state where it waits for a trigger from the client event stream.
Once the trigger is received, it enters the stop state, where the server is deactivated or terminated.
The AAL description is as below:
serverstream:
- type: event
agent: server_agent
method: startServer
trigger: serverStarted
args: {}
- type: trigger
triggers: [ {event: ClientStopped} ]
- type: event
agent: server_agent
method: stopServer
trigger: ServerStopped
args: {}
The client event stream consists of five states. First, the client agent implementation is parameterized by the configuration state. This occurs as part of the agent loading process.
The client stream then synchronizes with the server stream by waiting for the serverStarted trigger from the server nodes. Once it receives the trigger the client agent is activated in the start state.
Next, the client stream waits for a period \(\Delta\) t and then terminates the client agents in the stop state.
On termination, the client agents sends a clientStopped trigger, that allows the server stream to synchronize and terminate the servers only after all the client have terminated.
The AAL description is as below:
clientstream:
- type: trigger
triggers: [ { event: ServerStarted} ]
- type: event
agent: client_agent
method: startClient
args: {}
- type: trigger
triggers: [ {timeout: 60000} ]
- type: event
agent: client_agent
method: stopClient
trigger: clientStopped
args: {}
The last event stream, the cleanup stream consists of two states. First, it waits for all the servers to stop and then it enters the exit state.
The exit state unload and tears down all the comminucation mechanisms between the agents. The exit state is entered by the key target is used to transfer control to a reserved state internal to the orchestrator.
It causes the orchestrator to send agent unload and disband group messages to all the experiment node and then it exits the orchestrator.
cleanup:
- type: trigger
triggers: [ { event: ServerStopped, target: exit} ]
The example output below uses the project “montage” with experiment “caseClientServer”.
> /share/magi/current/magi_orchestrator.py --control clientnode.myExp.myProj --events procedure.aal
Once run, you will see the orchestrator step through the events in the AAL file. The output will be as follows:
The orchestration tool runs an internally defined stream called initilization that is responsible for establishing the server_group and the client_group and loading the agents. Once the agents are loaded, as indicated by the received trigger AgentLoadDone, The initialization stream is complete.
Now the serverstream, clientstream and the cleanup stream start concurrently. The serverstream sends the startServer event to the server_group. All members of the server_group start the server and fire a trigger serverStarted.
The clienstream on receiving the trigger serverStarted from the server_group, sends the startClient event to the client_group. One minute later, the clientstream sends the event stopClient to the client_group and terminates the clientstream. All members of the client_group, terminate the client_agent and generate a clientStopped trigger which is sent back to the orchestrator.
Once the serverstream receives the clientStopped trigger from the client_group, it sends out the stopServer event on the server_group. Once all the servers are stopped, the members of the server_group respond with a serverStopped trigger, which is forwarded to the cleanupstream.
On receiving the serverStopped trigger, the cleanupstream enacts an internally define stream called exit that is responsible for unloading agents and tearing down the groups.
The experiment artifacts, the procedure and topology file that were used for the casestudy are attached below.
Procedure: | [casestudy_clientserver.aal]. |
---|---|
Topology: | [casestudy_clientserver.tcl]. |
Archived Logs: | [casestudy_clientserver.tar.gz]. |
Now suppose you wanted to generate web traffic for a larger topology. We discuss how the above AAL can be applied to a topology of 55 nodes in the next tutorial.