You are on page 1of 9

CHAPTER 7: A MULTI-AGENT FRAMEWORK

7.1 Overview Of Multiagent Framework


The overall design of a multi-agent framework as described in [ref paper by S.Roy in MultiAgent Framework]. Within the framework, an application dynamically adapts to changing resource availability exploiting adaptive runtime systems to negotiate program behavior and resource management. The framework comprises four different components, which work in an integrated manner. These four components are: 1. A Resource Broker 2. A Job Controller 3. An Analyzer 4. A Performance Tuner A set of agents is responsible for the interactions within and among the components. These agents cooperate with each other to provide an adaptive execution environment for the application. Agents are distinguished in two different categories: (i) functional agents and (ii) control agents. The functional agents in the framework perform specific tasks, which are entrusted to them. On the other hand, control agents are responsible for controlling the execution of the application. Each type of agents is part of either the Resource Broker, or the Analyzer, or the Job Controller, or the Performance Tuner. Figure 1 demonstrates agent view of these four components and communication among them. The system uses three types of functional agents, which are 1. Broker Agent 2. Analysis agent 3. Tuning Agent

COMPONENTS WITH AGENTS

Two types of Control Agents control the execution of the application. 1. Supervisory Control Agent 2. Subordinate Control Agent

7.2 Resource Broker


The Resource Broker acts as an intermediary between the application and a set of resources. It is the responsibility of the Resource Broker to negotiate and find suitable resources according to the applications resource requirement. The Resource Broker provides a single point of submission for jobs and forwards the jobs to one of the underlying resources for execution using standard resource management protocols (such as GRAM in a Grid environment). In the framework this Resource Broker consists of an agent i.e., Broker Agent and the Resource Broker is responsible for starting this agent. Broker Agent resides in Resource Broker component. Broker agent receives the Job Requirement List (JRL), where the basic requirements of job are defined, which are required to find out the most suitable resource providers [ For information regarding JRL please refer Thesis done by Gargi De Sarkar and Mrinmoy Kr. Dey ].

Broker Agent consults the Grid Information Services (GRIS/GIIS, MDS of Globus) to obtain informations about the available resources that is obtained using the Ganglia Information provider for MDS and prepares Resource Specification Table (RST) for Resource Providers willing to provide computational service. The collection of several such templates is known as Resource Specification Table (RST). The following figures show an initial implementation for JRL Template and Resource Specification Template.

JRL

RST

The Matching Agent then receives the JRL and the Resource Specification Template for matching Since the Resource Specification Template obtained is not well formatted it is transformed into a useable format so that it can be easily matched with the JRL obtained It is done using the PrintXmlhost.java program provided at the end of the chapter The Resource Specification Template thus obtained so that it can be easily matched with JRL is shown in the snapshot below

THE NEW RST Next when we prepare RST, JRL and Resource Specification Table (RST) are matched. Matching agent then prepares and sends the Agreement offer to the appropriate Resource Provider. After getting the acknowledgement from the Resource Provider, URI of Resource Provider (list) is sent to the Supervisory Control Agent of Job Controller (in Client). Broker Agent finds out the suitable resources with ability of meeting the requirements of the submitted job. Broker Agent then prepares the Agreement offer with the help of JRL and the Resource Specification Template and sends that agreement offer to the Resource Provider. After getting the acknowledgement from the Resource Provider it send URI of the Resource Provider along with the agreement (it can also send the list of Resource Provider which match the job requirements for future use) to the Supervisory Control Agent of Job Controller.

7.3 Job Controller


The Job Controller consists of two different subcomponents, one, which acts locally, and the other, which acts on a global basis. The one, which acts locally, works with local policies and interacts with local resource management services. The Global component of the performance tuner interacts with the Resource Broker and takes steps, such as rescheduling a job or establishing new service-level agreements. Job Controller is consist of Supervisory Control agent and Subordinate Control Agent. Supervisory Control Agent is the global component of the Job Controller. It also maintains a global view regarding the applications runtime behavior, as well as functioning of the infrastructure and performs control actions for improving the performance whenever the service-level agreement is violated.

7.4 Analyzer
The Analyzer component monitors individual resources and gathers performance-monitoring data regarding application execution, as well as infrastructure functioning. The application performance analysis data consists of an evaluation of performance properties and identification of regions showing performance problems. The global part of the Analyzer also maintains an integrated view of the monitoring data obtained from individual resources. This helps in identifying any performance bottleneck in the system. This component is the Analysis Agent.

7.5 Performance Tuner


The Performance Tuner is consisting of the Tuning agent, which is responsible for tuning the performance of the application at the local level. It also maintains a global view regarding the applications runtime behavior.

The java program which formats the Resource specification Template into a useable format PrintXmlhost.java import java.io.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; public class PrintXmlhost extends DefaultHandler { private int indent =0; private String spacer(int count) { String temp=""; for(int i=0;i<count;i++) temp+= " "; return temp; } public void startDocument() throws SAXException { try { OutputStream f= new FileOutputStream("host.xml"); String s= "<?xml version =\"1.0\"?>"; byte buf[]=s.getBytes(); f.write(buf); System.out.println("<?xml version =\"1.0\"?>"); } catch (IOException e) { System.out.println("sorry"); } } public void startElement( String uri, String eleName, String raw, Attributes attributes) throws SAXException { System.out.print(spacer(indent) + "<" + eleName+">" ); if(attributes != null ) for(int i=0;i<attributes.getLength();i++) System.out.println("<"+ attributes.getLocalName( i )+" > " +attributes.getValue( i )+"</"+ attributes.getLocalName(i)+">"); //System.out.println( ">" ); indent +=3; }

public void endElement ( String uri, String eleName, String raw ) throws SAXException { indent -=3; System.out.println(spacer(indent) + "</" + eleName + ">"); } public void characters(char buffer[], int offset, int length ) throws SAXException { if( length > 0 ){ String temp = new String(buffer, offset, length); if( !temp.trim().equals( "" )) System.out.println( spacer(indent) + temp.trim() ); } } public void procesingInstruction( String target, String value ) throws SAXException { System.out.println( spacer(indent) + "<?" + target + " " + value + "?>"); } public static void main( String args [] ) { try{ XMLReader saxParser = ( XMLReader ) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance(); saxParser.setContentHandler(new PrintXmlhost() ); FileReader reader = new FileReader( args[ 0 ] ); saxParser.parse( new InputSource( reader ) ); } catch ( SAXParseException spe ) { System.err.println( "Parse Error: " + spe.getMessage() ); } catch (SAXException se) { se.printStackTrace(); } catch (Exception e)

{ e.printStackTrace(); } System.exit(0); }}