4a.1 grid computing infrastructure software itcs 4146/5146, unc-charlotte, b. wilkinson, 2007 feb...

Post on 19-Dec-2015

224 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

4a.1

Grid Computing Infrastructure Software

ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 16, 2007

4a.2

Gone through several development cycles.

Started before grid computing standards became accepted.

Clearly need standardized protocols and interfaces for wide adoption of grid computing.

Grid computing software

4a.3

Standards BodiesFor Internet, world wide web, and grid computing:

• W3C consortium (Worlds Wide Web Consortium)– Working on standardization of web-related technologies

such as XML, see http://www.w3.org

• OASIS (Organization for the Advancement of Structured Information Standards)

• IETF (Internet Engineering Task Force)• DMTF (Distributed Management Task Force)• Global Grid Forum (GGF) – principal grid computing

body– Started in 1998– Meets three times a year, GGF1, GGF2, GGF3 …– More than 40 organizations involved and growing …

4a.4

Standards in Web Services World

• XML introduced (ratified) in 1998• SOAP ratified in 2000• Web services developed• Subsequently, standards are continuing

to be developed:– WSDL– WS-* where * refers to names of one of

many standards

4a.5

Using web services

• It would be natural to use web services for grid computing components.

• Provides a easily identifiable interface through WDSL documents.

• Has Internet addressing (URLs).

4a.6

(Stateless) Web Services”

• “Pure” web services are stateless.

• They do not remember information from one invocation to the next.

• That can work fine for many web service applications.

• They do not need to know what happened with a previous invocation by another client.

4a.7

Simple previous web service example

• Web service MyMath with a method to square an argument and return its value:

public class MyMath{ . . . public int square(int x) { return x * x; } . . .}

Web service

x

x2

Request

Result

Client

Nothing stored permanently

4a.8

“Stateful” web service example

• With a method to add a value to an accumulating value and return its value:

public class MyMath{ . . . public void add(int x) { value += x; } . . .private int value;}

Web service

+3Request

value = 7(if value had held 4)

Client

Value kept between invocations

4a.9

Example with a “database” resource

The Grid 2: Blueprint for a new Computing Infrastructure, Ian Foster, Carl Kesselman and Steve Tuecker Editors, Morgan Kaufmann 2004 -- Chapter 17: “The Open Grid Service Architecture,” by Ian Foster, Carl Kesselman and Steve Tuecker.

4a.10

• In this example, the client accesses a file transfer service to perform actions such as transfer a file from one storage service to another.

• Key aspect here is that the state is contained in a resource that can be separate from the web service.

• Web service becomes a front end to the resource.

• Come back to this concept later.

4a.11

Open Grid Services Architecture (OGSA)

• Originally described in paper: “The Physiology of the Grid” http://www.globus.org/research/papers/ogsa.pdf

• Grid computing standard announced at GGF4 in Feb 2002.

• Defines standard mechanisms for creating, naming, and discovering service instances.

• Addresses architectural issues relating to interoperable services for grid computing.

• Does not give details of implementation.• Requires stateful services but does not say

how that will be achieved.

4a.12

Open Grid Service Infrastructure (OGSI)

• Introduced in 2002-3 (final draft June 2003).

• First attempt to standardize how stateful web services will be implemented.

• Modifies web service WDSL to enable state to be specified, using a modified WDSL language called GWSDL (“grid web definition language”),

• Introduced term “grid service.”

• Implemented in GT3.

4a.13

Open Grid Service Infrastructure (OGSI)

• Not found acceptable by the community at large because:– It significantly modified pure web service

approach– Required new tools.– Too object oriented in approach.

4a.14

WS-Resource Framework

• A specification developed by OASIS, essentially to replace OGSI and make the implementation of a stateful web service acceptable.

• Specifies how to make web service stateful and other feature, without drifting from the original web services concept.

4a.15

“Grid service”

• Broad meaning -- any service that conforms to interface conventions of a grid computing infrastructure

• Narrow (current) meaning -- a service that conforms to WSRF

4a.16

Grid computing standards

Figure from “An ‘Ecosystem’ of Grid Components”, 2004, Grid Research Integration Deployment and Support Center, http://www-unix.grids-

center.org/r6/ecosystem/ecology.php

4a.17From “The Globus Toolkit 4 Programmer’s Tutorial” by Borja Sotomayor.

4a.18

Stateful Web Services

• Obtained in WSRF by having a web service front-end to a stateful “resource.”

4a.19

Web Service

Resource

Resource properties

Client

Web Service Resource Framework(WSRF)

Holds information retained between accesses.

4a.20

WSDL file with WSRF

• Serves same purpose as WSDL file in web services – to define the service interface.

• A significant addition in the WSDL file is to specify the resource.

4a.21

Web Service

Resource

Resource properties

Client

Holds information retained between accesses.

WSDL fileincludes

specifying resource

Container

4a.22

“Stateful” web service example revisited• With a method to add a value to an

accumulating value and return its value:

public class MyMath{ . . . public void add(int x){ value += x;} . . .}

Stateless Web service

+3Request

value =7(if value had held 4)

Client

Stateful Resource

public int value;

4a.23

Service Interface

• If service implements operations on WSRF resource properties, WSDL will include definitions relating to resource property.

4a.24

Other key issuesAddressing

• WSRF service needs an addressing mechanism that includes access to the resource

• Pure web services typically use URIs (URLs)

• WSRF service addressing defined in WS-addressing standard– Uses an “endpoint reference”

4a.25

Endpoint ReferenceEPR

Includes both:

– Service address (URI)

and

– Resource identification (called a “key”)

4a.26

Endpoint Reference (EPR)

• Service URI + resource identifier (key)

public class MyMath{ . . . public void add(int x) { value += x; } . . .}

Stateless Web service

Request using EPRClient

Stateful Resource

public int value;

Identify service by URIIdentify resource

by a key (a number)

4a.27

WSRF Framework• Collection of four specifications:

– WS-ResourceProperties• Specifies how resource properties are defined

and accessed– WS-ResourceLifetime

• Specifies mechanisms to manage resource lifetimes

– WS-ServiceGroup• Specifies how to group services or WS-

Resources together– WS-BaseFaults

• Specifies how to report faults

4a.28

WS-* Standards continuedAlso:

• WS-Notification– Collection of specifications that specifies how

configure services as notification producers or consumers

• WS-Addressing– Specifies how to address web services.– Provides a way to address a web

service/resource pair

4a.29

Concrete example

Assignment 4

“Simple” Grid Services Assignment

4a.30

Assignment Goals

• Show how stateful WS-RF web services can be created using Globus 4.0

4a.31

Purpose of Service

To store an integer value which can be acted upon by methods to:

• Get its value• Increment its value (add one), and• Decrement its value (subtract one).

These methods are given. Further methods will be implemented. The service is stateful (the value is retained between accesses).

4a.32

Resource Properties

In the code provided for assignment 4, actually two resource properties:

• Value -- an integer acted upon by the operations:

– add– sub– getValueRP

and• “Last operation performed” -- a string holding

the name of the last operation done, addition or subtraction, which is not used in assignment.

4a.33

Math Web Service

Resource

Resource properties“value”

(integer)

“last operationperformed”

(string)

Client

Assignment 4 Resource Properties

4a.34

Steps in Assignment 4• Preliminary set-up

– Install GT4 and associated software

• Download provided files:– WSDL service interface file– Stateful Math web service code (in Java)– WSDD Deployment Descriptor file– Client code (java) to exercise service

• Build Math service– Package all files into an archive file (.gar)

• Deploy Math service into GT 4 container• Write and compile the client• Start container and execute client.

Easy so far!

4a.35

Final Step in Assignment 4

• Add functionality to service– Add multiple operation to Math service– Requires you to modify WSDL, service code,

and client code.– For that you will need to understand the files– Assignment Appendix gives details

4a.36

WSDL file

• Serves same purpose as WSDL file in web services – to define the service interface.

• A significant addition in the WSDL file is to specify the resource.

4a.37

Globus-specific features of WSDL

• Resource properties – specified in portType attribute wsrp:ResourceProperties

• WSDL preprocessor used to include WSRF definitions (portType attribute wsdlpp:extends).

• Bindings (how abstract interface maps to concrete protocol messages) – not needed because automatically inserted by GT4 when built.

4a.38

<definitions name="MathService”targetNamespace=“http://www.globus.org/namespaces/ examples/core/MathService_instance” xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns=http://www.globus.org/namespaces/ examples/core/MathService_instance xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/ wsrf-WS-ResourceProperties-1.2-draft-01.xsd" xmlns:wsrpw="http://docs.oasis-open.org/wsrf/2004/06/ wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" xmlns:wsdlpp="http://www.globus.org/namespaces/2004/10/ WSDLPreprocessor" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><wsdl:import namespace= "http://docs.oasis-open.org/wsrf/2004/06/ wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" location="../../wsrf/properties/WS-ResourceProperties.wsdl" />

Namespaces

Name of service being implemented

WSDL file

4a.39

<types>

<xsd:schema targetNamespace="http://www.globus.org/namespaces/examples/core/MathService_instance"

xmlns:tns="http://www.globus.org/namespaces/examples/core/

MathService_instance"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- REQUESTS AND RESPONSES -->

<xsd:element name="add" type="xsd:int"/>

<xsd:element name="addResponse">

<xsd:complexType/>

</xsd:element>

<xsd:element name="subtract" type="xsd:int"/>

<xsd:element name="subtractResponse">

<xsd:complexType/>

</xsd:element>

<xsd:element name="getValueRP">

<xsd:complexType/>

</xsd:element>

<xsd:element name="getValueRPResponse" type="xsd:int"/>

add method, argument int, returns a complex type

4a.40

<!-- RESOURCE PROPERTIES -->

<xsd:element name="Value" type="xsd:int"/>

<xsd:element name="LastOp“ type="xsd:string"/>

<xsd:element name="MathResourceProperties">

<xsd:complexType>

<xsd:sequence>

<xsd:element ref="tns:Value“ minOccurs="1“

maxOccurs="1"/>

<xsd:element ref="tns:LastOp“ minOccurs="1“

maxOccurs="1"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:schema>

</types>

4a.41

<!- M E S S A G E S --><message name="AddInputMessage"> <part name="parameters" element="tns:add"/></message><message name="AddOutputMessage"> <part name="parameters" element="tns:addResponse"/></message><message name="SubtractInputMessage"> <part name="parameters" element="tns:subtract"/></message><message name="SubtractOutputMessage"> <part name="parameters" element="tns:subtractResponse"/></message><message name="GetValueRPInputMessage"> <part name="parameters" element="tns:getValueRP"/></message><message name="GetValueRPOutputMessage"> <part name="parameters" element="tns:getValueRPResponse"/></message>

Input and output message for add method

4a.42

<!-- P O R T T Y P E -->

<portType name="MathPortType"

wsdlpp:extends="wsrpw:GetResourceProperty"

wsrp:ResourceProperties="tns:MathResourceProperties">

<operation name="add">

<input message="tns:AddInputMessage"/>

<output message="tns:AddOutputMessage"/>

</operation>

<operation name="subtract">

<input message="tns:SubtractInputMessage"/>

<output message="tns:SubtractOutputMessage"/>

</operation> 

<operation name="getValueRP">

<input message="tns:GetValueRPInputMessage"/>

<output message="tns:GetValueRPOutputMessage"/>

</operation>

</portType>

</definitions>

4a.43

Service Code

The code has two major parts:

• Resource properties• Service code (methods)

which are combined into one file for this assignment.

4a.44

Service – Resource Propertiespublic class MathService implements Resource, ResourceProperties { private ResourcePropertySet propSet; /* Resource Property set */ private int value; private String lastOp; public MathService() throws RemoteException { /* RP Constructor */ this.propSet = new SimpleResourcePropertySet( MathQNames.RESOURCE_PROPERTIES); /* Create RP set */ try { /* Initialize the RP's */ ResourceProperty valueRP = new ReflectionResourceProperty( MathQNames.RP_VALUE, "Value", this); this.propSet.add(valueRP); setValue(0); ResourceProperty lastOpRP = new ReflectionResourceProperty( MathQNames.RP_LASTOP, "LastOp", this); this.propSet.add(lastOpRP); setLastOp("NONE"); } catch (Exception e) { throw new RuntimeException(e.getMessage()); }}

Resource Property code

Resource properties

4a.45

Resource and ResourceProperty interfaces

• Resource – a way of tagging a class as being a resource. This interface does not require any methods.

• ResourceProperty – interface representing a single resource property

• ReflectionResourceProperty -- A GT4 class, one of the ways one can represent a resource property in GT 4.

4a.46

/* Get/Setters for the RPs */

public int getValue() { return value; } public void setValue(int value) { this.value = value; } public String getLastOp() { return lastOp; } public void setLastOp(String lastOp) { this.lastOp = lastOp; }

Service – Resource Properties methods

4a.47

Service code - methods /* Remotely-accessible operations */  public AddResponse add(int a) throws RemoteException { value += a; lastOp = "ADDITION"; return new AddResponse(); } public SubtractResponse subtract(int a) throws

RemoteException { value -= a; lastOp = "SUBTRACTION"; return new SubtractResponse(); } public int getValueRP(GetValueRP params) throws

RemoteException { return value; } /* Required by interface ResourceProperties */ public ResourcePropertySet getResourcePropertySet() { return this.propSet; }

add method

4a.48

Deploying a GT 4 service

• GT 4 container uses Apache Axis and the basic steps for deploying a service are similar in concept to that described for Apache Axis.

4a.49

Deployment files

•  server-config.wsdd (Web Service Deployment Descriptor) - contains information about the web service.

jndi-config.xml (JNDI configuration file) - contains information about the resource management.

4a.50

<?xml version="1.0" encoding="UTF-8"?><deployment name="defaultServerConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:xsd="http://www.w3.org/2001/XMLSchema">  <service name="examples/core/first/MathService" provider="Handler" use="literal" style="document"> <parameter name="className"value="org.globus.examples.

services.core.first.impl.MathService"/> <wsdlFile>share/schema/examples/MathService_instance/

Math_service.wsdl </wsdlFile> <parameter name="allowedMethods" value="*"/> <parameter name="handlerClass“ value="org.globus.axis.providers.RPCProvider"/> <parameter name="scope" value="Application"/> <parameter name="providers" value="GetRPProvider"/> <parameter name="loadOnStartup" value="true"/> </service></deployment>

WSDD file

specifies where service will be located.

4a.51

JNDI deployment file<?xml version="1.0" encoding="UTF-8"?> <jndiConfig xmlns="http://wsrf.globus.org/jndi/config">

<service name="examples/core/first/MathService">

<resource name="home“

type="org.globus.wsrf.impl.ServiceResourceHome">

<resourceParams>

<parameter>

<name>factory</name>

<value>org.globus.wsrf.jndi.BeanFactory</value>

</parameter>

</resourceParams>

</resource>

</service>

</jndiConfig>

4a.52

ant(Another Neat Tool)

• A build tool used for building service– forming package of files for deployment– a gar file (grid archive file)

• ant similar to make program but dependencies specified using XML configuration files.

• Windows version of assignment uses Python.

4a.53

Generating GAR file with Ant

From http://gdp.globus.org/gt4-tutorial/multiplehtml/ch03s04.html

4a.54

GT 4 build command

globus-build-service.sh service_name

Contains bash and ant files, see globus service build tools (http://gsbt.sourceforge.net)

Python version

globus-build-service.py service_name

]

4a.55

In assignment 4b (Linux server version), GT4 command (script):

globus-build-service.sh

is embedded in a script:

build.sh

which also includes a script called:

nameChangeScript

to rename student files to make them each unique.

4a.56

Deploying Service

Deployment done using GT4 command:

globus-deploy-gar

using gar file created by globus-build-service.

4a.57

Start Container

Command:

globus-start-container -nosec

-nosec specifies “no security”, which simplifies assignment (no need for user certificates)

MathService will be listed as one of the services that are available once the container has started.

4a.58

GT4 container

Mathservice

4a.59

public class Client {public static void main(String[] args) {MathServiceAddressingLocator locator = new MathServiceAddressingLocator();

try {String serviceURI = args[0];EndpointReferenceType endpoint = new EndpointReferenceType();

endpoint.setAddress(new Address(serviceURI)); //service endpt ref.MathPortType math; math = locator.getMathPortTypePort(endpoint); // Get PortType math.add(10); // Perform an addition math.add(5); // Perform another addition System.out.println("Current value: " + math.getValueRP(new GetValueRP())); // Access value

math.subtract(5); // Perform a subtraction System.out.println("Current value: " + math.getValueRP(new GetValueRP())); // Access value

} catch (Exception e) {e.printStackTrace();

}}

Java client to invoke service

4a.60

Set CLASSPATH environment variable

To set CLASSPATH (Windows):

%GLOBUS_LOCATION%\etc\globus-devel-env.bat

Then compile.

4a.61

Execute ClientExecute client:

javac -classpath build\classes\org\globus\examples\services\core\first\impl\:%CLASSPATH% org\globus\examples\clients\MathService_instance\Client.java

You will see the following result (hopefully): Current value: 15 Current value: 10 

4a.62

Undeploy sevice

Deploy service in preparation to modifying it.

Command:

globus-undeploy-gar

with named gar file.

4a.63

Extend Functionality of Service

Add a multiply method to your Math Service.

Repeat all the steps to test it.

4a.64

Acknowledgment

This assignment is derived from the book:

“Globus Toolkit 4 Programming Java Services” by Borja Sotomayor and Lisa Childers, Morgan

Kaufmann, 2006

see: http://gdp.globus.org/gt4-tutorial/ for on-line version.

4a.65

QuizWhat is a stateless web service?

(a) A web service that cannot remember prior events.

(b) A web service without local variables.

(c) A web service which can be located anywhere in the country.

(d) An illegal web service.

4a.66

What does one see when one issues the command:

globus-start-container –p 8081 –nosec

(a) 10 pages of error messages.

(b) A list of services deployed by all users.

(c) The available ports one can use.

(d) A list of the services that only you have deployed.

4a.67

Questions

top related