Montage Banner

Table Of Contents

This Page

Case Study: Client-Server

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.

Event Streams

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:

../_images/casestudy_clientserver.png

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.

Server Stream

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: {}

Client Stream

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: {}

Cleanup Stream

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} ]

Running the Experiment

  • Swap in the experiment using the network description file given below.
  • Once the experiment is swapped in, run the orchestrator, giving it the AAL above. The orchestrator needs an AAL file and, a node to connect to in the experiment. Assume your experiment is named myExp, your DETER project is myProj, and the AAL file is called procedure.aal.

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: screenshot

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].

Scaling the Experiment

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.