.. _casestudy_clientserver55: Case Study: 50 Clients and 5 Servers ==================================== In this example we demonstrate how an experimenter can setup client server traffic generators in a larger topology. This casestudy is identical as compared to the last one except the topology is significantly larger. Event Streams ------------- This example has three events streams; the **server stream**, the **client stream**, and the **cleanup stream**. Mapping to the Topology ^^^^^^^^^^^^^^^^^^^^^^^ The groups directive in the AAL file allows mapping a agent behavior to one or more nodes. .. code-block:: yaml groups: client_group: [clientnode-1, clientnode-2, clientnode-3, clientnode-4, clientnode-5, clientnode-6, clientnode-7, clientnode-8, clientnode-9, clientnode-10, clientnode-11, clientnode-12, clientnode-13, clientnode-14, clientnode-15, clientnode-16, clientnode-17, clientnode-18, clientnode-19, clientnode-20, clientnode-21, clientnode-22, clientnode-23, clientnode-24, clientnode-25, clientnode-26, clientnode-27, clientnode-28, clientnode-29, clientnode-30, clientnode-31, clientnode-32, clientnode-33, clientnode-34, clientnode-35, clientnode-36, clientnode-37, clientnode-38, clientnode-39, clientnode-40, clientnode-41, clientnode-42, clientnode-43, clientnode-44, clientnode-45, clientnode-46, clientnode-47, clientnode-48, clientnode-49, clientnode-50 ] server_group: &slist [ servernode-1, servernode-2, servernode-3, servernode-4, servernode-5 ] In this example, we observe that there are two groups client_group and server_group. The client_group consists of all 50 clientnodes. The server_group consists of 5 servernodes. Additionally, we use yaml pointers to annotate the server_group as "slist". The slist annotation is used to refer to the list of servers for configuring the client_agent in the section below. Configuring the Agents ^^^^^^^^^^^^^^^^^^^^^^ There are two types of agents, a client_agent and a server_agent. Each agent description consists of atleast three directives; group, path and execargs. The group directive indicates the set of nodes that the client_agent should be deployed on. The path directive indicates the path to the agent code (also called an agent module). The execargs can be used to parameterize the agents at load time. The agents can be reconfigured later in the AAL also using the setConfiguration method. .. code-block:: yaml agents: client_agent: group: client_group path: /share/magi/modules/http_client/http_client.tar.gz execargs: {servers: *slist, interval: '5', sizes: 'minmax(1000,10000)'} server_agent: group: server_group path: /share/magi/modules/apache/apache.tar.gz execargs: [] Server Stream ^^^^^^^^^^^^^ The server event stream consists of three states. The start state which generates a trigger, called serverStarted, once *all* the server agents are 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 the previous case study. 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 on all 50 nodes. 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. Each client_agent fetches web pages for one of the listed servers. Next, the client stream waits for a period :math:`\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. Running the Experiment ---------------------- * Set up your environment. Assuming your experiment is named myExp, your DETER project is myProj, and the AAL file is called procedure.aal. .. code-block:: bash PROJ=myExp EXP=myProj AAL=procedure.aal * Once the experiment is swapped in, run the orchestrator, giving it the AAL above. The orchestrator needs an AAL file, and the experiment and project name. The example output below uses the project “montage” with experiment “caseClientServer”. .. code-block:: bash > /share/magi/current/magi_orchestrator.py --experiment $EXP --project $PROJ --events $AAL Once run, you will see the orchestrator step through the events in the AAL file. The output will be as follows: .. image:: ../_magiimages/casestudy_clientserver55/cs55_orch.png :width: 600px :target: ../_images/cs55_orch.png The orchestration tool enacts 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. Additionally, we have attached a detailed orchestration log that lists triggers from the clientnodes and the servernodes in the experiment. :Procedure: :download:`[casestudy_clientserver55.aal] <../_magiimages/casestudy_clientserver55/cs55_procedure.aal>`. :Topology: :download:`[casestudy_clientserver55.tcl] <../_magiimages/casestudy_clientserver55/cs55_topology.tcl>`. :Archive Logs: :download:`[casestudy_clientserver55.tar.gz] <../_magiimages/casestudy_clientserver55/cs55_exparchive.tar.gz>`. :Orchestration: :download:`[casestudy_clientserver55.orch.log] <../_magiimages/casestudy_clientserver55/cs55_orch.log>`. Visualizing Experiment Results ------------------------------ In order to visulaize the traffic on the network, we modify the above mentioned procedure to add another stream called "monitorstream". This stream deploys a packet sensor agent on the router node to measure the aggregated traffic between the server nodes and the client nodes. The packet sensor agent records the traffic data using MAGI's data management layer. .. code-block:: yaml monitor_group: [router] monitor_agent: group: monitor_group path: /share/magi/modules/pktcounters/pktCountersAgent.tar.gz execargs: {} .. code-block:: yaml monitorstream: - type: trigger triggers: [ { event: serverStarted } ] - type: event agent: monitor_agent method: startCollection trigger: collectionServer args: {} - type: trigger triggers: [ { event: clientStopped } ] - type: event agent: monitor_agent method: stopCollection args: {} The recorded data is then pulled out by the below mentioned tools to create a traffic plot. In order to populate the traffic data, re-orchestrate the experiment using the updated procedure. The updated procedure file and the corresponding logs are attached below. The aggregated traffic can then be plotted in two ways: **Offline**: A plot of the traffic flowing through the router node connecting the clients and the servers can be generated using the :ref:`magigraph`. .. code-block:: bash > GRAPHCONF=cs55_magi_graph.conf > /share/magi/current/magi_graph.py -e $EXP -p $PROJ -c $GRAPHCONF -o cs_traffic_plot.png .. image:: ../_magiimages/casestudy_clientserver55/cs55_traffic_plot.png :width: 400px **Real Time**: A real time simlualted traffic plot using canned data from a pre-run experiment can be visualized `here `_. A similar plot using live data can be plotted by visiting the same web page, and additionally passing it the hostname of the database config node of your experiment. You can find the database config node for your experiment by reading your experiment's configuration file, similar to the following. .. code-block:: none > cat /proj/myProject/exp/myExperiment/experiment.conf dbdl: configHost: node-1 expdl: experimentName: myExperiment projectName: myProject Then edit the simulated traffic plot URL, passing it the hostname. .. code-block:: none host=node-1.myExperiment.myProject http:///traffic.html?host=node-1.myExperiment.myProject The procedure, graph configuration, and archived log files that were used for the visualization of this case study are attached below. :Procedure: :download:`[casestudy_clientserver55_monitor.aal] <../_magiimages/casestudy_clientserver55/cs55_procedure_monitor.aal>`. :Archived Logs: :download:`[casestudy_clientserver55_monitor.tar.gz] <../_magiimages/casestudy_clientserver55/cs55_exparchive_monitor.tar.gz>`. :Graph Config: :download:`[casestudy_clientserver55_magi_graph.conf] <../_magiimages/casestudy_clientserver55/cs55_magi_graph.conf>`.